8051 – LCD Custom Character

Hi guys…. In our last tutorial we have seen How to interface LCD to 8051. In this tutorial we are going to see how to generate LCD Custom Character using 8051. Common guys…. 

 How to generate LCD Custom Character using 8051


So we know how to display alphanumeric characters in LCD. We can easily display that. Because it is already stored in the ROM memory of LCD. Before that we should know the memories of LCD. There are three types of memory present in the LCD display.

  1. CG ROM
  2. DD RAM
  3. CG RAM

CG ROM (Character Generator ROM) 

This memory holds the pattern for every single character of  predefined LCD font. and you call the content of this memory by the placing  corresponding ASCII value on the LCD port . For example if you want to display  ‘A’ you have to send the ASCII value of ‘A’ which is 0x41 to the LCD.   So we cannot modify its contents which is stored already.

DD RAM  (Display Data RAM)

DDRAM is the memory which holds only those characters which are currently on the screen . means if there is a message is currently being displayed on the screen then it has to be  on the DDRAM. For example if you want to display “hello” on the screen then you have to load pattern of h from the CG ROM to DD RAM then do the same for ‘e’ ,’l’ ,’l’ and ‘o’.

This is the address of the DDRAM memory in 16×2 LCD 

Row1 0x800X810X820X83......0X8F
This memory works same as CG ROM but as this is RAM we can modify it’s content any time. So this is the place where we can store our custom character pattern. Then that pattern can be sent to display.

CG RAM (Character generator RAM)

For making custom patterns we need to write values to the CGRAM area defining which pixel to glow. These values are to be written in the CGRAM adress starting from 0x40. Bit 7 is 0 and Bit 6 is 1, due to which the CGRAM adress command starts from 0x40, where the address of CGRAM (Acg) starts from 0x00. CGRAM has a total of 64 Bytes. When you are using LCD as 5×8 dots in function set then you can define a total of 8 user defined patterns (1 Byte for each row and 8 rows for each pattern), where as when LCD is working in 5×10 dots, you can define 4 user defined patterns.

This code will print the custom character in Tamil language. Tamil language is not in the LCD. So that i’m going to create the few characters from tamil. You can also try in your language. See the code attached below.

Pin Diagram

dd 8051 - LCD Custom Character

RS is connected to Port 0.0 (P0.0)

RW is connected to Port 0.1 (P0.1)

EN is connected to Port 0.2 (P0.2)

Data lines are connected into Port 2 (P2)



scroll-custom 8051 - LCD Custom Character

Thank you guys. If you have any doubt please feel free to ask us. 

%d bloggers like this: