Specifications

mikroElektronika | Free Online Book | PIC Microcontrollers | Appendix B: Examples
What is ASCII? From their inception till today, computers can recognize only numbers, but not letters. It means that all
data a computer swaps with a peripheral device has a binary format even though the same is recognized by the man as
letters (The keyboard is an excellent example)! It’s as simple as that- every character matches the unique combination of
zeroes and ones. ASCII is character encoding based on the English alphabet. ASCII code specifies a correspondence
between standard character symbols and their numerical equivalents.
LCD Basic Commands
All data transferred to LCD through the outputs D0-D7 will be interpreted as a command or a data, which depends on the
pin RS logic state:
RS = 1 - Bits D0 - D7 are addresses of the characters to be displayed. LCD processor addresses one character from the
character map and displays it. The DDRAM address specifies the location on which the character is to be displayed. This
address is defined prior character transfer or the address of the previously transferred character is automatically
incremented.
RS = 0 - Bits D0 - D7 are commands which determine display mode.
The commands recognized by the LCD are listed in table below:
Command RS RW D7 D6 D5 D4 D3 D2 D1 D0 Execution Time
Clear display 0 0 0 0 0 0 0 0 0 1 1.64mS
Cursor home 0 0 0 0 0 0 0 0 1 x 1.64mS
Entry mode set 0 0 0 0 0 0 0 1 I/D S 40uS
Display on/off
control
0 0 0 0 0 0 1 D U B 40uS
Cursor/Display
Shift
0 0 0 0 0 1 D/C R/L x x 40uS
Function set 0 0 0 0 1 DL N F x x 40uS
Set CGRAM
address
0 0 0 1 CGRAM address 40uS
Set DDRAM
address
0 0 1 DDRAM address 40uS
Read "BUSY" flag
(BF)
0 1 BF DDRAM address -
Write to CGRAM
or DDRAM
1 0 D7 D6 D5 D4 D3 D2 D1 D0 40uS
Read from
CGRAM or DDRAM
1 1 D7 D6 D5 D4 D3 D2 D1 D0 40uS
I/D 1 = Increment (by 1) R/L 1 = Shift right
0 = Decrement (by 1) 0 = Shift left
S 1 = Display shift on DL 1 = 8-bit interface
0 = Display shift off 0 = 4-bit interface
D 1 = Display on N 1 = Display in two lines
0 = Display off 0 = Display in one line
U 1 = Cursor on F 1 = Character format 5x10 dots
0 = Cursor off 0 = Character format 5x7 dots
B 1 = Cursor blink on D/C 1 = Display shift
0 = Cursor blink off 0 = Cursor shift
What is Busy flag ?
Compared to the microcontroller, the LCD is an extremely slow component. Because of this, it was necessary to provide a
http://www.mikroe.com/en/books/picmcubook/appb/ (15 of 54)5/3/2009 11:36:02 AM