Tutorials - Elettronica


Dot matrix LCD : the CGRAM


We have said that the characters can be represented in matrix from 5x8 or 5x11, but we do not have detailed this second solution, we see now.

We must consider that each element of the display consists of 8 rows of 5 points, so you can view both a 5x8 matrix a 5x7. 

In order to display a matrix of 11 rows need to use two overlapping display.
Thus, a display of 16 characters by 2 lines will be present 32 symbols 5x7 or 8 but only 16 to 5x11.

This depends on internal organization of the controller:

In the case of matrices to 8 lines, the controller is configured to use COM1-COM8 lines for each item displayed.

If the display has two lines displayed, the signals COM1-COM8 serve the first line, while the signals COM9-COM16 used the matrices of the second line of characters.

These configurations are obtained to 'initialization with an appropriate command..

For the 5x11 matrix, the controller is configured to use COM1-COM11 lines for each item displayed.


This should be done in controller initialization.

  1. The selection between the 5x7 or 5x11 is imposed during initializing the controller and applies until a new initialization or reset of the controller.
  2. You can not mix symbols with matrix 5x8 and 5x11 in the same session.
    So, wanting to present arrays of either type, you need to initialize the controller with a command, and when you want to display symbols in 'another format you must re-initialize the controller again with the correct configuration.
    Some controllers can exceed this limit with semi graphic or the availability of three lines of characters on the display, two of which can be joined to form a single line of symbols larger.

The format 5x11 is not used much because, while presenting larger symbols or details:

  • reduces the number of symbols displayed
  • is not available in all displays
  • the symbols are often unattractive, because the LCD panel presents a certain physical distance between a display element and that of the row below, which deforms the character.
  • 5x11 characters available in ROM are very limited in number (typically 32 characters).

However, where the LCD module allows, you can use 5x11 characters. And, in case you want to use the CGRAM, automatically the symbols contained will be considered in the format 5x11.
This requires the use of two blocks of 8 consecutive bytes for each symbol, and therefore reduces the possibility of creating only 4 symbols.

The procedure for creating the symbol and its call and the same view for those 8 lines; here we use 11, of which 8 bytes in the first group and 3 in the next.

For example, a 5x10 character may appear as in the diagram on the side.

The character occupies 16 bytes, or all locations from 00h to 0Fh CGRAM.

The next character will start at 10h.

Only the first 11 bytes of each block are significant. writing of the other 5 has no effect on the displayed character.

As in the case 5x7 vs. 5x8, also here the possibility is a 5x11 matrix, but in practice you use a 5x10 matrix, leaving the 'eleventh row for the cursor, or the' eleventh bytes to 0.

For example:

; g 10
LCDcharg11 db 00,00,0x0D,0x13,0x11, 0x11,0x0F,1,1,1,0x0F,0,0,0,0,0
;0x00 ; . . . . .
;0x00 ; . . . . .
;0x0D ; . # # . #
;0x13 ; # . . # #
;0x11 ; # . . . # 
;0x11 ; # . . . #
;0x0F ; . # # # #
;0x04 ; . . . . #
;0x04 ; . . . . #
;0x0f ; . # # # #
;0x00 ; . . . . . cursor row

Obviously writing cover 16 bytes instead of 8; be noted that the 5 bytes are not considered in the final display and can take any value. At the extreme, they may not be written.

The call of the characters will be made with codes ranging from 00h to 04h.

Symbol  Code Relative address
Space Absolute address 
in RAM
1 00 00h 00 - 0Fh 40h
2 01 10h 10 - 1Fh 50h
3 02 20h 20 - 2Fh 60h
4 03 30h 30 - 3Fh 70h

Writing the symbol in CGRAM and DDRAM his recall operations are quite similar to what seen so far for 5x8 matrices.




Copyright afg. Tutti i diritti riservati.
Aggiornato il 04/12/12.