Tutorials - Elettronica


Dot matrix LCD : the CGRAM

Alcune domande comuni.

Q.: What is the function  of addresses from 08h to 0Fh in the CG table ?

For those who have closely followed what has been said, it should be clear how to work with the CGRAM, but should be also plagued by doubt.
Let's review the table of the CG.

If we look at the first column, we see that it consists of 16 items, ie the addresses between 00h and 0Fh.
We have said that the characters in CGRAM, 8 symbols in 5x8 format, are called codes from 00h to 07h. And codes from 08h to 0Fh?

This is a "copy" of the first 8 bytes. Then, by sending in the DDRAM code 00h is the same as that send the code 08h, and so on.

Q.: Initializing the display clears the CGRAM ?

Initialization by software does not change the contents of CGRAM.
Only a drop in the supply voltage will damage what is written in the RAM and the lack of tension, and his return, generates a hard reset which clears the contents of the RAM.

Q.: All controllers have the described CGRAM? 

Not all controllers can support the same characteristics of CGRAM. If the controller is declared compatible with Hitachi HD44780, he must have at least the same basic functions, but may also have u superset of features and a greater willingness on the RAM.
As usual, consult the data sheet of the component.

In particular, it is possible that different versions of the same controllers have generators of different character. In particular, the OEM versions created for a particular client may be different in some way from those commercial standards.

Q.: What is the difference in use of 5x7 and 5x8 matrices?

None from the point of view of 'use: the controller, initialized to 5x7 matrices (8) consecutive uses 8 bytes of CGRAM to display a symbol. If the 'eighth byte is 0 (5x7 matrix) is presented with a blank line, if it contains the active pixel (5x8), they will be featured on' eighth row.
Then you can have libraries of symbols in both formats and mix in CGRAM the two modes, that, from the point of view of the controller, are the same thing.

Q.: Is there any precautions to be taken in the creation of symbols for the CGRAM ?

  1. Is certainly appropriate, the first time that it prepares the contents of CGRAM, write all bytes, because, all 'ignition, the RAM should be cleared, but it is safer to assign the correct value to all the bits involved in the display, waves avoid surprises. And the same operation is recommended even after a software reset, given that the contents of the RAM may have been altered.
  2. Although you can write individual bytes in CGRAM, this operation must be carried out only if you are sure of what you are doing, in order to avoid getting incomprehensible symbols
  3. However, it certainly more important in the creation of a new symbol is to realize one effective, functional symbol for immediate understanding. The 5x7 matrix or x8 does not have the same effect as a graphic and can not represent anything. After you draw a symbol, try it on the LCD panel and check with others if its meaning is understood without ambiguity.

Q.: What is the relationship between a given DDRAM and character visible on the LCD panel ?

Another doubt may arise from the relationship between the DDRAM and the LCD panel.
A character in the DDRAM can correspond to a display panel, but can also be present in DDRAM and not be displayed at that moment.
Between DDRAM and display there is a relationship that depends on the size of the display. For example:

Module Visibile characters
Line 1 Line 2 Line 3 Line 4
16 x 2 00h - 0Fh 40h - 4Fh - -
20 x 2 80h - 93h C0h - 13h - -
40 x 2 00h - 27h 40h - 67h - -
20 x 1 00h - 13h - - -
20 x 4 00h - 13h 40h - 53h 14h - 27h 54h -  67h

In the first case, a character written to 'relative address 00h (absolute address of RAM 80h) will be displayed in the first position of the first line; one to' relative address 40h (absolute address of RAM C0h) will be displayed in the first position of the second row.

A character written into the lease for 10h (90h overall) will be present in memory DDRAM, but will not be visible until you start doing shiftare the contents of the line to the left.
By contrast, the same situation in the display of 20 characters on a line will make visible the symbol in position 17.

This allows you, if you never use the shitft, to use even as the DDRAM memory for general use or used to prepare messages that can be displayed with a shift of the display for motion effects.




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