09.07.2015 Views

Interfacing a Hantronix 320 x 240 Graphics Module to an 8-bit ...

Interfacing a Hantronix 320 x 240 Graphics Module to an 8-bit ...

Interfacing a Hantronix 320 x 240 Graphics Module to an 8-bit ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Application NoteCrystal Clear <strong>an</strong>dVisibly Superior LCD<strong>Module</strong>s<strong>Interfacing</strong>a<strong>H<strong>an</strong>tronix</strong><strong>320</strong>x<strong>240</strong><strong>Graphics</strong><strong>Module</strong><strong>to</strong><strong>an</strong> 8-<strong>bit</strong>MicrocontrollerIntroduction:Due<strong>to</strong>its thinprofile, light weight, lowpowerconsumption<strong>an</strong>deasy h<strong>an</strong>dling, liquidcrystal graphicdisplay modules areusedinawide varietyof applications. The <strong>320</strong>x<strong>240</strong> (¼ VGA)LCDdisplay isvery popularin<strong>an</strong>umberof different computingenvironments. It is forthis reasonthat acontrollerisnot includedonthe module.Possible choices of controllers include<strong>an</strong>embedded8-<strong>bit</strong> microcontrollerwith<strong>an</strong>LCDcontroller,suchas theEpson/S-MOS SED1335ortheOKI MSM6255/6355. Someembeddedmicrocontrollers, suchasthe NationalNS486SXF, havebuilt-inLCDcontrollers <strong>an</strong>dwill interfacedirectly <strong>to</strong>thedisplay.ForPCbasedembeddedcontrollers liketheIntel 386/486EX, aVGA controllerchip, suchastheChips <strong>an</strong>dTechnologyF65545 ortheVadem VG-660,isthe bestchoice.Ifthe display is <strong>to</strong>be rundirectly from aPC,<strong>an</strong>umberof VGA cards areavailable that willoperatewith this display. Anumberof singleboardcomputers areavailablewithLCDdisplay outputs.This applicationnotewilldealwithoneof themostpopularapplicationenvironments, the8-<strong>bit</strong>embeddedmicrocontroller. Theexampledetailedhereis basedonaPhillips87C751microcontrollerdriving<strong>an</strong>Epson/S-MOS SED1335LCDcontroller.Functional Description:The<strong>H<strong>an</strong>tronix</strong> <strong>320</strong>x<strong>240</strong>seriesof displays have<strong>an</strong>industry st<strong>an</strong>dard4-<strong>bit</strong> parallelinterface. Thisinterfacerequires thecontroller<strong>to</strong>continuously refreshthedisplay <strong>an</strong>d<strong>to</strong>maintainthevideodisplay RAM.Beforethedisplayc<strong>an</strong>be used themicrocontrollermustfirst sendaseriesof initializationbytes <strong>to</strong>theLCDcontroller<strong>to</strong>set upits operational parameters <strong>an</strong>d<strong>to</strong>describethedisplay <strong>to</strong>thecontroller.Onceinitializedthe applicationmicrocontrollerc<strong>an</strong>sendtext orgraphic data<strong>to</strong> theLCDcontrollerwhereit willbeformatted<strong>an</strong>ds<strong>to</strong>redin thedisplay RAM. Coincidentwith theseRAMupdates theLCDcontrolleris continuously readingdatafromthedisplay RAM, serializingit <strong>an</strong>dsendingit <strong>to</strong>thedisplay. Theapplicationmicrocontrollerdoesn’t havedirectaccess <strong>to</strong>thedisplayRAM <strong>an</strong>dmust sendall data<strong>an</strong>d comm<strong>an</strong>ds <strong>to</strong>theLCDcontrollerchip.Schematic:The87C751microprocessoris connected<strong>to</strong> theLCDcontrollerchipviaparallel I/Oports inthisexample. It couldalso beconnected <strong>to</strong>theprocessor's databus<strong>an</strong>dbemappedin<strong>to</strong>theprocessor'sdatamemoryarea. Seefigure1.Page1Copyright2000, <strong>H<strong>an</strong>tronix</strong>,Inc.Allrightsreserved


