Ads

Get STM32 tutorial using HAL at $10 for a limited time!

Sunday, September 20, 2015

LCD 16x2 HD44780 Tutorial 4 - Character Entry Mode

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:

  1. Set cursor to 0x07 address location.
  2. Put char 'A' on 0x07 location, cursor auto-incremented to 0x08 address location.
  3. Put char 'B' on 0x08 location, cursor auto-incremented to 0x09 address location.
  4. Put char 'C' on 0x09 location, cursor auto-incremented to 0x0A address location.
  5. 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:

  1. Set cursor to 0x07 address location.
  2. Put char 'A' on 0x07 location, cursor auto-decremented to 0x06 address location.
  3. Put char 'B' on 0x06 location, cursor auto-decremented to 0x05 address location.
  4. Put char 'C' on 0x05 location, cursor auto-decremented to 0x04 address location.
  5. Return home (0x00 location).
The third mode entry is auto-increment combine with auto-shift. The cursor is auto-incremented and at the same time the display character also auto-shifted to the left. This is like entry mode that usually used on calculator. To do this mode, we can send instruction 0b00000111 to the LCD. This mode is illustrated by picture below:

  1. Set cursor to 0x07 address location.
  2. Put char 'A' on 0x07 location, cursor auto-incremented to 0x08 address location, display character auto-shifted to the left.
  3. Put char 'B' on 0x08 location, cursor auto-incremented to 0x09 address location, display character auto-shifted to the left.
  4. Put char 'C' on 0x09 location, cursor auto-incremented to 0x0A address location, display character auto-shifted to the left.
  5. Return home (0x00 location) and the shifted display is back to normal.
The last mode entry is auto-decrement combine with auto-shift. The cursor is auto-decremented and at the same time the display character also auto-shifted to the right. To do this mode, we can send instruction 0b00000101 to the LCD. This mode is illustrated by picture below:

  1. Set cursor to 0x07 address location.
  2. Put char 'A' on 0x07 location, cursor auto-decremented to 0x06 address location, display character auto-shifted to the right.
  3. Put char 'B' on 0x06 location, cursor auto-decremented to 0x05 address location, display character auto-shifted to the right.
  4. Put char 'C' on 0x05 location, cursor auto-decremented to 0x04 address location, display character auto-shifted to the right.
  5. Return home (0x00 location) and the shifted display is back to normal.

No comments :

Post a Comment