Dot matrix LCD : the CGRAM
|
Knowing how to read and write
So far we have talked about writing the CGRAM and DDRAM, but also allows the controller to read the data in RAM.
The reading depends on the RW line:
Then, to permit the reading of the RAM, the 'interface between the display module and microcontroller vdeve understand this line
|
|
|
Possibile sia scrittura che lettura |
|
Possibile solo la scrittura |
If, on the necessity of saving pin of the microcontroller, we do not use the RW line, linking it to Vss on the form, you can only write but not read. |
The operations of reading the contents of CGRAM is done in the same way as the read operations of the
DDRAM:
- you first need to send a command with the CGRAM address you want to read. This, as for writing, places the address counter to the desired
point.
- then proceed by sending a read command that will return the value found in
- if you have to read several locations later, comes into action the 'automatism already seen, with which the controller forwards the address counter automatically
The structure of the read command is as follows:
Command |
Control |
|
Data |
Function |
Read data from
CGRAM |
RS |
RW |
|
D7 |
D6 |
D5 |
D4 |
D3 |
D2 |
D1 |
D0 |
Read a data from CGRAM |
1 |
1 |
|
data
to CGRAM |
while the write command of 'address is the one previously seen:
Command |
Control |
|
Data |
Function |
Write address
to CGRAM |
RS |
RW |
|
D7 |
D6 |
D5 |
D4 |
D3 |
D2 |
D1 |
D0 |
Call an address in CGRAM for read or
write |
0 |
0 |
|
0 |
1 |
CGRAM
address |
Note that the reading or writing of a given use the same command for both the DDRAM that for the
CGRAM.
The destination will be decided by the previous command request of
address.
If you do not address this request, writing or reading will be sent to the current location contained in the count of addresses and return data read is not the one expected, or in writing, the data will be in a location other than as provided ! |
The data read from the CGRAM is composed of 8 bits stored in that given location that has been addressed.
Read more consecutive bytes of need 'update of' address, which happens automatically.
This ability to read and write allows for "improper" use of the RAM of the LCD
module, as a volatile memory for general purpose. Thus, in CGRAM, if not
filled with code symbols between 00h and 07h, can be used up to 64 bytes.
It is recalled that it is an area of RAM, the contents of which will be lost to the fall of the supply voltage.
|