![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
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 ohm Right – 1536 ohm Up – 471 ohm – this is the one I’m interested in Down – 220 ohm 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 |
|
|
|
|
|
|
(permalink) |
|
This requires, *i think*, the command "Read ADC". This is an analog input for the PIC. As far as i know of this is the only command that can read analog inputs.
Off topic: Did any one see the world cup final between Australia and England??
__________________
www.winpicprog.co.uk - Great PIC language tutorials. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
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. |
||
|
|
|
|
|
(permalink) | ||
|
Quote:
Thanks Exo, could you send me any example external ADC work with the F84. |
|||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
http://www.microchip.com/1010/pline/...3221/index.htm 12 Bit A/D in a small SOT23 package. It uses I2C protocol wich only requires 2 wires between the converter and the pic I2C code can be found on many places on the net, including nigel's site www.winpicprog.co.uk |
||
|
|
|
|
|
(permalink) |
|
You can do A/D in code with a 16F84A.
Here is where I read about it: http://www.audiomulch.com/midipic/ And here is the code: http://www.dontronics.com/psbpix/pot.html |
|
|
|
|