Dot matrix LCD : the CGRAM
|
What to write in CGRAM.
We observed that the content of CGRAM must correspond to the matrix of points on or off that you want to present on the display.
For example, to obtain the display of a symbol designed ad hoc:
Locazione |
Punti |
Contenuto |
binario |
hex |
1 |
0 |
1 |
1 |
1 |
0 |
01110 |
0Eh |
2 |
1 |
0 |
0 |
0 |
1 |
10001 |
11h |
3 |
1 |
0 |
0 |
0 |
1 |
10001 |
11h |
4 |
0 |
1 |
1 |
1 |
0 |
01110 |
0Eh |
5 |
0 |
0 |
1 |
0 |
0 |
00100 |
04h |
6 |
0 |
0 |
1 |
0 |
0 |
00100 |
04h |
7 |
0 |
0 |
1 |
0 |
0 |
00100 |
04h |
8 |
0 |
1 |
1 |
0 |
0 |
01100 |
0Ch |
you should write the sequence of bytes 04h, 0Eh, 11h, 11h, 0Eh, 04h, 04h, 04h, 0Ch in 8 consecutive locations of
CGRAM.
Since the CGRAM is designed to hold 8 symbols of 8 bytes each, each symbol will have a different starting
address:
Symbol |
Code |
Relative address
in CGRAM |
Space in CGRAM |
Absolute address
in RAM |
1 |
00 |
00h |
00 - 07h |
40h |
2 |
01 |
08h |
08 - 0Fh |
48h |
3 |
02 |
10h |
10 - 17h |
50h |
4 |
03 |
18h |
18 - 1Fh |
58h |
5 |
04 |
20h |
20 - 27h |
60h |
6 |
05 |
28h |
28 - 2Fh |
68h |
7 |
06 |
30h |
30 - 37h |
70h |
8 |
07 |
38h |
38 - 3Fh |
7Fh |
For example, the symbol seen above, positioned as symbol 3, will occupy these positions in memory
Indirizzo in CGRAM |
Contenuto |
B7 |
B6 |
B5 |
B4 |
B3 |
B2 |
B1 |
B0 |
10h |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
11h |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
12h |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
13h |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
14h |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
15h |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
16h |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
17h |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
The symbol next location 18h and will start from the next 8 bytes and so on.
The symbol will be called into DDRAM writing code 03h. The next symbol it will be with the code 04h, and so on.
Note that the CGRAM is composed of cells of 8 bits each, of which, however, the symbol in the format 5x8 occupies only the first 5 least significant
bits.
Bits B5 to B7 are not part of the display and can take any value.
|