I never thought I would say this, but there will be situations which you need to connect several serial devices using one microcontroller. There are two options to increase the number of serial devices a microcontroller can handle. The default option is to get a microcontroller which has more than one USART port. The second option is to use 74HC4052, a multiplexer/de-multiplexer specifically designed to handle serial communications. In fact, it was the same chip I used in last Wednesday’s mini project post.
What is a multiplexer/demultiplexer?
Let’s start off by talking about what’s a multiplexer. A multiplexer is a sequential circuit designed to accept multiple inputs, but output the data from one of those inputs based on the input selected. This type of sequential circuit is used all of the time in building the underlying architecture for processors. A demultiplexer is the opposite of a multiplexer. A demultiplexer is designed to take in one input, and output it to one of the several output pins based on the output selected. As you can tell by now, the 74HC4052 is a special type of IC that can act as a multiplexer or a demultiplexer depending on the inputs and outputs.
1Z( Pin 13) / 2Z (Pin 3): These pins are the input/output pins of the chip. These are the pins which you’ll want to connect TX or RX of the microcontroller you want to use.
Enable (Pin 6): This is responsible for turning on or off the chip. To turn on the chip, simply connect this pin to ground (0V) and to connect VCC to your positive supply, and GND to 0V.
S0 (Pin 10)/ S1 (Pin 9): These pins are responsible for choosing the input/output pin you wish to use. I’ll explain the purpose of these pins later on.
1Y0(Pin 12)/1Y1(Pin 14)/1Y2 ( Pin 15)/1Y3 (Pin 13): These are the input/output pins to be connected to the 1Z pin. For example, if I connected my microcontroller’s TX pin to 1Z, then I need to connect the RX of my serial device(s) to either one of my 1Yn pins.
2Y0(Pin 1)/2Y1(Pin 5)/2Y2 ( Pin 2)/2Y3 (Pin 4): Same thing as the 1Yn pins, except for the 2Z pin. For example, if I connected my microcontroller’s RX pin to 2Z, then I need to connect the TX of my serial device(s) to either one of my 2Yn pins.
VCC (Pin 16): This is the positive power for the chip.
GND ( Pin 8): This is where you plugged in 0V.
Method of Operation
So how do you use the device? The 1Z can be connected to 1Y0, 1Y1, 1Y2, and 1Y3 pins and 2Z can be connected to 2Y0, 2Y1, 2Y2, and 2Y3. The S0, and S1 pins specify which Y pin is connected to its respective Z pin. For example, if we want to connect 1Y0 to 1Z, we connect S0 and S1 to ground. However, S0 and S1 cannot specify which Z pin is used. In other words, if we connect S0 and S1 to ground, not only will 1Y0 is connected to 1Z, but 2Y0 will be connected to 2Z. I included the truth table from the 74HC4052 datasheet to show how S0 and S1 affect which port is connected.
Default Wiring Diagram
The figure above shows an example schematic of the 74HC4052.
If you guys have anymore concerns, or suggestions, please feel free to post a comment!