'Alarm System Code'
Hey guys, me again :)
Im trying to build a real simple alarm with a 2 digit keypad. I simply want to
be able to press the first button two times, and then make a pin HI.
Now i tried to do this through interrupts but all it did was drive all my pins c
razy, all the output pins were a pulsing low signal. Can someone help me write
this code, again in case anyone doesnt know by now im new to PICs and pic progra
Send someone a cool Dynamitemail flashcard greeting!! And get rewarded.
GO AHEAD! http://cards.dynamitemail.com/index.php3?rid=fc-41
> Now i tried to do this through interrupts but all it did was drive all my
pins crazy, all the output pins were a pulsing low signal. Can someone help
me write this code, again in case anyone doesnt know by now im new to PICs
and pic programming lanugage.
You weren't very specific, so I can only offer FAQ-level advice:
You need to debounce the buttons.
Mechanical buttons don't just close, they open and close a few times very
fast while your finger is still pushing twoard "down". The same thing
happens on the way up.
The basic approach is to notice that a button is pressed, then wait some
amount of time (1-10mS?), and check it again. If it's still low, then figure
"Pressed", and go do something. If high now, then figure "glitch", and go
back to sleep.
On the rising side, you would notice that the button is no longer pushed,
and test again after a while, and if still not pushed, then figure "Not
Pressed", otherwise figure "Still pressed, just noisy".
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- New search...