I need a "hint" with interfacing Thumbwheels.
G McMurry
Posts: 134
I need to decode 30+ addresses with a Thumbwheel switch. I have a pair of BCD thumbwheels, 0-9 X 2. I want to use the least number of STAMP pins for the task.
Doing it with 8 bits is a no brainer --
Doing it with 6 is also easy. Each thumbwheel 1,2,4,8 through a diode, then a separate wire to each common. 4 + 2 = 6.
I have also been looking at building a resistor network and using RCTIME to decode the setting. Is this going to be reliable?
Does anyone have any other ideas?
On the system have, I easily have 4 bits on a connector. I don't mind building some external circuitry, itf I use the 6-bit technique above, I am already adding diodes.
I would love to get some ideas from this forum.
Greg
Doing it with 8 bits is a no brainer --
Doing it with 6 is also easy. Each thumbwheel 1,2,4,8 through a diode, then a separate wire to each common. 4 + 2 = 6.
I have also been looking at building a resistor network and using RCTIME to decode the setting. Is this going to be reliable?
Does anyone have any other ideas?
On the system have, I easily have 4 bits on a connector. I don't mind building some external circuitry, itf I use the 6-bit technique above, I am already adding diodes.
I would love to get some ideas from this forum.
Greg
Comments
I have been also looking at making a resistor ladder between all the switch contacts and decoding it with a single connection using RCTIME. Now the whole idea is sort of an adventure.
If I use RCTIME, I might have to use quite a bit of memory for a lookup table. Maybe not worth the trouble.
Greg
OK -- This is how I am doing it. Besides all the wiring mistakes I made (see picture) I now have a working BDC Thumbwheel interface.
So now I have two nibbles representing the two 0-9 thumbwheel switches. How do i get them to come out as 0-99 in a byte?
I had a socket on my board for an EEPROM that I never needed. It was easy to wire that socket to a 74hc165 and two decimal thumbwheel switches with pullups. Now I need to take the two nibbles and turn them into a single decimal value I can use in my software.
Greg
I have attached my schematic for those who might want to do something like this.
The code I used to acquire the data is right out of the "book" except that I used the /Q output of the 74HC165 to invert the Thumbwheel data.
Get_Thumb: 'Use the EEPROM Socket to connect 74HC165 to read two Decimal Thumbwheels
PULSOUT EEPromCS, 5 ' grab the switch inputs
SHIFTIN EEPromDataIO, IOClkPin, MSBPRE, [Thumbs] ' shift them into variable Thumbs
RETURN
Works fine, I just would like to turn the 2 nibble byte into one bye that represents 0-99. I could use some advice.
Thanks
Get_Thumb: 'Use the EEPROM Socket to connect to 74HC165 to read two Decimal Thumbwheels
PULSOUT EEPromCS, 10 ' grab the switch inputs
SHIFTIN EEPromDataIO, IOClkPin, MSBPRE, [Thumbs] ' shift them in
Thumbs = (Thumbs.HIGHNIB * 10) + (Thumbs.LOWNIB) 'now combine the 2 thumbwheels to read 0-99
Thumbs = Thumbs MAX 28 'limit the Thumbs value to 28
RETURN
Thanks for all the help on this one.
Greg
[code]
Greg