Animation On LCD Part -2(Using Timers)

 This is  fun project  for hobbyist. It includes animating using I2C LCD  of course stm32L476RG is involved.



Hardware needed for project:-

1)I2C alphanumeric LCD.

2)STM32L476RG nucleo board.

4)Laptop(or desktop) for power ,programming and flashing.

Now get into details of how to write code for this project.

a)First we need to generate code for this project in keil by stm32cubemx.

b)After that add code in Keil uVision .

First we will illustrate with help of images how to do settings in stm32cubemx:-

Peripherals of stm32 used in this project are very few.

Only Tim1,Tim2 and I2C1 are used.


Timer1 settings:-



Timer 2 settings:-



Below are details of i2c1 settings:-


One timer is used to update the screen after a fixed interval of time, other is used to move the custom character from one place to one another. Each custom image is composed of 2 or more images which are made to move together as a single image.

Clock is set at maximum:-


 In  vector table below interrupts are selected:-


Generate the code after doing above settings in stm32cubemx.

Files marked in red line below have to be changed for the project:-



 Now open the main.c file and add code shown in below image in main function before while loop:-


Add below codes in Timer ISRs(for both timers differenet) in stm32l4xx_it.c file:-




Custom characters have to be added in customchar.h file which is responsible for showing custom characters images on LCD.




Comments