How to display custom animations on 16x2 LCD using 8051 microcontroller (AT89C51)

Summary

Animating custom made characters on a 16x2 LCD screen can be very exciting. (Also see LCD custom characters.) This topic explains the principle and operation of a displaying animation on LCD using Microcontroller AT89C51.

8051 Microcontroller (AT89C51) based custom animations on LCD

Description

There's a useful side effect to the way the LCD controller uses CG RAM. Normally, we define a pattern in CG RAM, and then print the character. But it is also possible to change the CG RAM for characters that are already on the screen, and their appearance will change (for more detail about CG RAM and LCD refer LCD custom character and LCD interfacing).

 

The connections in the circuit are as follow: the output of controller (from port P2) goes to data pins of LCD numbered 7-14. The control pins RS (pin4), R/W (pin5) and EN (pin6) are connected to the pins 0, 1 and 6 of port P3 (P3^0, P3^1 & P3^6, respectively).
Sample animation: A moving arrow continuously passing through hearts.

Before animation, the custom characters of heart, cutting heart, blank screen and arrow should be stored at different addresses. For more detail on creating custom characters refer LCD custom character.
In 1st step print an arrow and two hearts placed at some distance apart.
 In 2nd step print blank screen, cutting heart and 2nd heart.
 In 3rd step print blank screen, heart, arrow and 2nd heart.
 In 4th step print blank screen, heart, blank screen, arrow and 2nd heart.
In 5th step print blank screen, heart, blank screen, blank screen and
cutting heart.
These steps can be repeated continuously to produce an animation.
 

 

Circuit Diagram

Video

Code

This Code is only visible to Registered users. Please Login/Register

 

Components

Presets | Variable Resistors
Preset
 
A preset is a three legged electronic component which can be made to offer varying resistance in a circuit. The resistance is varied by adjusting the rotary control over it. The adjustment can be done by using a small screw driver or...
AT89C51 Microcontroller, Atmel 89C51 Controller Image
AT89C51 Microcontroller

AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash programmable and erasable read only memory (...

16 x 2 LCD | 16x2 Character LCD Module
LCD

 

LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments...