13.07.2015 Views

Interfacing a Hantronix 128x64 Graphic Module to an 8-bit ...

Interfacing a Hantronix 128x64 Graphic Module to an 8-bit ...

Interfacing a Hantronix 128x64 Graphic 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 NoteCrystalClear<strong>an</strong>dVisiblySuperior LCD<strong>Module</strong>sSoftware Source Code:$MOD751;**************************************************;* *;* HD61202 Application Note V1.0 *;* *;**************************************************;The processor clock speed is 16MHz.;Cycle time is .750mS.;HD61202 demo software <strong>to</strong> display;the <strong>H<strong>an</strong>tronix</strong> logo on a128 x64 LCD.orgljmporg00hstart100h;Initialize the 64gs12Start:mov p3,#00mov r0,#00h ;set 64gs12 leftmov dptr,#msgi1 ;initialization byteslcall comm<strong>an</strong>dmov r0,#01h ;set 64gs12 rightmov dptr,#msgi1 ;initialization byteslcall comm<strong>an</strong>d;Display patternmov r4,#0b8h ;page comm<strong>an</strong>dmov r5,#08h; ;page countLoop1:mov r0,#00h ;set 64gs12 leftmov dptr,#msg1llcall byteclr p3.1 ;set comm<strong>an</strong>dinc r4 ;bump page addmov a,r4mov r1,alcall writedjnz r5,loop1 ;repeat 8timesmov r4,#0b8h ;page add. Comm<strong>an</strong>dmov r5,#8h ;page countLoop2:mov r0,#01h ;set 64gs12 rightmov dptr,#msg1rlcall byteclr p3.1 ;set comm<strong>an</strong>dinc r4 ;bump page addmov a,r4mov r1,alcall writedjnz r5,loop2 ;repeat 8timessjmp $ ;end;*************************************************;SUBROUTINES;COMMAND sends the byte pointed <strong>to</strong> by;the DPTR <strong>to</strong> the graphics module;as aseries of comm<strong>an</strong>ds.Comm<strong>an</strong>d:clr p3.1 ;set comm<strong>an</strong>dComm<strong>an</strong>d2:clr amovc a,@a+dptr ;get bytecjne a,#099h,comm<strong>an</strong>d1 ;done?RetComm<strong>an</strong>d1:mov r1,alcall write ;send itinc dptrsjmp comm<strong>an</strong>d2;BYTE sends the byte pointed <strong>to</strong> by;the DPTR <strong>to</strong> the graphics module;as aseries of data bytes.Byte:setb p3.1 ;set datasjmp comm<strong>an</strong>d2;WRITE sends the byte in R1 <strong>to</strong> the;display.Write:mov a,r0 ;CS the displayjnz write1 ;right halfsetb p3.2 ;left halfWrite2:mov p1,r1 ;get datasetb p3.0 ;strobe itNopclr p3.0clr p3.2 ;de-select moduleclr p3.3RetWrite1:setb p3.3sjmp write2Page 4

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

Saved successfully!

Ooh no, something went wrong!