HT48R50A的 LCD显示示例程序
扫描二维码
随时随地手机看文章
HT48R50A的LCD显示示例程序
;********************************************
;Function:LCD显示示例程序*
;MICroProcessor:HT48R50A-1/28SKDIP-A*
;Author:www.picavr.com*
;Crystal:4MHz*
;********************************************
#INCLUDEHT48R50A-1.INC
LCD_DATAEQUPA
LCD_DATA_CTRLEQUPAC
LCD_CTRLEQUPC
LCD_CTRL_CTRLEQUPCC
EEQU2
RWEQU1
RSEQU0
;------------------------------------------------------
DATA.SECTIONAT60H’DATA’
DELAY_COUNTER_1DB?;[60H]
DELAY_COUNTER_2DB?;[61H]
DELAY_COUNTER_3DB?;[62H]
DISPLAY_DATADB?;[63H]
DISPLAY_COUNTERDB?;[64H]
;------------------------------------------------------
CODE.SECTIONAT00H’CODE’
ORG00H
JMPSTART
START:
CLRLCD_DATA
CLRLCD_DATA_CTRL
CLRLCD_CTRL
CLRLCD_CTRL_CTRL
CALLDELAY
CLRTBLP
MOV A,30H;
MOV LCD_DATA,A;>STEP0
CALLWRITE;/LCDRESET
CALLDELAY
MOV A,30H;
MOV LCD_DATA,A;>STEP0
CALLWRITE;/LCDRESET
CALLDELAY
MOV A,38H;
MOV LCD_DATA,A;>STEP1
CALLWRITE;/Functionset
MOV A,06H;
MOV LCD_DATA,A;>STEP2
CALLWRITE;/Entrymodeset
MOV A,01H;
MOV LCD_DATA,A;>STEP3
CALLWRITE;/Displayclear
CALLDELAY
MOV A,0EH;
MOV LCD_DATA,A;>STEP4
CALLWRITE;/Displayturnon/off
MOV A,83H;
MOV LCD_DATA,A;>STEP5
CALLWRITE;/DDRAMaddressset(Firstline)
SETLCD_CTRL.RS;STEP6
MOV A,0AH;DDRAMdatawrite
MOV DISPLAY_COUNTER,A
DISPLAY1:
TABRDLDISPLAY_DATA
MOV A,DISPLAY_DATA
MOV LCD_DATA,A
CALLWRITE
INCTBLP
SDZDISPLAY_COUNTER
JMPDISPLAY1
CLRLCD_CTRL.RS;
MOV A,0C3H;>STEP7
MOV LCD_DATA,A;|DDRAMaddressset(Secondline)
CALLWRITE;-
SETLCD_CTRL.RS;SETP8
MOV A,0AH;DDRAMdatawrite
MOV DISPLAY_COUNTER,A
DISPLAY2:
TABRDLDISPLAY_DATA
MOV A,DISPLAY_DATA
MOV LCD_DATA,A
CALLWRITE
INCTBLP
SDZDISPLAY_COUNTER
JMPDISPLAY2
HALT
RET
;------------------------------------------------------
WRITEPROC
SETLCD_CTRL.E
CLRLCD_CTRL.E
MOV A,0FFH
MOV DELAY_COUNTER_1,A
WAIT:
SDZDELAY_COUNTER_1
JMPWAIT
RET
WRITEENDP
;------------------------------------------------------
DELAYPROC
MOV A,003H
MOV DELAY_COUNTER_1,A
MOV DELAY_COUNTER_2,A
MOV DELAY_COUNTER_3,A
WAITING:
SDZDELAY_COUNTER_3
JMPWAITING
SDZDELAY_COUNTER_2
JMPWAITING
SDZDELAY_COUNTER_1
JMPWAITING
RET
DELAYENDP
;------------------------------------------------------
ORG0F00H
;[LCD.......]
;[TestOK!!]
DC4CH,43H,44H,2EH,2EH,2EH,2EH,2EH,2EH,2EH
DC54H,65H,73H,74H,20H,4FH,4BH,20H,21H,21H
;------------------------------------------------------
END