Page 163 - Making PIC Microcontroller Instruments and Controllers
P. 163
LIOUID CNYSTAL DISPLAY EXERCISES I55
4. Write a progmm to identify the button prcsscd on lhc bullon pad by displaying i|s
ro\l'nnmber on line I and lts colunn on line 2. Idenlily each line so you know whal
is bcing displaycd whcre. Scroll the two liDes up e\'erl tine a button is pressed.Add
delays in |he scrcll so you can actually see the scrolling take place.
The full insrucrion table fof the LCD is shown in Tabie 9.6
COII,IMAND R R - - - - - OATA BUSS - - - - - - DESCRIPTION EXECUTIN
s w 7 6 5 4 3 2 1 0 TIME
Clear Display 0 O O 0 0 0 0 0 0 1 Clea|s display & relurns 1.64 msec
Cursor al 0 0 0 0 0 0 0 0 1
address 0, Also returns
lhe display being shilled
to lhe or ginal posilion,
DDRAI\,4 conlenls rema n
Entry Mode 0 0 0 0 0 0 0 1 t/D s l/D:Sel curcof moving 40 psec
Set
l/D=1:lncremenl
l/D=0: Decrement
S: Specify shiJl of display
S=1: The display s shiJied
S=0:The display is not
shiifed
Display 0 0 0 0 0 0 l D C B Dlsplay D=1: Display on 40 Usec
ON/OFF D=0iDisplay
otf
Conirol Cursor C=lrCursoron
C=orCursoroll
B nk B=1:Blink on
B=0iBlink otf
Cursor/ 0 0 0 0 0 1 S/C R/L x x lvoves cursof or shiils ihe 40 lsec
Display display W/o chang ng
shifl DD BA[,,] conlenls
S/C-0: Cu|s0r shlft
(RA[,4 unchanged)
S/C=1:Display shill
(RAlvlunchansed)
io
R/L=1:Shllt the r Shl
F/L=O:Sh lt to the lelt