Commands and Instruction set
Only the instruction register (IR) and the data register (DR) of the LCD can be controlled by the MCU. Before starting the internal operation of the LCD, control information is temporarily stored into these registers to allow interfacing with various MCUs, which operate at different speeds, or various peripheral control devices. The internal operation of the LCD is determined by signals sent from the MCU. These signals, which include register selection signal (RS), read/write signal (R/W), and the data bus (DB0 to DB7), make up the LCD instructions (Table 3). There are four categories of instructions that:- Designate LCD functions, such as display format, data length, etc.
- Set internal RAM addresses
- Perform data transfer with internal RAM
- Perform miscellaneous functions
Table 3: Command and Instruction set for LCD type HD44780
Although looking at the table you can make your own commands and test them. Below is a breif list of useful commands which are used frequently while working on the LCD.
No. | Instruction | Hex | Decimal |
---|---|---|---|
1 | Function Set: 8-bit, 1 Line, 5x7 Dots | 0x30 | 48 |
2 | Function Set: 8-bit, 2 Line, 5x7 Dots | 0x38 | 56 |
3 | Function Set: 4-bit, 1 Line, 5x7 Dots | 0x20 | 32 |
4 | Function Set: 4-bit, 2 Line, 5x7 Dots | 0x28 | 40 |
5 | Entry Mode | 0x06 | 6 |
6 | Display off Cursor off (clearing display without clearing DDRAM content) | 0x08 | 8 |
7 | Display on Cursor on | 0x0E | 14 |
8 | Display on Cursor off | 0x0C | 12 |
9 | Display on Cursor blinking | 0x0F | 15 |
10 | Shift entire display left | 0x18 | 24 |
11 | Shift entire display right | 0x1C | 30 |
12 | Move cursor left by one character | 0x10 | 16 |
13 | Move cursor right by one character | 0x14 | 20 |
14 | Clear Display (also clear DDRAM content) | 0x01 | 1 |
15 | Set DDRAM address or coursor position on display | 0x80 + address* | 128 + address* |
16 | Set CGRAM address or set pointer to CGRAM location | 0x40 + address** | 64 + address** |
Table 4: Frequently used commands and instructions for LCD |
** CGRAM address from 0x00 to 0x3F, 0x00 to 0x07 for char1 and so on..
The table above will help you while writing programs for LCD. But after you are done testing with the table 4, i recommend you to use table 3 to get more grip on working with LCD and trying your own commands. In the next section of the tutorial we will see the initialization with some of the coding examples in C as well as assembly.
* DDRAM address given in LCD basics.
THANK YOU FOR VISITING..!!
PLEASE COMMENT
No comments:
Post a Comment