ORG 0000H
LJMP MAIN
ORG 0003H
LCALL EX0_ISR
RETI
ORG 001BH
RETI
ORG 0100H
MAIN: SETB EA ;ENABLE EXTERNAL INTERRUPT 0 AND INTERRUPT 1
SETB EX0
SETB ET1
SETB IT0 ;SET TO EDGE TRIGGERED (NEGATIVE EDGE)
;SETB IT1 ;SET TO EDGE TRIGGERED (NEGATIVE EDGE)
SETB PT1
HERE: LJMP HERE
EX0_ISR: MOV P2,#0FFH
LCALL DELAY
CLR P2.2
LCALL DELAY
CLR P2.3
LCALL DELAY
CLR P2.4
LCALL DELAY
RET
DELAY: MOV TMOD,#10H
MOV R0,#1Eh
NEXT: MOV TH1,#0B1H
MOV TL1,#0E0H
SETB TR1
WAIT1: JNB TF1, $
CLR TR1
CLR TF1
DJNZ R0, NEXT
RET
END