An LCD is an Liquid Crystal Display which displays electronic visual display. For more information about the controller, click on this Tutorial on LCD
Connections to the 8051:
We need to connect our LCD pinouts to a port of the 8051 microcontroller and program the controller to display characters on the LCD. More information in the Tutorial on LCD
Steps for the LCD to work:
RS- Register Select:
There are 2 very important registers in LCD; the Command Code register and the Data Register.
If RS=0, the Code register is selected, allowing user to send command
If RS=1, the Data register is selected allowing to send data that has to be displayed.
R\W input allows the user to write information to LCD or read information from it. How do we read data from LCD? The data that is being currently displayed will be stored in a buffer memory DDRAM. This data could be read if necessary.
If R\W=1, then set for reading Reading
R\W=0, then set for reading Writing
The enable Pin is used by the LCD to latch information at its data pins. When data is supplied to data pins, a high to low pulse must be applied to this pin in order for the LCD to latch the data present in the data pins.
E=1 then 0, set the LCD a Toggle
We have to prepare an LCD properly before the character we need, has to be displayed. For this a number of commands have to be provided to the LCD before inputting the required data. The commands will be discussed in the later part of this tutorial.
LCD doesn’t know about the content (data or commands) supplied to its data bus. It is the user who has to specify whether the content at its data pins are data or commands. For this, if a command is inputted then a particular combination of 0s and 1s has to be applied to the control lines so as to specify it is a Command on the other hand if a data is inputted at the data lines then an another combination of 0s and 1s has to be applied to the control lines to specify it is Data.
If we need to send a command to the lcd then set RS=0, R\W=0, E=1\0
If we need to send a Data to the lcd then set RS=1, R\W=0, E=1\0
More information in the Tutorial on LCD
The following are the different types of command instructions:
Programming the 8051 in 'C':
The Port data of the lcd (D0-D7) is set to Port 3 and the flowing connection RS=P2.0, RW=P2.1, E=P2.2