HT48R50A的7段數(shù)碼管顯示程序
; ********************************************
; Function : 7段數(shù)碼管顯示程序 *
; MICroProcessor : HT48R50A-1/28SKDIP-A *
; Author: www.picavr.com *
; Crystal : 4MHz *
; ********************************************
#INCLUDE HT48R50A-1.INC
;---------------------------------------------
DATA .SECTION AT 60H 'DATA'
DELAY_COUNTER_1 DB ? ;[60H]
DELAY_COUNTER_2 DB ? ;[61H]
SCAN_COUNTER DB ? ;[62H]
SCAN_DATA DB ? ;[63H]
DISPLAY_COUNTER DB ? ;[64H]
DISPLAY_DATA DB ? ;[65H]
LOOP_COUNTER DB ? ;[66H]
;---------------------------------------------
CODE .SECTION AT 00H 'CODE'
ORG 00H
JMP START
START:
CLRPAC
SET PA
CLR PCC
SET PC
SCAN_BEGIN:
CLR DISPLAY_COUNTER
LOOP_1:
MOV A,90H
MOV LOOP_COUNTER,A
LOOP_2:
MOV A,DISPLAY_COUNTER
MOV TBLP,A
MOV A,0EH
MOV SCAN_DATA,A
MOV A,04H
MOV SCAN_COUNTER,A
SCAN_NEXT:
MOV A,SCAN_DATA
MOV PC,A
TABRDL DISPLAY_DATA
MOV A,DISPLAY_DATA
MOV PA,A
CALL DELAY
SET C
RLC SCAN_DATA
INC TBLP
SDZ SCAN_COUNTER
JMP SCAN_NEXT
SDZ LOOP_COUNTER
JMP LOOP_2
MOV A,04H
ADDM A,DISPLAY_COUNTER
MOV A,DISPLAY_COUNTER
SUB A,10H
SZ ACC
JMP LOOP_1
JMP SCAN_BEGIN
RET
;---------------------------------------------
DELAY PROC
MOV A,09H
MOV DELAY_COUNTER_1,A
MOV DELAY_COUNTER_2,A
WAIT:
SDZ DELAY_COUNTER_2
JMP WAIT
SDZ DELAY_COUNTER_1
JMP WAIT
RET
DELAY ENDP
;---------------------------------------------
ORG 0F00H
DC 081H,0CFH,092H,086H ;0,1,2,3
DC 0CCH,0A4H,0A0H,08FH ;4,5,6,7
DC 080H,084H,088H,0E0H ;8,9,A,B
DC 0B1H,0C2H,0B0H,0B8H ;C,D,E,F
;---------------------------------------------
END