This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

89C52 interrupt program

i am using interrupt program to count the number of blocks passing through a sensor on each passing i use the sensor signal as an interrupt and increament the value. on passing of a specified number of blocks i want a change in LEDs connected.
Can anyone help me with the program i have written in assembly language and am using 89C52
in this program i want 8 blocks to pass before led changes.

the program is as follows:
ORG 000H
SJMP LABEL
ORG 003H
ACALL ISR
RETI

MAIN:
MOV R3,8d
SETB IP.0
SETB TCON.0
SETB IE.0
SETB IE.7
MOV A,#00000001B
ABC:
JZ R3,LABEL
SJMP ABC
LABEL:
CPL A
MOV P1,A
JMP ABC

ISR:
CALL DELAY
DEC R3
DELAY:
MOV R2,#42d
MOV R1,#12h
MOV R0,#43h
loop:
DJNZ R0,loop
DJNZ R1,loop
RET
END

0