INTERFACING OF PIC18F4550 TO LCD IN 8-BIT MODE
All LCD have two mode of working:
1.)
For 8-bit mode => Command is (0x38).
2.)
For 4-bit mode => Command is (0x28).
Interfacing of PIC to LCD in 8-Bit mode with Busy mode.
- Busy mode is checked using last data pin of LCD display (D7).
- If D7 is High When en Pin.
3 Important Pin of LCD are rs, rw, en.
- rs = Register Select pin is used to Select Command or Data Register.
- rw = Read/Write pin is used to Read or Write Data.
- en = Enable pin is used to latch data into display and to read data from lcd.
rs
|
0
|
Command
|
1
|
Data
|
|
rw
|
0
|
Write
|
1
|
Read
|
|
en
|
1-> 0
|
Latch data into
LCD
|
0 -> 1
|
Latch data out
from LCD
|
PORTD = LCD Data.
STEP1: 1st
Set the Last Bit of PORTD i.e. RD7
STEP2: rs =
0; To Select Command Register.
STEP3: rw = 1;
To Select Read Mode.
STEP4: en
=> High to Low. To Latch data out of LCD
STEP5: Check
for Bit Set D7 and if D7 => 1; go to Step4.
Or
else do nothing.
We have to make 3 important Function.
1.) Command Function to send command to LCD
2.) Data Function to send single data to LCD
3.) Initialize LCD to Work in 8-biit Mode.
MODE Explanation
0x38 - LCD as 16 x 2 line in 8-bit mode
0x28 - LCD as 16 x 2 line in 4-bit mode.
0x0C - Cursor ON, Blinking OFF
0x0E - Cursor ON, Blinking ON
0x06 - Auto increment Cursor
0x80 - 1st line and 1st location of LCD
0xC0 - 2nd line and 1st location
We have to make 3 important Function.
1.) Command Function to send command to LCD
2.) Data Function to send single data to LCD
3.) Initialize LCD to Work in 8-biit Mode.
MODE Explanation
0x38 - LCD as 16 x 2 line in 8-bit mode
0x28 - LCD as 16 x 2 line in 4-bit mode.
0x0C - Cursor ON, Blinking OFF
0x0E - Cursor ON, Blinking ON
0x06 - Auto increment Cursor
0x80 - 1st line and 1st location of LCD
0xC0 - 2nd line and 1st location
Now rest all you will understand by seeing the Code.
Thank You.
Code: Click for Code
For Video:Click on this Link
No comments:
Post a Comment