Pages: [1]   Go Down
Author Topic: LCD panel switches as analog voltages  (Read 513 times)
0 Members and 1 Guest are viewing this topic.
Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 82
Posts: 3840
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Note to mods... feel free to move this thread, which is to do with switches on an LCD panel, not the LCD itself.

I was surprised when I looked at LCD code the first time and found that determining which switch is pressed is done by measuring an analog pin and decoding the 0-1023 reading into a pin identification. Good idea I guess, since that way one could in theory have 1023 switches read on one pin, or more likely say 50-100 if one allowed a reading range of 20-10 per switch to separate them.

I'm curious to know how the wiring would work... I'm ignorant of such things but envisage a unique resistor in series with each switch, a bit like measuring a pot at the junction of the pot and a pull down, where the reading depends on the position of the pot. Does each switch have a resistor of its own and depending on which switch is pressed, that's the resistor in play, and hence a unique reading for that switch?

If that's so, then if the resistors were cunningly chosen I guess this could be used to tell which unique combination of switches was pressed too?

What would be a practical maximum number of switches one could decode on a 0-1023 analog pin?

(It's far too early on a wintry (southern hemisphere) Sunday morning for this.... what am I thinking?)

Ciao,

Jim
 
« Last Edit: June 10, 2012, 01:10:50 am by JimboZA » Logged

Although I answer in good faith, remember always: Your Mileage May Vary.
Get me on LinkedIn: za.linkedin.com/in/jimbrownza/

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

- http://forums.trossenrobotics.com/showthread.php?1284-Turning-analog-inputs-into-multi-switch-digital-inputs - post #6
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 82
Posts: 3840
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Exactly what I was thinking thanks Rob, except for the part where it goes BOOM

I breadboarded it just like that, with whatever resistors I had handy. Did a quick calc to see what portion of the 5v and thus of 1023 should appear on the pin and it worked as expected, identifying the switch that was pressed.

« Last Edit: June 10, 2012, 08:34:04 am by JimboZA » Logged

Although I answer in good faith, remember always: Your Mileage May Vary.
Get me on LinkedIn: za.linkedin.com/in/jimbrownza/

Pages: [1]   Go Up
Jump to: