Active multiplexing saves inputs
JB Guiot, Mulhouse, France; Edited by Martin Rowe and Fran Granville - March 17, 2011
Microcontrollers must often read the status of switches in control applications. A typical switch configuration uses pullup resistors on both of the switches to pull the signals high or low for the microcontroller to read. The controlling output in the circuit in Figure 1 uses two switches. When both switches are open, resistors R1 and R2 keep the input at an undetermined value between low and high, which is 1.5V if the supply voltage is 5V. Thus, an analog input would be preferable to a digital input. With the values in the figure, 0.5 mA of current flows through the resistors, even when both switches are open. You must multiply that value by the number of inputs used to get the total current.
You can expand this scheme to any number of switches and inputs. You can read 12 inputs with three switches. You can also mix the circuits in figures 2 and 3 on the same microcontroller, separating independent switches (Figure 2) and “interlocked” switches (Figure 3) on different inputs.
Switching a signal’s state uses energy, so change states only when reading the switches. Otherwise, leave the input and output pins in a high-impedance state. If your design has position-cam switches that never close simultaneously, you can refer to the circuit in Figure 3 to reduce the number of inputs coding the switches. Table 1, a truth table, provides the possible states.
Share your thoughts.
Datasheets.com Parts Search
185 million searchable parts
(please enter a part number or hit search to begin)