HT48R50A的 LCD显示示例程序
; ********************************************
; FuncTIon : LCD显示示例程序 *
; MICroProcessor : HT48R50A-1/28SKDIP-A *
; Author: *
; Crystal : 4MHz *
; ********************************************
#INCLUDE HT48R50A-1.INC
LCD_DATA EQU PA
LCD_DATA_CTRL EQU PAC
LCD_CTRL EQU PC
LCD_CTRL_CTRL EQU PCC
E EQU 2
RW EQU 1
RS EQU 0
;------------------------------------------------------
DATA .SECTION AT 60H ’DATA’
DELAY_COUNTER_1 DB ? ;[60H]
DELAY_COUNTER_2 DB ? ;[61H]
DELAY_COUNTER_3 DB ? ;[62H]
DISPLAY_DATA DB ? ;[63H]
DISPLAY_COUNTER DB ? ;[64H]
;------------------------------------------------------
CODE .SECTION AT 00H ’CODE’
ORG 00H
JMP START
START:
CLR LCD_DATA
CLR LCD_DATA_CTRL
CLR LCD_CTRL
CLR LCD_CTRL_CTRL
CALL DELAY
CLR TBLP
MOV A,30H ;\
MOV LCD_DATA,A ; > STEP 0
CALL WRITE ;/ LCD RESET
CALL DELAY
MOV A,30H ;\
MOV LCD_DATA,A ; > STEP 0
CALL WRITE ;/ LCD RESET
CALL DELAY
MOV A,38H ;\
MOV LCD_DATA,A ; > STEP 1
CALL WRITE ;/ FuncTIon set
MOV A,06H ;\
MOV LCD_DATA,A ; > STEP 2
CALL WRITE ;/ Entry mode set
MOV A,01H ;\
MOV LCD_DATA,A ; > STEP 3
CALL WRITE ;/ Display clear
CALL DELAY
MOV A,0EH ;\
MOV LCD_DATA,A ; > STEP 4
CALL WRITE ;/ Display turn on/off
MOV A,83H ;\
MOV LCD_DATA,A ; > STEP 5
CALL WRITE ;/ DD RAM address set(First line)
SET LCD_CTRL.RS ; STEP 6
MOV A,0AH ; DD RAM data write
MOV DISPLAY_COUNTER,A
DISPLAY1:
TABRDL DISPLAY_DATA
MOV A,DISPLAY_DATA
MOV LCD_DATA,A
CALL WRITE
INC TBLP
SDZ DISPLAY_COUNTER
JMP DISPLAY1
CLR LCD_CTRL.RS ;\
MOV A,0C3H ; > STEP 7
MOV LCD_DATA,A ; | DD RAM address set(Second line)
CALL WRITE ;-
SET LCD_CTRL.RS ; SETP 8
MOV A,0AH ; DD RAM data write
MOV DISPLAY_COUNTER,A
DISPLAY2:
TABRDL DISPLAY_DATA
MOV A,DISPLAY_DATA
MOV LCD_DATA,A
CALL WRITE
INC TBLP
SDZ DISPLAY_COUNTER
JMP DISPLAY2
HALT
RET
;------------------------------------------------------
WRITE PROC
SET LCD_CTRL.E
CLR LCD_CTRL.E
MOV A,0FFH
MOV DELAY_COUNTER_1,A
WAIT:
SDZ DELAY_COUNTER_1
JMP WAIT
RET
WRITE ENDP
;------------------------------------------------------
DELAY PROC
MOV A,003H
MOV DELAY_COUNTER_1,A
MOV DELAY_COUNTER_2,A
MOV DELAY_COUNTER_3,A
WAITING:
SDZ DELAY_COUNTER_3
JMP WAITING
SDZ DELAY_COUNTER_2
JMP WAITING
SDZ DELAY_COUNTER_1
JMP WAITING
RET
DELAY ENDP
;------------------------------------------------------
ORG 0F00H
;[LCD.......]
;[Test OK !!]
DC 4CH,43H,44H,2EH,2EH,2EH,2EH,2EH,2EH,2EH
DC 54H,65H,73H,74H,20H,4FH,4BH,20H,21H,21H
;------------------------------------------------------
END
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)