- #1
Jdo300
- 554
- 5
Hello All,
I have been working on this problem for a few hours now and it's really beginning to bug me. I did a search on Google for methods of monitoring multiple push-buttons (tact switches in my case) using a single analog IO pin from a microcontroller. So far, I have come across a few useful examples of how it can be done.
This first link seems to show the simplest way to go about it (with the fewest components):
http://www.piclist.com/techref/microchip/sw7_on_1pin.htm
I would just go with this here except for the fact that I need to monitor 10 buttons rather than 7. I have no idea how the guy calculated the resistor values. According to the page, they were selected so that the the microcontroller can also tell if multiple buttons are pressed simultaneously.
The second site I found on this was here:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1226896251/15
The third post on this page shows a text representation of an R2R ladder setup to do the same thing. I'm assuming that this will give unique voltages for any combination of switches just like the first example, however, I definitely would prefer to go with the first setup if I can to keep the component count to a minimum. Would anyone here happen to know anything about this and/or how determine the resistor values if you want to do a single series string like the example in link 1?
Thanks,
Jason O
I have been working on this problem for a few hours now and it's really beginning to bug me. I did a search on Google for methods of monitoring multiple push-buttons (tact switches in my case) using a single analog IO pin from a microcontroller. So far, I have come across a few useful examples of how it can be done.
This first link seems to show the simplest way to go about it (with the fewest components):
http://www.piclist.com/techref/microchip/sw7_on_1pin.htm
I would just go with this here except for the fact that I need to monitor 10 buttons rather than 7. I have no idea how the guy calculated the resistor values. According to the page, they were selected so that the the microcontroller can also tell if multiple buttons are pressed simultaneously.
The second site I found on this was here:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1226896251/15
The third post on this page shows a text representation of an R2R ladder setup to do the same thing. I'm assuming that this will give unique voltages for any combination of switches just like the first example, however, I definitely would prefer to go with the first setup if I can to keep the component count to a minimum. Would anyone here happen to know anything about this and/or how determine the resistor values if you want to do a single series string like the example in link 1?
Thanks,
Jason O