I have a PIR sensor that goes high when motion is sensed. It is connected to pin 2 on my 18m2 chip. I have a pulldown resistor on pin 2 as well. I use the download cable and terminal for debugging.
When I run the following code, the terminal displays "0 0 0 0 0 0 0 ...." and so on until motion is sensed and then it displays " 252 252 252 252 252..." for a few seconds while the receiver is activated.
pir:
readadc 2,w0
sertxd (#w0," ")
goto pir
So that works fine and shows that pin 2 goes high when it should (when motion is sensed).
I want an interrupt to happen when motion is sensed so I changed the code to:
setint #00000100,#00000100
pir:
readadc 2,w0
sertxd (#w0," ")
goto pir
interrupt:
sertxd ("interrupt")
end
When I run this, it displays the adc value just like before. When triggered, it still displays 252 in the terminal but doesn't go to the interrupt subroutine.
What am I missing? (probably something simple!)
When I run the following code, the terminal displays "0 0 0 0 0 0 0 ...." and so on until motion is sensed and then it displays " 252 252 252 252 252..." for a few seconds while the receiver is activated.
pir:
readadc 2,w0
sertxd (#w0," ")
goto pir
So that works fine and shows that pin 2 goes high when it should (when motion is sensed).
I want an interrupt to happen when motion is sensed so I changed the code to:
setint #00000100,#00000100
pir:
readadc 2,w0
sertxd (#w0," ")
goto pir
interrupt:
sertxd ("interrupt")
end
When I run this, it displays the adc value just like before. When triggered, it still displays 252 in the terminal but doesn't go to the interrupt subroutine.
What am I missing? (probably something simple!)