Application NoteCrystal Clear <strong>an</strong>dVisibly Superior LCD<strong>Module</strong>sSoftwareFlowchart:WRITE ACOMMANDBYTECOMM32:WRITE ADATABYTEWRITE32:MAINPROGRAMLOOPSTART:A0 SETHIGHA0SET LOWINITIALIZESED1335DATATOP1CS=0WRLOWSENDS ABLOCKOFDATATOTHE DISPLAYDATA32:GET BYTEFROMTABLECLEARTEXTPAGEDISPLAYBITMAPDISPLAYTEXTWRHIGHENDBYTE?NOYESRETURNENDCS=1CALLWRITERETURNINC.TABLEPOINTERInitialization:Beforethe LCDcontrollerc<strong>an</strong>accept ordisplay dataortext it must beinitialized. Thisisusuallydoneimmediatelyafterthesystem is poweredup.Thefollowingchart lists theinitializationcomm<strong>an</strong>ds <strong>an</strong>d theparameters that accomp<strong>an</strong>y them alongwithabrief expl<strong>an</strong>ationof thefunctionof each.Page3Copyright2000, <strong>H<strong>an</strong>tronix</strong>,Inc.Allrightsreserved


Application NoteInitialization bytes:Crystal Clear <strong>an</strong>dVisibly Superior LCD<strong>Module</strong>sCOMMAND CODE PARAMETER FUNCTIONSYSTEMSET 40h 30h LCDPANEL HARDWARE SETUP87h CHARACTERWIDTH[7] INPIXELSSCROLLCURSORFORMCURSORDIRECTION44h5dh4ch07h27h39hefh28h000efhb0h04hefh000004h86hCHARACTERHEIGHT[7+1]INPIXELSADDRESS RANGE FOR1TEXTLINELINE LENGTHINCHARACTERS [40-1=39]NUMBEROFLINESPERFRAME [<strong>240</strong>]HORIZONTALADDRESS RANGE(TEXT)[40]SETS THE SCROLLSTARTADDRESS ANDTHENUMBEROFLINESPERSCROLLBLOCKCURSORFORMANDSIZE [BLOCK,4PIXELS WIDE,6PIXELS HIGH]CURSORDIRECTIONINAUTOWRITE MODE [RIGHT]HORIZONTALSCROLLRATE 5ah 00h HORIZONTALSCROLLRATE, [1] PIXEL ATATIMEOVERLAY 5bh 01h TEXT/GRAPHICS OVERLAY MODE [EXOR]DISPLAY ON/OFF 59h 16h DISPLAY ON/OFF[ON]Displayed image:Page4Copyright2000, <strong>H<strong>an</strong>tronix</strong>,Inc.Allrightsreserved


Application NoteCrystal Clear <strong>an</strong>dVisibly Superior LCD<strong>Module</strong>sdata321:mov r1,alcall write32 ;senditinc dptrsjmp data32 ;nextbyte;CleartextRAMonthe3224clrtext:mov r1,#46h ;setcursorlcall comm32mov dptr,#msg13 ;cursorparamlcall data32mov r1,#42h ;mwritelcall comm32mov dptr,#msg11 ;allspaceslcall data32mov r1,#46h ;setcursorlcall comm32mov dptr,#msg6lcall data32ret;************************************************;TABLESANDDATA;allofwhichare20hmsg11:db ' 'db 01ahmsg18: db 0,01ah ;hscrparam;<strong>320</strong>x<strong>240</strong>bonsaitreegraphic;Thefollowingtableisnotlisted;here.Itconsistsof9600bytes;whichconstituteafullscreen;<strong>bit</strong>mapimageofabonsaitree.;Youmayaddafewbytesbeforethe;01ahterminationbytefortesting;puposesorincludeacomplete;<strong>bit</strong>mapimagemsg12:msg13:db01ahdb 0,0,01ah ;setcursor;<strong>to</strong>textpage;Initializationparametersfor3224.msg1:db 30h,87h,07h,27h;systemsetdb 39h,0efh,28h,0h,0a1hmsg2:db 0,0,0efh,0b0h ;scrolldb 04h,0efh,0,0db 0,0,0a1hmsg3:db 04h,86h,0a1h ;csrformmsg4:db 01h,0a1h ;overlayparammsg5:db 16h,0a1h ;dispon/offmsg14:msg15:msg16:msg17:dbdbdbdbdbdbdbdbend'HANTRONIX'0a1h'CrystalClear<strong>an</strong>d'0a1h'VisiblySuperior'0a1h'LCD<strong>Module</strong>s'0a1hmsg6:msg7:msg8:msg9:msg10:db0b0h,04h,0a1h ;setcursor<strong>to</strong>;graphicspagedb 31h,2h,0a1h ;setcursor;textpage;1stlinedb 59h,2,0a1h ;2ndlinedb 81h,2,0a1h ;3rdlinedb 0a9h,2,0a1h ;4thline;1200spacesfortextpageclear;Thefollowingtableisnotlisted;here,exceptforthefirst8bytes,;butconsistsof1200bytesPage6Copyright2000, <strong>H<strong>an</strong>tronix</strong>,Inc.Allrightsreserved

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!