Ok, I own quite a few of the AT89S52 IC and the AT89C4051. Both have only UART, but my project requires two because the same device will control a radio module that requires a UART for interfacing and it will also communicate with the PC through serial port. As a last resort, I would use the parallel port to communicate with PC but the parallel port cable will be too bulky and my project needs to be several meters away from the PC.

I have researched and found IC's with dual UARTs but that may be a waste of time since I have to order them from ebay (china) and wait 6+ weeks for them on top of learning new 8051 commands to interface with them. I'd rather get things done easier and quicker than 5 weeks.

The only other idea I thought of is to use some sort of multiplexer/demultiplexer IC connected to the UART port so it doubles into 2 ports (I hope).

I plan to make all UART action will be half-duplex and time-sliced. By that I mean in one time frame, the micro sends data through UART to radio module, then in another time frame, the micro receives data from radio module, then in another time frame, the micro sends data to the PC then in the final time frame, the micro receives data from the PC.

Is this as simple as the following?:

  1. connecting the micro transmit (data out) pin to an input of a multiplexer and each output to each device's UART transmit pin (where data is happily accepted)

  2. connecting the micro receive (data in) pin to the output of a demultiplexer and each input to each device's UART receive pin and

  3. connecting the address line of the demultiplexer/multiplexer to a gpio pin to allow me to select a UART.

or do I need to add resistors as well? and if I use cmos parts like 4051, would that affect performance if I decided to make all UART devices run at 115200bps?

  • \$\begingroup\$ From the microcontroller, do you have complete control over the timing of when messages will be sent from the PC and send from the radio module? Or are those events uncontrolled from the point of view of the microcontroller? \$\endgroup\$ – jonk Nov 1 '17 at 18:39
  • \$\begingroup\$ In my application the microcontroller will send messages at fixed intervals directly to the radio module where each message contains a destination address since it will be addressing many microcontrollers wirelessly then after it will query the PC for a command and send a response back to the PC, then the process repeats. \$\endgroup\$ – user152879 Nov 1 '17 at 19:48
  • \$\begingroup\$ I will add I can preset the interval rate (example: make waiting time longer between each message) \$\endgroup\$ – user152879 Nov 1 '17 at 19:50
  • \$\begingroup\$ How do you solve the problem where a PC or radio module sends a message and the micro is at a different state, in the process of sending for example? Oh, well. Doesn't matter. There's no schematic so I don't know how any of this is supposed to be connected. So it doesn't matter. I'm ignorant so it's hard to say there will, or won't be, problems. I'm confused. Maybe someone else won't be. \$\endgroup\$ – jonk Nov 1 '17 at 19:53
  • \$\begingroup\$ Everything will be timed. and if something is out of sync, it will be ignored and it will have to retry. \$\endgroup\$ – user152879 Nov 1 '17 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy