ORG 0000H
LJMP INIT
ORG 000BH
LJMP T0_INT
ORG 001BH
LJMP T1_INT
ORG 002BH
LJMP T2_INT
ORG 0033H
INIT:
CLR P1.2
MOV TMOD,#22H
MOV TH0,#6
MOV TL0,#6
MOV R2,#0 ;P1.4
MOV R3,#0 ;P1.4
MOV TH1,#6
MOV TL1,#6
MOV R4,#0 ;P1.5
MOV R5,#0 ;P1.5
MOV RCAP2H,#60
MOV RCAP2L,#176
MOV R6,#0 ;P1.6
SETB TR0
SETB TR1
SETB TR2
SETB ET0
SETB ET1
SETB ET2
SETB EA
MAIN:
JNB P1.4,P14LOW
MOV TH0,#6
MOV TL0,#6
MOV R2,#0 ;P1.4
MOV R3,#0 ;P1.4
P14LOW:
JNB P1.5,P15LOW
MOV TH1,#6
MOV TL1,#6
MOV R4,#0 ;P1.5
MOV R5,#0 ;P1.5
P15LOW:
JNB P1.6,P16LOW
MOV RCAP2H,#60
MOV RCAP2L,#176
MOV R6,#0 ;P1.6
P16LOW:
SJMP MAIN
T0_INT:
INC R2
CJNE R2,#250,T0RET
MOV R2,#0
INC R3
CJNE R3,#16,T0RET
SETB P1.2
;P1.2为高了,后面怎么办?要重复吗?
SJMP $
T0RET:
RETI
T1_INT:
INC R4
CJNE R4,#250,T1RET
MOV R4,#0
INC R5
CJNE R5,#16,T1RET
SETB P1.2
;P1.2为高了,后面怎么办?要重复吗?
SJMP $
T1RET:
RETI
T2_INT:
INC R6
CJNE R6,#20,T2RET
;P1.2为高了,后面怎么办?要重复吗?
SJMP $
T2RET:
RETI
[ 本帖最后由 xu__changhua 于 2009-6-16 23:25 编辑 ] |