It doesn't necessarily take 5V on an input to register as a logic 1. Only a +V above the PIC logic 1 input threshold level.Since digital 1 is 5v.
If you touch an input pin or wire connected to the input, depending on the voltage level present on the input pin, your environment, body capacitance, static charge, etc,, you may be introducing a signal of sufficient magnitude to allow the input to see a certain voltage level or a brief change in voltage level.
Try something like this;
10K
input pin -------/\/\/\/\-----+5V
|
|
|---o___o---- gnd
switch
If you leave the input floating, then touch the wire or pin, it will definitely spazz-out.
If you hold the input at a certain logic level through a pull-up or pull-down, then the signal or discharge from touching the pin will need to be of sufficient magnitude to over-ride the pull-up or pull-down for the input to see the change.
Even a very fast spike on an input may register since the PIC is operating (and testing input logic) very fast. Even at a lowly 4MHz your PIC is executing single-cycle instructions at 1 million per second.
If you connect a sensor to an input, and the sensor has a high impedance output, it may be allowing the PIC input to float when the sensor output is not actively pulling the PIC input to ground or +V.
Bookmarks