Toshiba T6963C User Manual

ApplicationNote
InterfacingtoaGraphicsModulewithaToshiba T6963CController
Introduction:
TheToshibaT6963CLCDcontrollerisoneofthemostpopularcontrollersforuseinsmallgraphics displays.ForthisreasonitisusedinanumberofLCDmodulesfrom128x128to 240x128 pixels. Thisclassofmoduleismostcommonlyusedtodisplayamixtureoftextand graphics in samall devicesandinstruments.Itisusuallyinterfaceddirectlywithanembedded8-bit microprocessor. Thisapplicationnotedescribestheuseofthiscontrollerwithanumberof graphics modules. Theexampleusedhereisbasedonan8-bitIntelI8051microcontroller but applies to almost any micro-controller.
FunctionalDescription:
TheT6963Cusesasimple8-bitdatabustotransferallinstructionsanddatatoandfromthe display.Afterpowerisappliedahardwareresetisissued.Thecontrollermustthenbeinitialized withaseriesofcommandstosetupthevariousmodesandoptionsavailabletotheuser.Once initializedthedisplayisreadytoacceptthedatatobedisplayed.Thisdatacanbeintheformof bit-mappedgraphicaldataortextdatainpseudoASCIIformat.Theinternalcharactergeneratoris biasedat-20h.whichmeanstheusermustsubtract20hfromtheASCIIcodebeforesendingitto thedisplay.
Inthebit-mappedmodeeachbyteofdatarepresents8pixelsonthedisplay.SeeFigure#1.Text datacanbewritteninpseudoASCIIformatandwillbedisplayedasa5x7dotcharacter.The graphicalandtextdataarewrittentoseparate,userassigned,areas,orpages,inthedisplayRAM withinthedisplaymodule.Theusercanthenchooseoneofthreewaystomixthetextand graphicspagesonthedisplayorthetextorgraphicspagecanbedisplayedalone.
D0
ST
1BYTE
D1
D3 D4 D5
D2
TH
17BYTE
Figure#1Memorymapofa128x128display
D7 D0 D1
D6
ND
2BYTE
Schematic:
The80C51microprocessorisconnectedtotheLCDcontrollerchipviaparallelI/Oportsinthis example.Itcouldalsobeconnectedtotheprocessor'sdatabusandbemappedintothe processor'sdatamemoryarea.Seefigure2.
Page1
ApplicationNote
1N4148
33pF
16.00mHz
33pF
+5v
+
10k
1uF
X1
X2
RST
80C51
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P3.0
P3.1
P3.2
P3.3
240x64LCDDISPLAY
D0 D1 D2 D3 D4 D5 D6 D7
WR RD CE CD RESET
+5v
V
FS
V FG
DD
V
L
SS
-15V
Figure2Schematicdiagram
20K
Software:
Thesampleprogramhereiswrittenin8051assemblylanguageandisdesignedtoworkwiththe hardwareshowninFigure2.Itisbasedona240x64displaybutisapplicabletoanyLCD with the T6963Ccontroller.
Theprogramfirstresetsthedisplay.Thisresetmustlastaminimumof2µS.Itthensendsaseriesof commandbytesandparameterstotheLCDcontrollertoinitializeit.TheT6963Crequiresthatthe parameters,ifany,aresentinthedatamodeandmustprecedethecommandbyte,whichissentin thecommandmode.
Thecontrollerisinitializedwiththegraphicspageat0000-077fh.Thisis1920byteswhichwill accommodateafullscreenofdata.Notextisdisplayedinthisexamplebutthecontrolleris initializedfortextoperationtoillustratetheprocess.Thetextpagestartsimmediatelyfollowingthe graphicspageatlocation0780h.
TheFS(FontSelect)lineissettoazerointhisexamplewhichwillplacethe5x7pixelcharacterina 8x8pixelfield.Thiswillproduce30charactersperlinewith8linesperdisplay().Thetotal numberofcharacters possibleinthismodeis240.
AoneontheFSlinewillproducean6x8pixel
240
8
=30
fieldforeachcharacter. Afterinitializationthecontrollerissetintheautowritemodeandthedisplayisfilledwithabit-
mappedgraphic. Thecodeexampleisnotwrittentobeefficientbuttobeassimpleaspossible.
tofollow
Page2
ApplicationNote
SoftwareFlowchart:
MAINPROGRAMLOOP
START:
INITIALIZE
T6963C
DISPLAY BITMAP
END
WRITEA
COMMANDBYTE
WRITEC:
WRITEA
DATABYTE
WRITED:
SENDABLOCKOFDATA
TOTHEDISPLAY
MSGD:
GETBYTE
FROMTABLE
CALL
WRITED
INC.TABLE
POINTER
STATUSCHECK
STATUS:
RETURN
COMMAND
PARAMETERS
SETCOUNTER
FROMTABLE
YES
SENDA
WITH
MSGC:
TO2
GETBYTE
END
BYTE?
NO
CALL
WRITED
STATUS
OK?
YES
SETC/DTO1 SETC/DTO0
DATATOP1
WRLOW
WRHIGH
RETURN
NO
STATUS
OK?
YES
NO
SETC/DTO1
RDLOW
READBYTE
RDHIGH
STATUS
OK?
YES
RETURN
NO
INC.TABLE
POINTER
DECREMENT
COUNTER
CNT=
0?
YES
GETCOMM.
FROMTABLE
CALL
WRITEC
NO
Page3
ApplicationNote
Initialization:
BeforetheLCDcontrollercanacceptordisplaydataortextitmustbeinitialized.Thisisusually doneimmediatelyafterthesystemispoweredup.Thefollowingchartliststheinitialization commandsandtheparametersthataccompanythemalongwithabriefexplanationofthefunction ofeach.Whereaparameterisdifferentforadisplaythatdiffersinresolutionfromthe240x64 example,thealternatevaluesarealsolisted.
Initializationbytes:
COMMAND CODE PARAMETERS* FUNCTION
TEXTHOMEADDRESS 40h 80h,07h
1eh,00h
(240x128,240x64)
TEXTAREA
41h
14h,00h
(160x128)
10h,00h
(128x128)
STARTOFTHETEXTSTORAGEAREAINDISPLAYRAM 0780h
LINELENGTHINCHARACTERS=30=1ehFORAN 8BITCHARACTERCELL(FS=0).(28hFORFS=1)
LINELENGTHINCHARACTERS=20=14hFORAN 8BITCHARACTERCELL(FS=0).(1ahFORFS=1)
LINELENGTHINCHARACTERS=16=10hFORAN 8BITCHARACTERCELL(FS=0).(15hFORFS=1)
240
8
160
8
128
8
GRAPHICHOMEADDRESS 42h 00h,00h
1eh,00h
(240x128,240x64)
GRAPHICAREA
43h
14h,00h
(160x128)
10h,00h
(128x128)
MODESET
ADDRESSPOINTERSET
DISPLAYMODESET
*ADDRESSESAREFORMATTEDAS[LSB,MSB]
81h
24h
98h
00h,00h
Displayedimage:
STARTOFTHEGRAPHICSSTORAGEAREAINDISPLAY RAM0000h
LINELENGTHINPIXELS=30=1eh
LINELENGTHINPIXELS=20=14h
LINELENGTHINPIXELS=16=10h
240
8
160
8
128
8
"EXOR"TEXTMODE
LOCATIONOFNEXTDATAWRITE(ORREAD) INTHISCASETHEBEGINNINGOFTHEGRAPHICSAREA
TEXTOFF,GRAPHICSON
Page4
ApplicationNote
Software:
$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
;MSGDsendsthedatapointedtoby ;theDPTRtothegraphicsmodule.
msgd:
msgd1:
;WRITECsendsthebyteinR1toa ;graphicsmoduleasacommand.
writec:
writec1:
;WRITEDsendsthebyteinR1tothe ;graphicsmoduleasdata.
incdptr djnzr0,msgc2 clra movca,@a+dptr;getcommand movr1,a lcallwritec;sendcommand sjmpmsgc;nextcommand
clra movca,@a+dptr;getbyte cjnea,#0a1h,msgd1;done? ret
movr1,a lcallwrited;senddata incdptr sjmpmsgd
lcallstatus;displayready? setbp3.2;c/d=1
movp1,r1;getdata clrp3.0;strobeit setbp3.0 ret
;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
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
Page5
ApplicationNote
;************************************************ ;TABLESANDDATA
;Initializationbytesfor240x64 msgi1:
db80h,07h,40h;texthomeaddress db1eh,00,41h;textarea db00,00,42h;graphichomeaddress db1eh,00,43h;graphicarea db00,00,81h;modeset db00,00,24h;addresspointerset db00,00,98h;displaymodeset db0a1h
msgi2:
;240x64Bitmapgraphicdata ;Onlythefirst8bytesareshownhere ;Therealgraphicconsistsof1920bytes ;ofbinarydata.
msg1:
db00,00,0b0h;automode db0a1h
db00h,00h,00h,00h,00h,00h,00h,00h db0a1h
end
Page6
Loading...