6.4 Display Timing and Control

Although the mikroC Pro for PIC compiler includes a library of functions for using LCD displays, it is worthwhile to learn the basic principles of how the LCD operates.

Correct operation of the LCD display requires knowledge of the instruction set and correct timing. Figure 6.8 shows LCD the instruction set. The instructions are described in the next sections.

Figure 6.8 HD44780 instruction set

img

6.4.1 Clear Display

This instruction clears the display and returns the cursor to the home position. ASCII ‘Space’ codes (hexadecimal 0 × 20) are filled in all DDRAM addresses and the address counter is reset to 0. The instruction format is:

img

6.4.2 Return Cursor to Home

This instruction returns the cursor to the home position, which is the top left corner of the display. The instruction format is:

img

6.4.3 Cursor Move Direction

This instruction sets the cursor move direction and specifies whether or not to shift the display. These operations are performed during data read and write. The instruction format is:

img

The DDRAM address is incremented (I/D = 1) or decremented ...

Get Using LEDs, LCDs and GLCDs in Microcontroller Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.