Overview
In the previous post, I showed a 8-bit parallel port LCD interfacing with ATMega32 digital ports. However, as it's stated in the datasheet of HD44780, this controller could interface using only its four upper data bits (D4 to D7).
In 4-bit data transfer mode, however the controller requires its full 8-bit instruction or LCD data. To send the 8-bit instruction or data, the connected MCU needs to send it twice.
- The MCU sends the high nibble first
- Finally the lower nibble shift left for four times and send it to the LCD D7:4 pins.
Timing diagram for 4-bit interfacing mode |
By following, the JHD162A the step-by-step 4-bit LCD interfacing configuration shown below.
LCD Interfacing And Programming In 4-bit Mode
Using Two Distinct Ports
At this beginning example, I use two distinct port for LCD control pins and LCD data/instruction pins, respectively.
Schematic diagram for 4-bit LCD interfacing |
The program display the time in days and HH:MM:SS since the MCU powered up. I fetch the source code from my GitHub gist respiratory below.
The simulation shows 1 minute and 38 seconds since the MCU powered up. |
Click here to download this example archive.
Using A Single Port
We can use a single port for LCD interfacing in some situations. The overall process is the same. But we must select any control pins in the same port.
Using A Single Port - Here I use a 20x4 LCD. |
Source code fetched from gist.
Schematic Diagram For A Single Port Interfacing |
Click here to download example archive. This character LCD can be driven by a serial to parallel shift registers. We can use these two chips - the SN74HC595 and the SN74HC164.
No comments:
Post a Comment