ApplicationNote

Page5

$mod51
;**************************************************
;**
;*T6963ApplicationNoteV1.0*
;**
;**************************************************
;Theprocessorclockspeedis16MHz.
;Cycletimeis.750mS.
;Demosoftwaretodisplayabit-mapped
;graphicona240x64graphicsdisplay
;withaT6963CLCDcontroller.
org000h
ljmpstart;programstart
org100h
start:
;InitializetheT6963C
clrp3.3;hardwarereset
nop
nop
setbp3.3
movdptr,#msgi1;initializationbytes
lcallmsgc
;Startofregularprogram
;Displaygraphic
movdptr,#msgi2;setautomode
lcallmsgc
movdptr,#msg1;displaygraphic
lcallmsgd
sjmp$
;*************************************************
;SUBROUTINES
;MSGCsendsthedatapointedtoby
;theDPTRtothegraphicsmodule
;asaseriesofcommandswith
;twoparameterseach.
msgc: movr0,#2;#ofdatabytes
msgc2: clra
movca,@a+dptr;getbyte
cjnea,#0a1h,msgc3;done?
ret
msgc3:movr1,a
lcallwrited;sendit
Software: incdptr
djnzr0,msgc2
clra
movca,@a+dptr;getcommand
movr1,a
lcallwritec;sendcommand
sjmpmsgc;nextcommand
;MSGDsendsthedatapointedtoby
;theDPTRtothegraphicsmodule.
msgd: clra
movca,@a+dptr;getbyte
cjnea,#0a1h,msgd1;done?
ret
msgd1: movr1,a
lcallwrited;senddata
incdptr
sjmpmsgd
;WRITECsendsthebyteinR1toa
;graphicsmoduleasacommand.
writec:lcallstatus;displayready?
setbp3.2;c/d=1
writec1:
movp1,r1;getdata
clrp3.0;strobeit
setbp3.0
ret
;WRITEDsendsthebyteinR1tothe
;graphicsmoduleasdata.
writed:lcallstatus;displayready?
clrp3.0;c/d=0
sjmpwritec1
;STATUSchecktoseethatthegraphic
;displayisready.Itwon'treturn
;untilitis.
status:setbp3.2;c/d=1
movp1,#0ffh;P1toinput
movr3,#0bh;statusbitsmask
stat1: clrp3.1;readit
mova,p1
setbp3.1
anla,r3;statusOK?
clrc
subba,r3
jnzstat1
ret