Specifications

mikroElektronika | Free Online Book | PIC Microcontrollers | Appendix B: Examples
signal which would, upon command execution, indicate that the display is ready for the next piece of data. That signal,
called the busy flag, can be read from the line D7. When the voltage on this line is 0V (BF=0), the display is ready to
receive new data.
LCD Connecting
Depending on how many lines are used for connecting the LCD to the microcontroller, there are 8-bit and 4-bit LCD
modes. The appropriate mode is selected at the beginning of the operation in this process called "initialization". 8-bit LCD
mode uses outputs D0-D7 to transfer data as explained on the previous page.
The main purpose of 4-bit LED mode is to save valuable I/O pins of the microcontroller. Only 4 higher bits (D4-D7) are
used for communication, while others may be unconnected. Each piece of data is sent to the LCD in two steps- four higher
bits are sent first (normally through the lines D4-D7) and four lower bits are sent afterwards. Initialization enables the LCD
to link and interpret received bits correctly.
Data is rarely read from the LCD (it is mainly transferred from the microcontroller to LCD) so it is often possible to save an
extra I/O pin by simple connecting R/W pin to the Ground. Such saving has its price. Messages will be normally displayed,
but it will not be possible to read the busy flag since it is not possible to read the display as well. Fortunately, there is a
simple solution. After sending a character or a command it is important to give the LCD enough time to do its job. Owing
to the fact that the execution of the slowest command lasts for approximately 1.64mS, it will be sufficient to wait
approximately 2mS for LCD.
LCD Initialization
The LCD is automatically cleared when powered up. It lasts for approximately 15mS. After this, display is ready for
operation. The mode of operation is set by default. It means that:
1. Display is cleared.
2. Mode
DL = 1 Communication through 8-bit interface
N = 0 Messages are displayed in one line
F = 0 Character font 5 x 8 dots
3. Display/Cursor on/off
D = 0 Display off
U = 0 Cursor off
B = 0 Cursor blink off
http://www.mikroe.com/en/books/picmcubook/appb/ (16 of 54)5/3/2009 11:36:02 AM