Difference between revisions of "HD44780 display"
(initial page) |
|||
Line 51: | Line 51: | ||
==Operation== | ==Operation== | ||
+ | The display can operate in both 8 and 4-bit mode. | ||
+ | By default, it will start at 8-bit mode, so you need extra initialization before you can start bit banging per nibble. | ||
+ | |||
+ | For most of the things you do, you need to write either a command (instruction) or just data (text). | ||
+ | Therefore, you need a write routine. | ||
+ | RS (Pin4) determines the type (command/data), the rest is just nibbles and bytes ;) | ||
+ | |||
+ | Note: for a better timing, refer to table 6 (page 24 and 25) of the datasheet. Also, waiting on the the busy flag is recommended. | ||
===8-bit=== | ===8-bit=== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |+ 4-bit mode write sequence | ||
+ | ! scope="col" | Pin | ||
+ | ! scope="col" | Action | ||
+ | ! scope="col" | Description | ||
+ | |- | ||
+ | | EN | ||
+ | | 0 | ||
+ | | make sure chip is in normal operation | ||
+ | |- | ||
+ | | RS | ||
+ | | 0 or 1 | ||
+ | | command->0 or data->1 | ||
+ | |- | ||
+ | | D0-D7 | ||
+ | | bits 0 to 7 | ||
+ | | place byte on bus | ||
+ | |- | ||
+ | | EN | ||
+ | | 1 | ||
+ | | latch the data onto the chip | ||
+ | |- | ||
+ | | | ||
+ | | wait | ||
+ | | > 450ns for the data to latch | ||
+ | |- | ||
+ | | EN | ||
+ | | 0 | ||
+ | | resume normal operation | ||
+ | |- | ||
+ | | | ||
+ | | wait | ||
+ | | > 5ms for a command to execute, or > 200us for data to set | ||
+ | |} | ||
===4-bit=== | ===4-bit=== | ||
+ | |||
+ | Note that setting the display in 4-bit mode seems to require two commands (three write instructions: the first in 8-bit mode, the other in 2x4-bit: see page 24, 42 and 46 of the datasheet). | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |+ 4-bit mode write sequence | ||
+ | ! scope="col" | Pin | ||
+ | ! scope="col" | Action | ||
+ | ! scope="col" | Description | ||
+ | |- | ||
+ | | EN | ||
+ | | 0 | ||
+ | | make sure chip is in normal operation | ||
+ | |- | ||
+ | | RS | ||
+ | | 0 or 1 | ||
+ | | command->0 or data->1 | ||
+ | |- | ||
+ | | D4-D7 | ||
+ | | bits 4 to 7 | ||
+ | | place high nibble on bus | ||
+ | |- | ||
+ | | EN | ||
+ | | 1 | ||
+ | | latch the data onto the chip | ||
+ | |- | ||
+ | | | ||
+ | | wait | ||
+ | | > 450ns for the data to latch | ||
+ | |- | ||
+ | | EN | ||
+ | | 0 | ||
+ | | make sure chip resumes normal operation (waiting for the next nibble in 4bit mode) | ||
+ | |- | ||
+ | | | ||
+ | | wait | ||
+ | | > 5ms for memory to prepare command, or > 200us for data to set | ||
+ | |- | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | D4-D7 | ||
+ | | bits 0 to 3 | ||
+ | | place low nibble on bus | ||
+ | |- | ||
+ | | EN | ||
+ | | 1 | ||
+ | | latch the data onto the chip | ||
+ | |- | ||
+ | | | ||
+ | | wait | ||
+ | | > 450ns for the data to latch | ||
+ | |- | ||
+ | | EN | ||
+ | | 0 | ||
+ | | resume normal operation | ||
+ | |- | ||
+ | | | ||
+ | | wait | ||
+ | | > 5ms for a command to execute, or > 200us for data to set | ||
+ | |} | ||
==physical device== | ==physical device== | ||
+ | [[User:Xopr|Xopr]] 23:25, 16 June 2011 (CEST) plans to bring a myAVR LCD for usage in the space: it's a 2x18 regular green version | ||
==references== | ==references== | ||
[http://joshuagalloway.com/lcd.html joshuagalloway.com's lcd page] | [http://joshuagalloway.com/lcd.html joshuagalloway.com's lcd page] | ||
+ | [http://www.sparkfun.com/datasheets/LCD/HD44780.pdf HD44780 datasheet from sparkfun] |
Revision as of 22:25, 16 June 2011
Hitachi HD44780 compatibele LCD
Pinout
A HD44780 compatible display has 14 or 16 pins, depending whether it has backlight. For a working display, you need a minimum of 6 microcontroller ports: RS, EN and D4-D7.
Pin | Name | Description |
---|---|---|
1 | VSS | Ground |
2 | VDD | +5 volts |
3 | VLC | Contrast voltage, normally < 1V |
4 | RS | Register Select (high=Data write, low=Command write) |
5 | R/W | Read/Write (high=read, low=write) |
6 | EN | Enable: high pulse latches command or data |
7-10 | DB0-DB3 | 8-bit mode only: data/command bits 0-3 |
11-14 | DB4-DB7 | 8-bit mode: data/command bits 4-7, or both nibbles in 4-bit mode |
15,16 | AB,KB | (optional) Background light: anode, kathode |
Operation
The display can operate in both 8 and 4-bit mode. By default, it will start at 8-bit mode, so you need extra initialization before you can start bit banging per nibble.
For most of the things you do, you need to write either a command (instruction) or just data (text). Therefore, you need a write routine. RS (Pin4) determines the type (command/data), the rest is just nibbles and bytes ;)
Note: for a better timing, refer to table 6 (page 24 and 25) of the datasheet. Also, waiting on the the busy flag is recommended.
8-bit
Pin | Action | Description |
---|---|---|
EN | 0 | make sure chip is in normal operation |
RS | 0 or 1 | command->0 or data->1 |
D0-D7 | bits 0 to 7 | place byte on bus |
EN | 1 | latch the data onto the chip |
wait | > 450ns for the data to latch | |
EN | 0 | resume normal operation |
wait | > 5ms for a command to execute, or > 200us for data to set |
4-bit
Note that setting the display in 4-bit mode seems to require two commands (three write instructions: the first in 8-bit mode, the other in 2x4-bit: see page 24, 42 and 46 of the datasheet).
Pin | Action | Description |
---|---|---|
EN | 0 | make sure chip is in normal operation |
RS | 0 or 1 | command->0 or data->1 |
D4-D7 | bits 4 to 7 | place high nibble on bus |
EN | 1 | latch the data onto the chip |
wait | > 450ns for the data to latch | |
EN | 0 | make sure chip resumes normal operation (waiting for the next nibble in 4bit mode) |
wait | > 5ms for memory to prepare command, or > 200us for data to set | |
D4-D7 | bits 0 to 3 | place low nibble on bus |
EN | 1 | latch the data onto the chip |
wait | > 450ns for the data to latch | |
EN | 0 | resume normal operation |
wait | > 5ms for a command to execute, or > 200us for data to set |
physical device
Xopr 23:25, 16 June 2011 (CEST) plans to bring a myAVR LCD for usage in the space: it's a 2x18 regular green version
references
joshuagalloway.com's lcd page HD44780 datasheet from sparkfun