Hi,
I'm looking for a bit of feedback on a problem that I'm working on:
The question is;
"Write an 8051 program that uses interrupts to implement an intruder alarm.
Let sensor be tied to the INTO(p3.2) pin, which is at 0 when an intruder steps on a special mat, and 1 when there is no pressure on the mat.
The program should write a 1 to P3.0 (ALARM) to turn on an alarm buzzer when an interrupt occurs. The program should keep the alarm on until there is no more pressure on the mat."
My attempted Answer is:
ORG 0000H
SETB EA ;SETTING Interupt enable registrar
SETB EX0
MOV TCON,#00H ;Recognising INT0 WHEN LOGIC lOW
MAIN_LOOP:
JMP $
ORG 0003H ;external interupt 0 vector
SETB P3.0
JNB P3.2,$
CLR P3.0
RET1
END
As usual any help greatly appreciated!
I'm looking for a bit of feedback on a problem that I'm working on:
The question is;
"Write an 8051 program that uses interrupts to implement an intruder alarm.
Let sensor be tied to the INTO(p3.2) pin, which is at 0 when an intruder steps on a special mat, and 1 when there is no pressure on the mat.
The program should write a 1 to P3.0 (ALARM) to turn on an alarm buzzer when an interrupt occurs. The program should keep the alarm on until there is no more pressure on the mat."
My attempted Answer is:
ORG 0000H
SETB EA ;SETTING Interupt enable registrar
SETB EX0
MOV TCON,#00H ;Recognising INT0 WHEN LOGIC lOW
MAIN_LOOP:
JMP $
ORG 0003H ;external interupt 0 vector
SETB P3.0
JNB P3.2,$
CLR P3.0
RET1
END
As usual any help greatly appreciated!