HD44789U have 8 Bi-directional data/command ports.
RS: Register Select
If RS = 0 then Instruction Register is selected, RS = 1 Data Register is selected.
R/W: Read or Write
If R/W = 0 then data is write to instruction register or data register of the HD44780U
If R/W = 1 then data is read from instruction register or data register of the HD44780U
E: Enable (Latch data)
This pin is used to latch the data present on the data pins. A high-to-low edge is needed to latch the data.
Interfacing HD44780U with microcontroller
Interfacing micro controller with LCD display driver have two operations, one is modifying Instruction Register and other is modifying Data Register. Instruction register is used for setting interface data length, number of lines, shift operation e.t.c. and data register is used to store display characters.
P0.1 is connected to the E (Enable), P0.1 to R/W’ (Read/Write) and the P0.2 to RS (Register Select).
To modify registers first check the busy flag, int Busy (void) function perform this operation. If busy flag is zero then set RS = 0 for Instruction Register and RS = 1 for Data Register. If R/W = 0 for writing the data to instruction register or data register of the HD44780U, A high-to-low edge in Pin E is needed to latch the data.
void Command (int Value) function to write data to instruction register and void Display (int Value) function is to write data to data register.
8051 Microcontroller is interfaced with the HD44780U with 4-bit data length. For 4 bit data interface 8 bit data is split into two 4 bit data, that operation is perform by void Command2 (int Value) to modify instruction register and void Display2 (int Value) to modify data register.
To simulate circuit in this project, initially activate Mixed Mode simulator from the Schematic Editor window. Selecting Run Transient analysis from Simulation menu can perform simulation