An embedded project I'm working on requires the ability to read the status of up to 64 input ports - but obviously I want to use as few of my microcontroller pins as possible. Somewhere I heard of devices called 'sequencers' or something like that where you just feed it a clock signal and it turns on individual i/o pins in order and then wraps around to pin zero again (or is reset with a third line - which would seem better since you'd KNOW the thing would re-start on pin 0). Something like this would be ideal since it would only consume three i/o pins on my controller. However, a quick google search didn't reveal any such devices. Maybe I'm not using exactly the right name for the things ? I'd heard of something like it for scan-writing to those big 60-odd-pin LCD chips, but I'm interested in READING a logic 0 or 1. Reset -> Read Pin 0 -> Clock -> Read pin 1 -> repeat -> repeat -> repeat(N) -> reset. Any info helpful. Reply to group.
Chip to Sequentially Read Many Inputs ?
Started by ●October 10, 2005
Reply by ●October 10, 20052005-10-10
There's a common 4000-series chip (4060?) that's a parallel-to-serial converter. Basically, you can connect your parallel inputs into one of the 8 input lines, latch the input and simply clock the data through on a synchronous serial line. There's a complementary chip that does outputs. You can chain as many of these as you like together. The only real problem is that the more inputs/outputs you have, the longer a single operation will take. Geoff B1ackwater wrote:> An embedded project I'm working on requires the ability to > read the status of up to 64 input ports - but obviously I > want to use as few of my microcontroller pins as possible. > Somewhere I heard of devices called 'sequencers' or something > like that where you just feed it a clock signal and it turns > on individual i/o pins in order and then wraps around to pin > zero again (or is reset with a third line - which would seem > better since you'd KNOW the thing would re-start on pin 0). > > Something like this would be ideal since it would only consume > three i/o pins on my controller. However, a quick google search > didn't reveal any such devices. Maybe I'm not using exactly the > right name for the things ? I'd heard of something like it for > scan-writing to those big 60-odd-pin LCD chips, but I'm > interested in READING a logic 0 or 1. Reset -> Read Pin 0 -> > Clock -> Read pin 1 -> repeat -> repeat -> repeat(N) -> reset. > > Any info helpful. Reply to group.-- Geoff Field Professional Geek, Amateur Stage-Levelling Gauge
Reply by ●October 10, 20052005-10-10
B1ackwater wrote:> An embedded project I'm working on requires the ability to > read the status of up to 64 input ports - but obviously I > want to use as few of my microcontroller pins as possible. > Somewhere I heard of devices called 'sequencers' or something > like that where you just feed it a clock signal and it turns > on individual i/o pins in order and then wraps around to pin > zero again (or is reset with a third line - which would seem > better since you'd KNOW the thing would re-start on pin 0). > > Something like this would be ideal since it would only consume > three i/o pins on my controller. However, a quick google search > didn't reveal any such devices. Maybe I'm not using exactly the > right name for the things ? I'd heard of something like it for > scan-writing to those big 60-odd-pin LCD chips, but I'm > interested in READING a logic 0 or 1. Reset -> Read Pin 0 -> > Clock -> Read pin 1 -> repeat -> repeat -> repeat(N) -> reset. > > Any info helpful. Reply to group.You can use eight 74HC165 pallel-in/serial-out shift registers. You can control it with just three pins, if you like. Noel
Reply by ●October 10, 20052005-10-10
On Mon, 10 Oct 2005 13:12:04 GMT, the renowned bw@baark.net (B1ackwater) wrote:>An embedded project I'm working on requires the ability to >read the status of up to 64 input ports - but obviously I >want to use as few of my microcontroller pins as possible. >Somewhere I heard of devices called 'sequencers' or something >like that where you just feed it a clock signal and it turns >on individual i/o pins in order and then wraps around to pin >zero again (or is reset with a third line - which would seem >better since you'd KNOW the thing would re-start on pin 0). > >Something like this would be ideal since it would only consume >three i/o pins on my controller. However, a quick google search >didn't reveal any such devices. Maybe I'm not using exactly the >right name for the things ? I'd heard of something like it for >scan-writing to those big 60-odd-pin LCD chips, but I'm >interested in READING a logic 0 or 1. Reset -> Read Pin 0 -> >Clock -> Read pin 1 -> repeat -> repeat -> repeat(N) -> reset. > >Any info helpful. Reply to group.A 64:1 multiplexer will likely take a few chips to implement, probably from 8:1 muxes and a bit of glue logic. It takes 6 bits to address 64 inputs (ln(64)/ln(2) if you must)-- so a 6 bit counter will do you. You could use a 74HC4040 ripple counter (12 bits) which would address 4096 inputs. That will require only 3 port pins, perhaps less if you use other tricks, but probably at least 10 chips. Another, perhaps more attractive, approach could be to use a parallel-in, serial out 64-bit shift register (say made from 8 chips eg. 74HC165). You would use one port pin for the data, one for the clock, and one for the load signal. This has the advantage of sampling every input virtually simultaneously, requires no glue logic, and still only requires 3 port pins. Instead of bit-banging the clock and data signals, you may be able to use available SPI bus hardware to read the inputs at relatively high speed. Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com
Reply by ●October 10, 20052005-10-10
"B1ackwater" <bw@baark.net> wrote in message news:434a62cb.6492746@news.west.earthlink.net...> An embedded project I'm working on requires the ability to > read the status of up to 64 input ports - but obviously I > want to use as few of my microcontroller pins as possible. > Somewhere I heard of devices called 'sequencers' or something > like that where you just feed it a clock signal and it turns > on individual i/o pins in order and then wraps around to pin > zero again (or is reset with a third line - which would seem > better since you'd KNOW the thing would re-start on pin 0). > > Something like this would be ideal since it would only consume > three i/o pins on my controller. However, a quick google search > didn't reveal any such devices. Maybe I'm not using exactly the > right name for the things ? I'd heard of something like it for > scan-writing to those big 60-odd-pin LCD chips, but I'm > interested in READING a logic 0 or 1. Reset -> Read Pin 0 -> > Clock -> Read pin 1 -> repeat -> repeat -> repeat(N) -> reset. > > Any info helpful. Reply to group. >Hello, The other way to do it would be to code another pic chip specifically meeting these requirements. ;-) I wonder if you mean a multiplexor, not sure here. I know what you're trying to achieve though. The trouble is that there's no robustness built into the circuit in the event of a misread if purely clocking a pin and dumping the contents of your output. Parallel wise it would take 6 bits to represent 64 (or 63 for those that refuse to accept 0 as a state). Tricky one. Currently wading through this site for my own purposes atm; http://www.kpsec.freeuk.com/components/74series.htm Good luck :-) Aly
Reply by ●October 10, 20052005-10-10
Hi, B1ackwater wrote:> An embedded project I'm working on requires the ability to > read the status of up to 64 input ports - but obviously I > want to use as few of my microcontroller pins as possible.Depending on volume, you could just program another cheap 40 pin uC to handle the bulk of them. Its wasteful but easy :) Al
Reply by ●October 10, 20052005-10-10
On Mon, 10 Oct 2005 23:54:40 +1000, the renowned Al Borowski <al.borowski@EraseThis.gmail.com> wrote:>Hi, > >B1ackwater wrote: >> An embedded project I'm working on requires the ability to >> read the status of up to 64 input ports - but obviously I >> want to use as few of my microcontroller pins as possible. > >Depending on volume, you could just program another cheap 40 pin uC to >handle the bulk of them. Its wasteful but easy :) > >AlSure, use a couple of those $1.47 LPC ARMs as peripherals for your PIC. ;-) Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com
Reply by ●October 10, 20052005-10-10
On Mon, 10 Oct 2005 13:12:04 GMT, bw@baark.net (B1ackwater) wrote:>An embedded project I'm working on requires the ability to >read the status of up to 64 input ports - but obviously I >want to use as few of my microcontroller pins as possible. >Somewhere I heard of devices called 'sequencers' or something >like that where you just feed it a clock signal and it turns >on individual i/o pins in order and then wraps around to pin >zero again (or is reset with a third line - which would seem >better since you'd KNOW the thing would re-start on pin 0). > >Something like this would be ideal since it would only consume >three i/o pins on my controller. However, a quick google search >didn't reveal any such devices. Maybe I'm not using exactly the >right name for the things ? I'd heard of something like it for >scan-writing to those big 60-odd-pin LCD chips, but I'm >interested in READING a logic 0 or 1. Reset -> Read Pin 0 -> >Clock -> Read pin 1 -> repeat -> repeat -> repeat(N) -> reset. > >Any info helpful. Reply to group.Probably easiest to whip one together out of a small CPLD and a bit of HDL code. Something like an SPI interface where the uC sends a read request (where 3 of the 8 bits constitute an "address") and the CPLD replies with the values on the 8 input pins at that address. Very little overhead if the uC has a built-in SPI port and fairly straightforward on the CPLD side. Also give you random vice sequential access. -- Rich Webb Norfolk, VA
Reply by ●October 10, 20052005-10-10
On Monday, in article <434a62cb.6492746@news.west.earthlink.net> bw@baark.net "B1ackwater" wrote:>An embedded project I'm working on requires the ability to >read the status of up to 64 input ports - but obviously I >want to use as few of my microcontroller pins as possible. >Somewhere I heard of devices called 'sequencers' or something >like that where you just feed it a clock signal and it turns >on individual i/o pins in order and then wraps around to pin >zero again (or is reset with a third line - which would seem >better since you'd KNOW the thing would re-start on pin 0).Sounds like a shift register (parallel load serial output), mind you are you wanting to clock load all 64 bits at once, before shifting?>Something like this would be ideal since it would only consume >three i/o pins on my controller. However, a quick google search >didn't reveal any such devices. Maybe I'm not using exactly the >right name for the things ? I'd heard of something like it for >scan-writing to those big 60-odd-pin LCD chips, but I'm >interested in READING a logic 0 or 1. Reset -> Read Pin 0 -> >Clock -> Read pin 1 -> repeat -> repeat -> repeat(N) -> reset. > >Any info helpful. Reply to group.Another alternative SPI or I2C chips or PLD providing the 40 pin I/O but serial to micro. On I2C you can get chips like PCF8574(A) or PCF8575 that are 8bit and 16bit I2C I/O chips and only needs bit banging on two micro pins, and read bytes at a time. -- Paul Carpenter | paul@pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.gnuh8.org.uk/> GNU H8 & mailing list info <http://www.badweb.org.uk/> For those web sites you hate
Reply by ●October 10, 20052005-10-10
B1ackwater wrote:> An embedded project I'm working on requires the ability to > read the status of up to 64 input ports - but obviously I > want to use as few of my microcontroller pins as possible. > Somewhere I heard of devices called 'sequencers' or something > like that where you just feed it a clock signal and it turns > on individual i/o pins in order and then wraps around to pin > zero again (or is reset with a third line - which would seem > better since you'd KNOW the thing would re-start on pin 0). > > Something like this would be ideal since it would only consume > three i/o pins on my controller. However, a quick google search > didn't reveal any such devices. Maybe I'm not using exactly the > right name for the things ? I'd heard of something like it for > scan-writing to those big 60-odd-pin LCD chips, but I'm > interested in READING a logic 0 or 1. Reset -> Read Pin 0 -> > Clock -> Read pin 1 -> repeat -> repeat -> repeat(N) -> reset. > > Any info helpful. Reply to group.What you are looking for are called IO Expanders, or ShiftRegisters. See http://www.standardics.philips.com/products/shiftregisters/ Which one is best depends on price, component count, if the IO are distributed, noise immunity etc. Simple Logic Shift registers will be the lowest cost, but they need external pullups. They are also very easy to cascade and expand. PCF8574 series i2c IO expanders are convenient, but quite expensive. The HEF4021 can read 8 ips, and drive 3 ops, so you can matrix 24 buttons on one of those. They are under 20c. CPLD/SPLD can be used, but are more complex to deploy, so are best used if there is something special about the IO that means std shift registers will not be suitable. -jg