In this tutorial, I will discuss about character entry mode of LCD 16x2 HD44780. There are 4 character entry mode that can be selected. So far, we have been used the default character entry mode until previous post. The entry mode is auto-incrementing the cursor address every new character is entered. It is also possible to auto-decrementing the cursor and combine with shifting the display.
This is the first entry mode or the default entry mode. To do this we can send instruction 0b00000110 to the LCD. This is the default entry mode every LCD powered on. Every new character is entered, the cursor/ DDRAM address is auto-incremented by 1. This mode is illustrated by picture below:
- Set cursor to 0x07 address location.
- Put char 'A' on 0x07 location, cursor auto-incremented to 0x08 address location.
- Put char 'B' on 0x08 location, cursor auto-incremented to 0x09 address location.
- Put char 'C' on 0x09 location, cursor auto-incremented to 0x0A address location.
- Return home (0x00 location).
The second mode entry is auto-decrement. This mode is like first mode but, every new character is entered, the cursor/ DDRAM address is auto-decremented by 1. To do this mode, we can send instruction 0b00000100 to the LCD. This mode is illustrated by picture below:
- Set cursor to 0x07 address location.
- Put char 'A' on 0x07 location, cursor auto-decremented to 0x06 address location.
- Put char 'B' on 0x06 location, cursor auto-decremented to 0x05 address location.
- Put char 'C' on 0x05 location, cursor auto-decremented to 0x04 address location.
- Return home (0x00 location).
- Set cursor to 0x07 address location.
- Put char 'A' on 0x07 location, cursor auto-incremented to 0x08 address location, display character auto-shifted to the left.
- Put char 'B' on 0x08 location, cursor auto-incremented to 0x09 address location, display character auto-shifted to the left.
- Put char 'C' on 0x09 location, cursor auto-incremented to 0x0A address location, display character auto-shifted to the left.
- Return home (0x00 location) and the shifted display is back to normal.
- Set cursor to 0x07 address location.
- Put char 'A' on 0x07 location, cursor auto-decremented to 0x06 address location, display character auto-shifted to the right.
- Put char 'B' on 0x06 location, cursor auto-decremented to 0x05 address location, display character auto-shifted to the right.
- Put char 'C' on 0x05 location, cursor auto-decremented to 0x04 address location, display character auto-shifted to the right.
- Return home (0x00 location) and the shifted display is back to normal.
No comments :
Post a Comment