HD44780 LCD can have upto 8 custom characters.
THEORY FOR CUSTOM CHARACTER GENERATION
the basic technology of lcd based on 3 type of memory
the address of cg ram is totally depends on the size of the lcd like for
CG RAM : 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 have to first store our custom character pattern. then that pattern can be sent to display.
the HD44780 has total 8 CG RAM memory location . so we can generate only up to 8 custom characters . but you can always change the content of CG RAM on the fly to generate new characters .
the addresses of 8 CG RAM location goes from 0x00 to 0x07.
WHEN Ever we want something of these fonts to be displayed on the screen we write them to the DD RAM
NOW QUESTION IS
HOW TO POINT TO CG RAM MEMORY LOCATION instead off DD RAM, so that we can write something ?
the answer is quite simple The HD44780 provide a dedicated command to set writing pointer to CG RAM
for example if you want to write you first custom character to 0x00 CG RAM location then you have to send lcd a command
lcdCmd(0x40);
after this now you are ready to send data to CG RAM location 0x00.
after sending the whole pattern for location 0x00 the location pointer will auto increase to 0x01 location
or if you want to store something to 0x03 location then send direct command lcdCmd(0x43);
now we know how to goto the CG RAM but now problem is
HOW TO DECIDE AND WRITE CUSTOM FONT TO CG RAM ?
a standard 5×8 dots font is being shown in the image as you can see there are total 8 bytes of data on the whole to decide pattern of the font.
as yo can see all you need to do is decide the first row pattern like in the example image of a battery symbol
in first row the first pixel is off so lsb bit 0 is 0 and pixel 1 is on so bit1 is 1 and pixel 2 is on so bit 2 is 1
this method apply on each row of the font ( 8 rows ). which gives us total 8 bytes of data first msb 3 bits are always 0.
you can also use this web tool to decide this pattern and code. CLICK HERE
now we have our pattern to be written to the CG RAM.
the writing sequence is like this
now we are ready to display this font on to lcd. but keep one thing in mind you should get back to DD RAM, to display this data on to screen . this can be done by setting DD RAM address. like for 16×2 char lcd first, row first character send lcdCmd(0x80);
implementation with PIC MCU
CLICK HERE TO DOWNLOAD SOURCE CODE N HEX