Академический Документы
Профессиональный Документы
Культура Документы
1. <RS=Low>
2. Function set <eg: 00111000 = 8bit,2line,5x7dots>
3. Send *enable pulse <delay -> enable-high -> delay -> enable-low ->delay>
4. <RS=Low>
5. Display,Cursor,Blinking-Cursor Set <eg: 000001110 = ON,ON,OFF resp.>
6. Send *enable pulse <delay -> enable-high -> delay -> enable-low ->delay>
7. <RS=Low>
8. Entry mode set <always: 00000110 = ? Cursor in incrment position,Shift
invisible>
9. Send *enable pulse <delay -> enable-high -> delay -> enable-low ->delay>
10. <RS=Low>
11. Clear Display < 00000001 = Clear Display>
12. Send *enable pulse <delay -> enable-high -> delay -> enable-low ->delay>
To write data:
****************
1. <rs=high>
2. Output charchter ascii in bin to data o/p to parallel port <eg. : 90=Z
,01011010>
3. Send *enable pulse <delay -> enable-high -> delay -> enable-low ->delay>
4. IMPORTANT! : If some charachters appears to be missing then try increasing the
delay time.So as to give the lcd enought time for processing.
5. If required to work in Nibble mode:
As the lcd initializes auto. in 8.bit mode,but we hav connected only
4lines(i.e: D7-DD4) So we can act like, like we using all 8lines
and sending (while keeping rs => low) 00100000 or 0010xxxx (which is the
function command.Bit4 is telling to function as 4.bit
interference. So thats how using 4lines the inteference is switched from 8bit
to 4bit pretending to use 8lines. Then as after that
4bit interference is activated we can again send the function instruction in
nibble form to set the 1line/2line, 5x7/5x10 dots settings
by:
i) rs = low
ii) Send 0010xxxx to data output of parallel port <where '0010' is the higher
nibble of function instruction "00101000">
iii) then send 1000xxxx <where '1000' is lower nibble of the function instruction
"00101000">
iv) And like that other control commands and data(to be printed) can be
transmitted in the same way.
Character# : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Line 1 ---- x x x x x x x x x x x x x x x x
Line 2 ---- x x x x x x x x x x x x x x x x
Line 3 ---- x x x x x x x x x x x x x x x x
Line 4 ---- x x x x x x x x x x x x x x x x
Position of the cursor can set by writing control commands to the ddram(data
display ram) by Sending (while rs low)
128 + 'charchter number' (10xxxxxx x=>is the no count on lcd in binary )
according to the lcd charachter count for setting cursor to any char of 1st line.
& 192 + 'charchter number' (11xxxxxx x=>is the no count on lcd in binary )
according to the lcd charachter count for setting cursor to any char of 2nd line.
******************************************************************************
*******************************************************************************
20 + 'charchter number' according to the lcd charachter count for setting
cursor to any char of 3rd line.
84 + 'charchter number' according to the lcd charachter count for setting
cursor to any char of 4th line.
As the custom generated charachters are stored in CGRAM (& Only till lcd is
powered on), there is only from 00000000 to 00000111 (0 to 7 of ascii code)
is reserved for Custom Chars. Means that after generating the chars, we can
access those chars sending (0 to 7 ascii to o/p port).
1001 0100
Timing:
*********
Most of the instructions execute in less than 40us, but clear and home take as
much as 1.64ms. So delay must be enough to let the process complete.
20x1 module
Line 1 addresses are 00h to 13h
20x2 module
Line 1 addresses are 00h to 13h
Line 2 addresses are 40h to 53h
20x4 module
Line 1 addresses are 00h to 13h
Line 2 addresses are 40h to 53h
Line 3 addresses are 14h to 27h
Line 4 addresses are 54h to 67h
40x2 module
Line 1 addresses are 00h to 27h
Line 2 addresses are 40h to 67h
The full 128 bytes of display RAM exist no matter how many characters appear on
the display. These extra bytes can be typed on when display window scrolling is
enabled, or they can be used to store other information--external data RAM for the
CPU, if you like.