5neaker said:
Hi
I’m new to the wonderful world of PIC.
I want to build a circuit to detect which position a switch has been pushed. The switch has only one signal wire and a ground to measure the different positions.
The switch contains various smd resistor ladders. I need PIC 16F84A to looks at the various resistor ladders to know which direction the switch has been pushed.
I’ve measured the resistance for each of the position,
Left – 679 <a href="#">ohm</a>
Right – 1536 <a href="#">ohm</a>
Up – 471 <a href="#">ohm</a> – this is the one I’m interested in
Down – 220 <a href="#">ohm</a>
When the position is found I would like it to light up an LED indicator
I did try to measure the voltage using 5V supply, in all the position I get a reading of 5V. I need to measure the resistance
Any help would be appreciated greatly, code, circuit diagram etc
Thanks in advance
Ray
Yes, you'll need a PIC with a ADC, or an external ADC to work with your F84. The reason you measure 5V in all positions is because you're not getting any current trough those resistors. There will only be a voltage drop over a resistor when you make current go trough it.
add a 1K resistor between your switches output and GND. Now measure on the switch. Voltage will now change along with the resistance of the switch.