I have a very simple circuit containing a PIR and a counter. The PIR passes a high signal to the 08M via Pin1 and then outputs a high through Pin4 which sends this pulse to a totalizer/counter.
My problem is, sometimes even though the PIR sends a brief HI to the chip the chip will not catch the signal, so nothing gets output to the counter. I noticed this more clearly when I ran a Simulation. While the program is running I can watch the code execute from top to bottom, however if I click on Pin1 briefly somewhere in the middle of the code no signal is sent. I believe this is because the program needs to see the HI on Pin1 at the start of the code then it continues down the code following the rest of the commands.
I’m sure this is a big “DUH” to most of you but is there a way to catch these HI inputs more reliably or is this just the nature of PIC’s and program flow?
Code (ignore the LED):
My problem is, sometimes even though the PIR sends a brief HI to the chip the chip will not catch the signal, so nothing gets output to the counter. I noticed this more clearly when I ran a Simulation. While the program is running I can watch the code execute from top to bottom, however if I click on Pin1 briefly somewhere in the middle of the code no signal is sent. I believe this is because the program needs to see the HI on Pin1 at the start of the code then it continues down the code following the rest of the commands.
I’m sure this is a big “DUH” to most of you but is there a way to catch these HI inputs more reliably or is this just the nature of PIC’s and program flow?
Code (ignore the LED):
Code:
symbol PIR = pin1
symbol LED = 4
main:
b0 = PIR
if b0 = 1 then
high LED
else
low LED
endif
goto main
Last edited: