PORT EQU 0CFA0H
HOUR EQU 26H ;设置数据缓冲区
BUF EQU 23H
SBF EQU 22H
MBF EQU 21H
SA EQU 27H
FA EQU 28H
HH EQU 29H
MB0 EQU 2AH
MB1 EQU 2BH
MB2 EQU 2CH
MM0 EQU 2DH
ORG 0000H
LJMP START ;中断初始化
ORG 0003H
LJMP KEY0
ORG 0013H
LJMP KEY1
ORG 001BH
LJMP CLOCK
ORG 4100H
START: MOV R0, #40H ;数据缓冲区初始化
MOV R6,#00H
MOV A, #00H
MOV @R0, A
INC R0
MOV @R0, A
INC R0
MOV @R0, A
INC R0
MOV @R0, A
INC R0
MOV @R0, A
INC R0
MOV @R0, A
MOV SP, #30H
MOV TMOD, #10H
MOV TH1, #38H
MOV TL1, #00H
MOV BUF, #00H
MOV SBF, #00H
MOV MBF, #00H
MOV HOUR,#00H
MOV SA, #00H
MOV FA, #00H
MOV HH, #00H
MOV MB0, #00H
MOV MB1, #00H
MOV MB2, #00H
MOV MM0, #00H
SETB ET1
SETB EX1
SETB PT1
SETB EA
SETB P3.5
CLR P3.0
MOV TCON, #45H
MOV R5, #01H
DS1: MOV R0, #40H ;扫描显示
MOV R2, #20H
DS2: MOV DPTR, #PORT
MOV A, @R0
ACALL TABLE
CJNE R5, #02 ,L3
SJMP L2
www.751com.cn
ADD A,#80H
SJMP L0
L1: CJNE R5,#03H, L4
SJMP L5
L4: CJNE R5, #05H,L0
L5: CJNE R0, #44H,L0
ADD A,#80H
L0: MOVX @DPTR, A
MOV A, R2
CPL A
MOV P1, A
MOV R3, #07FH
DEL: NOP
DJNZ R3, DEL
INC R0
CLR C
MOV A, R2
RRC A
MOV R2, A
S2: CJNE R5,#06H,S3 ;切换到显示秒表计数
SETB EX0
SJMP MIAOBIAO
S3: CJNE R5,#04H,S1 ;切换到定时设置状态的显示
SJMP DINGSHI
S1: CJNE R5,#05H,S0
SJMP DINGSHI
S0: JNZ DS2
MOV R0, #40H ;取缓冲区到显示缓冲区
MOV A, SBF
ACALL GET
MOV A, MBF
ACALL GET
MOV A, HOUR
ACALL GET
SJMP DS1