6.2 Displaying User Defined Data

Figure 6.6 shows the block diagram of the HD44780 LCD module. The module contains three types of memories: an 80 × 8 bits display data RAM (DDRAM), 64 bytes of character generator RAM (CGRAM), and a 9920 bit character generator ROM (CGROM). The data displayed currently by the LCD is stored in the DDRAM. On displays with fewer than 80 characters, any unused DDRAM locations can be used as a general purpose RAM. The CGRAM stores the user defined character set. The CGROM stores the fixed character set of the LCD, which can vary between different manufacturers. The device has two registers, an instruction register (IR) and a data register (DR). The IR can be written from the microcontroller and it stores the instruction codes and address information. The DR stores the data to be written into the DDRAM or the CGRAM. Data written into the DR is automatically transferred to the DDRAM or the CGRAM. An address counter is used to address the DDRAM and CGRAM. This counter is incremented or decremented automatically after writing (or reading) into the DDRAM or the CGRAM.

Figure 6.6 Block diagram of the HD44780 module

img

The user can specify any pattern of up to 8 characters made up of a 5 × 7 matrix, or up to 4 characters with a 5 × 10 matrix. Figure 6.7 shows the relationship between the character codes, CGRAM address and the CGRAM data for 5 × 7 display matrix. CGRAM address bits 3 to 5 (000 to 111) correspond to 8 characters. CGRAM address bits 0 to 2 (000 to 111) correspond to the line numbers of the characters. CGRAM data bits 0 to 4 correspond to the column data of the pattern to be generated. The user defined CGRAM characters are displayed when character code bits 4 to 7 are all 0. In the example in Figure 6.7, the user defined character ‘R’ will be displayed when character code 0 × 00 is selected (notice that since bit 3 of the character code is don't care, the character can also be displayed by selecting code 0 × 08).

Figure 6.7 Relationship between character codes, CGRAM addresses and CGRAM data

img

The CGRAM data for character ‘R’ in Figure 6.7 is given below. This data can be loaded into the CGRAM using the LCD instruction Set CGRAM Address and Write Data to CGRAM (see Sections 6.4.7 and 6.4.10):

img

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.199.250