??? 12/02/09 13:38 Modified: 12/02/09 14:06 Read: times Msg Score: +1 +1 Informative |
#171394 - Expanding I/O Responding to: ???'s previous message |
A small MCU is one way to expand I/Os from a main controller if you want to use I2C. However I would not recommend that approach if all you need is simple port pin expansion. The extra MCU is a great way to go if there is a need to apply some algorithmic processing to the I/Os or utilize some of the other features such as timer captures or frequency generation. But it is just not worth the extra work, in my opinion, to support the slave MCU firmware coding and loading when other viable choices exist.
One approach, that also uses I2C, is to utilize port expanders. There are 16-bit wide parts like the PCA9555 or 8-bit wide parts like the PCA9534. These parts are nice in that pins can be programmed as inputs or outputs. Some even support the 8051 style quasi-bidirectional style I/Os. Several models of port expanders have an interrupt signalling facility so that you can watch for event changes on pins that are configured as inputs. The main vendors for port expanders are NXP, TI, and Maxim. Much more often I have used 'HC595 type shift register parts to support my output pin functions leaving the MCU pins for use as inputs and those items that truly need bi-directional operation. In a recent project I had three cascaded 'HC595's adding 24-bits of outputs. A CLK, DOUT, and LATCH I/Os from the processor were used to bit-bang the shift registers. In that application I setup the MCU firmware with a 10 msec task cycle interrupt and regularly (each 10msec) shifted out the 24 bits from an internal I/O state variable mapped into a C LONG data type. The overhead of this scheme is very low (less than 40 usec each shift sequence) and relieves the main line code from having to keep the I/Os up to date. Main code simply sets bits in the LONG and the timer task thread takes care of the actual I/O in the background. For your TX/RX switching I would look at a MUX device. A single 'HC4052 part can select routing of a TX/RX pair from the master UART to four separate driver chips. Only two GPIOs would be required to support the MUX selection (and those could be outputs off a port expander or shift register expander. Michael Karas |
Topic | Author | Date |
CPLD or µc? | 01/01/70 00:00 | |
Whatever you are comfortable with | 01/01/70 00:00 | |
Expanding I/O | 01/01/70 00:00 | |
the other route ... | 01/01/70 00:00 | |
Thanks | 01/01/70 00:00 | |
how 'hard' is the choice ? | 01/01/70 00:00 | |
Simple Solutions Exist![]() | 01/01/70 00:00 |