The 16×2 character LCD can work in two modes, namely, 8-bit and 4-bit. These modes basically correspond to the number of data pins used in interfacing LCD. 8-bit mode uses all the data lines and has been explained in LCD interfacing with PIC18F4550. In 4-bit mode, only four data pins of LCD are connected to the controller. This mode, thus, saves four pins of the controller unlike 8-bit mode. The configuration and display method of LCD in 4-bit mode has been explained here.
The 8-bit mode of LCD interfacing with PIC has been explained earlier. In the 4-bit mode the (8-bit) data/command is sent in nibble (four bits) format to LCD. The higher nibble is sent first followed by the lower nibble. In 4-bit mode only four data pins (D4-D7) of LCD are connected to the controller. The control pins (RS, RW and EN) are connected the same way as in 8-bit mode. The connections of LCD with PIC18F4550 are shown in the adjoining circuit diagram. Please note that here only PortB is used to connect data lines as well as control lines unlike in 8-bit mode. Refer LCD interfacing with PIC in 8-bit mode.
Instruction
|
RS
|
RW
|
D7
|
D6
|
D5
|
D4
|
D3
|
D2
|
D1
|
D0
|
Function Set
|
0
|
0
|
0
|
0
|
1
|
DL
|
N
|
F
|
-
|
-
|
Value
|
DL
|
N
|
F
|
1
|
8 bit
|
2 lines
|
5×10 dots
|
0
|
4 bit
|
1 line
|
5×7 dots
|
The post How to interface 16×2 LCD in 4-bit mode with PIC18F4550 appeared first on PIC Microcontroller.