5# gx_huang
我画好了,程序也编了,只不过显示的和要求不一样,弄了好几天了,出不出,请您给指点一下.STRT BIT P3.5
STP BIT P3.4
CLRR BIT P3.1
WRN BIT P2.6
ORG 0000H
AJMP MAIN
ORG 0003H
AJMP INT0
ORG 0030H
MAIN: MOV SP,#60H
MOV R1,#30H
MOV DPTR,#0FFFFH
SETB EX0
SETB EA
SETB IT0
SETB P2.0
MOV 30H,#0
MOVX @DPTR,A ;KAI GUAN
HEAR: LCALL WARN
LCALL DISP
K1: JB STRT,K2
LCALL DISP
JNB STRT,START
; AJMP HEAR
K2: JB STP,K3
LCALL DISP
JNB STP,STOP
K3: JB CLRR,HEAR
LCALL DISP
JNB CLRR,CLEAR
AJMP HEAR
START:CLR P2.0
AJMP K1
STOP: SETB P2.0
AJMP K2
CLEAR:MOV A,#0
MOV 30H,A
AJMP K3
DISP: MOV 40H,#11 ;显示处理程序
MOV 41H,#10
MOV A,30H
MOV B,#10
DIV AB
MOV 42H,B
MOV B,#10
DIV AB
MOV 43H,B
MOV B,#10
DIV AB
MOV 44H,B
MOV A,40H
LCALL SEG7
MOV P1,A
CLR P2.1
LCALL DLY
SETB P2.1
MOV A,41H
LCALL SEG7
MOV P1,A
CLR P2.2
LCALL DLY
SETB P2.2
MOV A,42H
LCALL SEG7
MOV P1,A
CLR P2.3
LCALL DLY
SETB P2.3
MOV A,43H
LCALL SEG7
MOV P1,A
CLR P2.4
LCALL DLY
SETB P2.4
MOV A,44H
LCALL SEG7
MOV P1,A
CLR P2.5
LCALL DLY
SETB P2.5
RET
WARN: JNB F0,RT
ACALL DISP
CLR WRN
RT: RET
INT0: MOVX A,@DPTR
MOV @R1,A
MOV B,100
DIV AB
JNZ WWW
INT00: MOVX @DPTR,A
RETI
WWW: MOV A,B
JZ INT00
CLR F0
AJMP INT00
DLY10: MOV R3,#30
D0: ACALL DLY
DJNZ R3,D0
RET
DLY: MOV R7,#2
D1: MOV R6,#40
DJNZ R6,$
DJNZ R7,D1
RET
SEG7: INC A
MOVC A,@A+PC
RET
DB 03FH ;0 共yin
DB 006H ;1
DB 05BH ;2
DB 04FH ;3
DB 066H ;4
DB 06DH ;5
DB 07DH ;6
DB 007H ;7
DB 07FH ;8
DB 06FH ;9
DB 063H
DB 039H
END
STRT BIT P3.5
STP BIT P3.4
CLRR BIT P3.1
WRN BIT P2.6
ORG 0000H
AJMP MAIN
ORG 0003H
AJMP INT0
ORG 0030H
MAIN: MOV SP,#60H
MOV R1,#30H
MOV DPTR,#0FFFFH
SETB EX0
SETB EA
SETB IT0
SETB P2.0
MOV 30H,#0
MOVX @DPTR,A ;KAI GUAN
HEAR: LCALL WARN
LCALL DISP
K1: JB STRT,K2
LCALL DISP
JNB STRT,START
; AJMP HEAR
K2: JB STP,K3
LCALL DISP
JNB STP,STOP
K3: JB CLRR,HEAR
LCALL DISP
JNB CLRR,CLEAR
AJMP HEAR
START:CLR P2.0
AJMP K1
STOP: SETB P2.0
AJMP K2
CLEAR:MOV A,#0
MOV 30H,A
AJMP K3
DISP: MOV 40H,#11 ;显示处理程序
MOV 41H,#10
MOV A,30H
MOV B,#10
DIV AB
MOV 42H,B
MOV B,#10
DIV AB
MOV 43H,B
MOV B,#10
DIV AB
MOV 44H,B
MOV A,40H
LCALL SEG7
MOV P1,A
CLR P2.1
LCALL DLY
SETB P2.1
MOV A,41H
LCALL SEG7
MOV P1,A
CLR P2.2
LCALL DLY
SETB P2.2
MOV A,42H
LCALL SEG7
MOV P1,A
CLR P2.3
LCALL DLY
SETB P2.3
MOV A,43H
LCALL SEG7
MOV P1,A
CLR P2.4
LCALL DLY
SETB P2.4
MOV A,44H
LCALL SEG7
MOV P1,A
CLR P2.5
LCALL DLY
SETB P2.5
RET
WARN: JNB F0,RT
ACALL DISP
CLR WRN
RT: RET
INT0: MOVX A,@DPTR
MOV @R1,A
MOV B,100
DIV AB
JNZ WWW
INT00: MOVX @DPTR,A
RETI
WWW: MOV A,B
JZ INT00
CLR F0
AJMP INT00
DLY10: MOV R3,#30
D0: ACALL DLY
DJNZ R3,D0
RET
DLY: MOV R7,#2
D1: MOV R6,#40
DJNZ R6,$
DJNZ R7,D1
RET
SEG7: INC A
MOVC A,@A+PC
RET
DB 03FH ;0 共yin
DB 006H ;1
DB 05BH ;2
DB 04FH ;3
DB 066H ;4
DB 06DH ;5
DB 07DH ;6
DB 007H ;7
DB 07FH ;8
DB 06FH ;9
DB 063H
DB 039H
END
|