Saturday, July 02, 2005

EE3376 LCD Demo

EE3376 LCD Demo: "The steps needed to send a command byte are similar.

1. The data byte we send to the LCD controller has the form: %00nnnnER. The first two bits are always zero (essentially ignored). The middle 4 bits 'nnnn' are either the 4-msb or 4-lsb nibble of the ASCII code - these are highlighted in the code below. The next bit 'E' (bit 1 of 0-7) is the enable bit; we set this to low when we first put the data into port K, then we set it to high to latch the data into the HD44780, and then low again. The last bit 'R' (bit 0) is the RS bit, which is 1 when we send data, or 0 when we send a command.
2. The ASCII code for 'S' is %01010011 (= $53), which is also the address of 'S' in the CG RAM/ROM. This is the data byte we will send to the CG RAM/ROM, and we must break it up into two writes: first the 4-msb nibble (%0101) and then the 4-lsb nibble (%0011).
3. Write the first byte containing the 4-msb nibble %0101, E=0, R=1 as: %00010101
4. We then set enable high, E=1, for > 230 nsec: %00010111
5. Then set enable low again, E-0, and wait for at least 46 usec: %00010101
6. We then send the next byte containing the 4-lsb nibble, E=0, R=1: %00001101
7. Then set the Enable bit high: %00001111
8. And then set Enable low again and wait for > 46 usec: %00001101.
9. The character 'S' should now be displayed on the LCD, and the cursor should have advanced to the next character. We then repeat the above steps for the next character to display."

No comments: