ORG 0000H
LJMP MAIN0
ORG 000BH
lJMP SERVE
ORG 0200H
MAIN0: CLR CON
ON : ;MOV P0,#00000000B
JB P3.1, ON
MOV DPTR,#TAB
nop
nop
MOV SP ,#60H
MOV TMOD,#01H
MOV TL0,#0B0H
MOV TH0,#3CH
SETB ET0
SETB EA
SETB TR0
MOV 40H,#10
MOV 41H,#00H
MOV A,41H
MOV B,#0AH
DIV AB
MOVC A,@A+DPTR
MOV P2,A
MOV A,B
MOVC A,@A+DPTR
MOV P0,A
;SJMP $
ORG 0300H
LSS EQU ACC.0
MSS EQU ACC.2
RSS EQU ACC.3
LMO EQU P3.6
RMO EQU P3.4
CON EQU P1.1
CLR CON
START: CLR LMO
CLR RMO
NOP
NOP
CALL SS
CALL DLA100MS
CALL DLA100MS
CALL DLA100MS
;SJMP START
RIGHT:
CALL SS
JNB ACC.2,ERR
CLR LMO
CLR RMO
CALL DLA50MS
NOP
SJMP RIGHT
ERR: CALL SS
JNB ACC.0,ERRL
ERR8: SETB LMO
CLR RMO
CALL DLA50MS
CALL SS
JB ACC.0,ERR8
SJMP RIGHT
ERRL: CALL SS
JNB ACC.3,STOP
ERRL9: CLR LMO
SETB RMO
CALL DLA50MS
CALL SS
JB ACC.3,ERRL9
SJMP RIGHT
STOP: CLR TR0
CALL DLA100MS
CALL DLA1S
SETB RMO
SETB LMO
CALL DLA10S
SETB TR0
GOON : SETB CON
SETB CON
CALL DLA100MS
CLR LMO
CLR RMO
CALL DLA100MS
RIGHT2:
CALL DLA100MS
CALL SS
JNB ACC.2,RIGHT2
SETB RMO
SETB LMO
CALL DLA100MS
CLR CON
CALL DLA100MS
CLR LMO
CLR RMO
RIGHT1:
CALL SS
JNB ACC.2,ERR1
CLR LMO
CLR RMO
CALL DLA50MS
NOP
SJMP RIGHT1
ERR1: CALL SS
JNB ACC.0,ERRL1
ERR11: SETB LMO
CLR RMO
CALL DLA50MS
CALL SS
JB ACC.0,ERR11
SJMP RIGHT1
ERRL1: CALL SS
JNB ACC.3,STOP1
ERRL12: CLR LMO
SETB RMO
CALL DLA50MS
CALL SS
JB ACC.3,ERRL12
SJMP RIGHT1
STOP1:
CALL DLA1S
SETB RMO
SETB LMO
CLR TR0
SJMP $
SS: MOV 30H,P3
ANL 30H,#00001101B
NOP
NOP
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
mov A,p3
ANL A,#00001101B
XRL A,30H
NOP
NOP
JNZ SS
MOV A,30H
;MOV P0,A
NOP
NOP
RET
DLA10S: MOV R7,#10
d8: NOP
NOP
call DLA1S
DJNZ R7,d8
NOP
NOP
RET
DLA1S: MOV R5,#10
d3: NOP
NOP
call DLA100MS
DJNZ R5,d3
NOP
NOP
RET
DLA100MS:
MOV R3,#10
D2: MOV R1,#20
D1: MOV R2,#248
DJNZ R2,$
DJNZ R1,D1
DJNZ R3,D2
NOP
NOP
RET
DLA50MS: MOV R3,#5
m2: MOV R1,#20
m1: MOV R2,#248
DJNZ R2,$
DJNZ R1,m1
DJNZ R3,m2
NOP
NOP
RET
SERVE:
PUSH ACC
MOV TMOD,#01H
MOV TL0,#0B0H
MOV TH0,#3CH
INC 40H
MOV A,40H
CJNE A,#20,LOOP
MOV 40H,#00H
INC 41H
MOV A,41H
MOV B,#0AH
DIV AB
MOVC A,@A+DPTR
MOV P2,A
MOV A,B
MOVC A,@A+DPTR
MOV P0,A
LOOP:
POP ACC
RETI
TAB:
DB 11000000B ;0
DB 11111001B ;1
DB 10100100B ;2
DB 10110000B ;3
DB 10011001B ;4
DB 10010010B ;5
DB 10000010B ;6
DB 11111000B ;7
DB 10000000B ;8
DB 10010000B ;9
END
用户1612138 2008-4-4 10:14