ORG 0000H
LJMP MAIN
ORG 0003H
LJMP EXT0
ORG 000BH
LJMP T0ISR
ORG 0030H
MAIN:
MOV TMOD,#01H
MOV TH0,#HIGH(65536-50000)
MOV TL0,#LOW(65536-50000)
SETB ET0
SETB EX0
SETB IT0
SETB EA
MOV P0,#0FFH
MOV R2,#20
MOV A,#0FEH
CLR 00H
SJMP $
EXT0
SETB TR0
RETI
T0ISR:
CLR TR0
MOV TH0,#HIGH(65536-50000)
MOV TL0,#LOW(65536-50000)
SETB ET0
DJNZ R2,T0E
MOV R2,#20
CPL 00H
JB 00H,T01
MOV P0,A
SJMP T0E
T01:
MOV P0,#0FFH
T0E:
RETI
END