Page 1 of 1

16F88 Sensitivity

Posted: Thu Aug 20, 2009 9:23 pm
by stubbornbull
hey guys,

i have this simple alarm program that i twisted from flowcode's stock example, it works fine on flowcode, but when i compile it and put it either on the breadboard or the pcb, the "switches terminals"(actual pins) become very sensitive. for example if i have the wires for the switches unplugged, its alright, but then if i tried to plug them in, it'll tripped the alarm...if i try to leave them plugged in, then the alarm will trip the second i set the alarm. i have the switches set to go from lo to hi in flowcode, so all my switches are normally opened switches on my project, it just has me wondering whats going on, i cant even have the switches plugged in or it'll set the alarm off. i was just wondering if there was something i could do about this sensitivity issue either with flowcode or the pic's set up. switch's are from port A1-A4, B7 is power, B6 is alarm led, A0 is reset, and B5 is alarm on/off. thought i'd asked just in case someone has had this issue before, and yes i have researched and still am, alot on static but not too many with pic's and how to wire them up, i guess since there's more than one way.

thanks

Re: 16F88 Sensitivity

Posted: Fri Aug 21, 2009 9:09 am
by Benj
Hello

When using inputs and switches you always need to have the input pulled to one state or another,

Your switch circuit should look something like this. Note when the switch is not pressed the input is pulled to ground via the resistor.

5V
|
\ Switch
|
|--------uC Pin
|
4.7K - 10K resistor
|
GND

If you do not pull the pin to a state and leave it floating then the pin can pick up noise and oscillate which may be causing your alarm to trigger etc.

Re: 16F88 Sensitivity

Posted: Fri Aug 21, 2009 11:10 am
by medelec35
Yep floating i/p due to high i/p resistance will cause all sorts of problems. a/d converter will be reading all sorts of spurious values. Even touching with finger will cause i/p to change voltage.
Another suggestion is, how I get around problem. I use port B with weak pull-ups (configured in Flowcode with a C box). Then that removes the requirement for extra resistors to be added and you can set up alarm to be triggered on port B interrupt on change.
Of course what Ben said is spot on, if you not got, or don’t want to use port B for inputs

Re: 16F88 Sensitivity

Posted: Fri Aug 21, 2009 6:16 pm
by stubbornbull
you guys are right on with weird behaviors that i'm experiencing with this project, i'm going with Benj suggestion since already have 10k's on the PCB board connecting to the 5V, so a little modification(similar to that of wiring a keypad, i get it) and hopefully this will work.

eh, thanks you guys, i've been spending long days trying to figure this one out, i should of posted a long time ago

UPDATE

you guys are the best, switching is working fine, no funny stuff going on, and my IR sensor works without the resistor because it connects to VDD and VSS while there's an output for the uC, everything is works...i'm so relieved now

mahalo's

Re: 16F88 Sensitivity

Posted: Fri Aug 21, 2009 9:47 pm
by Benj
Hello

Dont worry I had this very same problem when I was starting out and it drove my crazy until I realised what was going wrong. One of those cases where the thing seems to work fine but if I go near it and cough then it suddenly and mysteriously stops working :mrgreen:

Thanks for letting us know the outcome :)