Multiple switches per pin

This forum is for posts that might be considered off-topic but that may be useful or interesting to members. Examples include posts about electronics or programming in general, other microcontrollers or interesting devices, useful websites, etc.
Post Reply
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Multiple switches per pin

Post by GTBecker »

I stumbled into a technique that allows more than one momentary switch per pin while troubleshooting a VHF transceiver. FWIW, it is not a new idea but it is the first time I've found it in a product - oddly on a processor that seems to have plenty of available I/O. Perhaps there is an advantage that isn't immediately obvious.

Two or more switches can be configured to change a voltage divider and, in turn, the voltage presented to an analog input. In the case I found in the radio, closing SW1 puts 0v on the pin, and closing SW2 puts ~2.25v on it; the pin is pulled to +5v if both switches are open. A longer voltage divider and more switches are possible, of course, perhaps limited by reliably discernible values - and the confusion of multiple switch closures. Two switches assures that one switch overrides the other.
Attachments
TwoSwitches.gif
TwoSwitches.gif (17.86 KiB) Viewed 4403 times
Tom
dlh
Posts: 395
Joined: 15 December 2006, 12:12 PM
Location: ~Cincinnati

Post by dlh »

Tom,

Microchip has published several Tips & Tricks full of ingenious ways to extend the capabilities of a pin. Here's one from 2009.
http://ww1.microchip.com/downloads/en/D ... 01146B.pdf
arin
Posts: 2
Joined: 03 December 2012, 10:45 AM

Post by arin »

Here is the link where you can find more information on it - http://arduino.cc/forum/index.php/topic,20125.0.html
What are the benefits with multiple switches per pin, if you have many I/O lines are available?

pcb assembly quote
Last edited by arin on 15 April 2013, 16:49 PM, edited 2 times in total.
cheers
spamiam
Posts: 739
Joined: 13 November 2005, 6:39 AM

Post by spamiam »

arin wrote:Here is the link where you can find more information on it - http://arduino.cc/forum/index.php/topic,20125.0.html
What are the benefits with multiple switches per pin, if you have many I/O lines are available?
The simple answer is it allows the use of a rotary switch. Also, it conserves I/O pins because you often do not have enough I/O even when there are a lot of them.

I made an 8-position rotary switch with no problem in resolving the poistion with 100% accuracy while measuring the ADC voltage.

-Tony
Post Reply