Reading LARGE numbers of switch closures... without LARGE chip count?
xanatos
Posts: 1,120
I have to read 256 total switch closures (128 devices each with two switch-closure outputs). Obvious call for 74H165 Shift Registers, right? Except that I need 32 of them, meaning 32 latch lines, meaning 4 more 74H595s just to drive all those latch lines....
So I thought of using some 4066 analog switches to sequentially drop 8 lines at a time onto a single 'H165, but then I have 64 - 4066's with each 2 having a common enable, so I still have 32 enable lines, requiring 4 - 74H595s to drive those...
So then I thought - rather than switching the sense of the outputs, I could parallel the outputs, and just cycle through the commons using 74H595s to select 1 of the 128 common lines. This allows me to eliminate the input circuitry altogether, and all I need is 16 74H595s to get the 128 output common lines driven (which also means another pair of 74H595s to drive the latches on the other 16).
I am trying to reduce the chip count (and save my neck and back from being hunched over a dremel drill press for days drilling a thousand holes).
Is there anything out there that may do what I am trying to do with greater efficiency? Specifically meaning much smaller chip count? I even thought of trying to ID each sensor by a specific resistance value, but there is going to be a lot of wiring distance between the sensors and my circuitry...
Thanks for any ideas! :-)
Dave
So I thought of using some 4066 analog switches to sequentially drop 8 lines at a time onto a single 'H165, but then I have 64 - 4066's with each 2 having a common enable, so I still have 32 enable lines, requiring 4 - 74H595s to drive those...
So then I thought - rather than switching the sense of the outputs, I could parallel the outputs, and just cycle through the commons using 74H595s to select 1 of the 128 common lines. This allows me to eliminate the input circuitry altogether, and all I need is 16 74H595s to get the 128 output common lines driven (which also means another pair of 74H595s to drive the latches on the other 16).
I am trying to reduce the chip count (and save my neck and back from being hunched over a dremel drill press for days drilling a thousand holes).
Is there anything out there that may do what I am trying to do with greater efficiency? Specifically meaning much smaller chip count? I even thought of trying to ID each sensor by a specific resistance value, but there is going to be a lot of wiring distance between the sensors and my circuitry...
Thanks for any ideas! :-)
Dave
Comments
Would something like this be of any help?
http://pdfserv.maxim-ic.com/en/ds/DS2401.pdf
Dave
Another option would be an MCU with two 16-bit ports or four 8-bit ports, with the switches arranged as a 16x16 matrix.
Kwinn Wins! The matrix reduces my chip count from 36 to 4! That means instead of 576 holes I only have to drill 64, and this makes me very happy :-)
Thanks everybody!
Dave
Is this for a calorimeter?
Dave
-Phil
Duane J
Thanks Beau, that's a great idea for times when only 4 conductors are available.
Actually, I have a programmatic method of using the 165s and 595s such that each switch is polled separately in a matrix arrangement, and it doesn't require diodes. Yes, pulldowns, no diodes. Happy camper!
Dave
Duane J
Dave
You do know the 74HC165 can be daisy chained? Tie Qh to Ser between chips, and use a common clock and latch line. For 'n' chips you'd need to toggle latch once, then clock in n*8 bits. Assuming an 80MHz clock and a 10MHz serial burst clock(requires using counters), you'd be able to read out one string of 32-chips in ~27uS.
Lawson
Yes, but the point was more to do with switch action.
If you have only one switch on at a time, as in keyboard momentary, matrix scan works very well.
If the 256 sense switches can ever produce many or all on at once, you need another approach.
-Phil
Note, how the second switch shorts out the high from the first switch.
And the ambiguity of S21 when 3 other switches are pressed.
Duane J
Even this is only a partial solution, - consider S11,S12,S22 all closed, now the system cannot tell if S21 is closed, or not - it reports it as closed.
That is why the question of 'how many on at one time ' matters.
Dave
PS., not sure if I mentioned this, but the matrix has no direct connection to either Vss or Vdd. The 595 is used to sequentially energize 1 column at a time; the 165 senses which positions in the row are passing the 595's logic 1. The 595 also has current limiting resistors to prevent 0 to 1 shorts...
-Phil
You do need the diodes. Lets say col1 is energized and the switch on row3 of col1 is closed. This will pull row3 high. If another switch (say row3 col4) is closed you will now have a short between col1 and col4. A diode on each switch avoids this since only the ones connected to the high column are forward biased.
The drive voltage backs through the switch in the lower-righthand corner and sneaks onto the left-hand vertical bus, giving a false reading. What's possibly worse, if the unselected horizontal line were driven low, there would be a short.
With diodes, this is prevented:
Like you, I once designed a switch array without diodes. It was for some sorting electronics that I had built, and I had flown across country to install it. Well, the fault in the top illustration bit me hard, and I knew immediately what the problem was. It was a big "D'oh!" moment in front of my customer, though. So, in the dead of winter, with a snowstorm bearing down on Kalamazoo, I was frantically searching for enough diodes to fix the problem. 'Ended up cleaning out the local Radio Shack associate store of every diode they had, but that was all it took to make it work. This is what I meant by "from experience."
-Phil
Also - thank you all for working so hard to get my fever-addled brain to see what you were talking about.
Still recovering, but much, much better. Don't eat raw oysters. Seriously.
Apparently there were dozens of cases...
Best,
Dave
Wow, man, I'm so glad you're in recovery! Raw oysters: yup, loved 'em myself! They taste like the salt air that you notice when you've been away from the ocean for awhile. 'Nothing like 'em! But times have changed, and the water isn't as clean as it used to be, even here in Washington's formerly pristine Hood Canal. I last ate a raw oyster about 25 years ago, after shucking it on the beach. The taste is a pleasant memory that lingers on my palate to this day, but it's not something I plan to experience again.
Continue to heal!
-Phil
Dave,
I've heard some amazing excuses for shirking good suggestions on this forum, but this Cholera thing you came up with is... hey, wait a second.... you DID remember to read the MSDS for PdCl2 didn't you?