Code:
KS0070b Initialization
2x16 LCD (KS0070b)
4 bit mode
2 lines
Display=on
Cursor=off
Blink=off
Increment mode
Entire shif=off
(Pseude-code, same as the table below).
==============================================
Power on
(PIC and LCD module).
==============================================
Wait 40 ms
==============================================
(Function Set)
------------------
Set the LCD pins:
DB7,DB6,DB5,DB4 = 0010
Toggle the Enable line:
PULSOUT Enable_Pin,100 (min.100 µs)
------------------
Set the LCD pins:
DB7,DB6,DB5,DB4 = 0010
Toggle the Enable line:
PULSOUT Enable_Pin,100 (min.100 µs)
------------------
Set the LCD pins:
DB7,DB6,DB5,DB4 = 1000 (2 lines, 5x7 dots)
Toggle the Enable line:
PULSOUT Enable_Pin,100 (min.100 µs)
------------------
==============================================
Wait 100 µs
==============================================
(Display On/Off Control)
Set the LCD pins:
DB7,DB6,DB5,DB4 = 0000
Toggle the Enable line:
PULSOUT Enable_Pin,100 (min.100 µs)
Set the LCD pins:
DB7,DB6,DB5,DB4 = 1100 (Display on, cursor off, blink off).
Toggle the Enable line:
PULSOUT Enable_Pin,100 (min.100 µs)
==============================================
Wait 100 µs
==============================================
(Clear display)
Set the LCD pins:
DB7,DB6,DB5,DB4 = 0000
Toggle the Enable line:
PULSOUT Enable_Pin,100 (min.100 µs)
Set the LCD pins:
DB7,DB6,DB5,DB4 = 0001
Toggle the Enable line:
PULSOUT Enable_Pin,100 (min.100 µs)
==============================================
Wait 2 ms
==============================================
(Entry Mode Set)
Set the LCD pins:
DB7,DB6,DB5,DB4 = 0000
Toggle the Enable line:
PULSOUT Enable_Pin,100 (min.100 µs)
Set the LCD pins:
DB7,DB6,DB5,DB4 = 0110 (Incremet mode, entire shif off).
Toggle the Enable line:
PULSOUT Enable_Pin,100 (min.100 µs)
==============================================
Wait 2 ms
==============================================
End of the KS0070b Initialization.
Bookmarks