LCD modules are widely used to display calculated data’s, user references and much more. In addition all character based LCD which uses HD44780 controller consists of a special RAM known as CGRAM which allows user to create custom patterns. This tutorial will teach you to create your desired pattern as well running it as a simple animation
CG ROM is nothing but a memory which holds the pattern of the characters as predefined lcd font. Ever wondered how LCD displays the corresponding font when you pass the ASCII value of a particular character. This job was done by means of this CGROM memory.
CGRAM is the memory in the LCD module which allows user to create custom characters by rewriting the character patterns in the program.Generally we will initialize the LCD by using “0x80” command which will point the DDRAM address and from there the LCD allows us to display predefined characters which is stored in the CGROM.
In order to create custom pattern we should initialize the device to point the CGRAM address ranging from 0x00 to 0x07 in the LCD. This can be done by using the command “0x40”, which forces the device to point CGRAM address. Refer the instruction set of LCD for better understanding. Remember there is a difference between instruction “0x40” and address “0x00” try not to get confused.
So whenever you writes the instruction 0x40 it will allow us to create the predefined character in the CGRAM address 0x00. The command 0x48 will allows us to store the pattern in the address 0x01. In this way we can create up to 8 character patterns. So we now know what is CGRAM and how to initialize it for storing our custom character. Now lets see how to create the pattern in it.