Creating Pac man custom patterns and animation in LCD display

Summary of Creating Pac man custom patterns and animation in LCD display


LCD modules with HD44780 controllers use CGROM for predefined fonts, DDRAM for displayed characters, and CGRAM to store user-defined custom patterns. This tutorial explains how to initialize CGRAM using specific commands (0x40–0x48) to create up to eight custom characters and animate them on the screen.

Parts used in Custom LCD Pattern Creation:

  • LCD Module
  • HD44780 Controller
  • CGROM Memory
  • DDRAM Memory
  • CGRAM Memory
  • Instruction Set Commands

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

Creating Pac man custom patterns and animation in LCD display

CGROM:

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.

DDRAM:

This memory holds the characters which are currently displayed on the screen. That is whenever a character is about to displayed the contents of the CGROM will be loaded to the DDRAM and in this way the characters can be displayed in the screen.

CGRAM:

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.

 

Quick Solutions to Questions related to Custom LCD Pattern Creation:

  • What is the function of CGROM in an LCD?
    CGROM holds the pattern of characters as a predefined LCD font to display corresponding fonts when ASCII values are passed.
  • How does DDRAM help in displaying characters?
    DDRAM holds the characters currently on the screen by loading contents from CGROM whenever a character is about to be displayed.
  • What command initializes the LCD to point to the DDRAM address?
    The instruction 0x80 is used to initialize the device to point the DDRAM address for displaying predefined characters.
  • Which command forces the device to point to the CGRAM address?
    The command 0x40 forces the device to point to the CGRAM address ranging from 0x00 to 0x07.
  • How many custom character patterns can be created in CGRAM?
    You can create up to eight character patterns by utilizing addresses 0x00 through 0x07.
  • What command stores a pattern in CGRAM address 0x01?
    The command 0x48 allows storing the pattern specifically in the address 0x01.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top