Sinking, sourcing, NPN, PNP sensors and switches
Quentin email (remove spam text)
Thanks to all that replied.
Using another pin to set high and read and then set low to read to
determine sink or source is a good idea, but I see some problems as you
don't know at that stage if the sensor is sensing or not, or if it is in
I try to stay away from any kind of switches as that is what confuse the
people that install it.
I've tinkered a bit with electronic workbench and came up with this:
As I want to use a 12C508 the pins already give me part of the solution. I
can use the Shmidt Trigger (sp) and do this:
2K | ||20nF
0------VVVV---0-----||----0 PIC Pin
This will then give a pulse every time there is a change in the state of
the sensor. I might also have to put in a diode from 0V to PIC Pin, to clip
neg. going pulses.
The only disadvantage of this is that with a source sensor the pulse occur
when it switches on and on a sink, the pulse occur when it switches off.
This might not be a problem in my application.
See also: www.piclist.com/techref/io/sensors.htm?key=sensor
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the