2 UART devices from one Port?

Discussion in 'The Projects Forum' started by myztic_man, Jun 23, 2009.

  1. myztic_man

    Thread Starter Member

    Apr 27, 2009
    21
    0
    Is it possible to drive two devices from one UART port?
    I am looking at having both my GPS module and my data logger connected using UART but my Micro (AT89C51AC3) only has 1 UART port.

    Or, is there some way to use SPI as a UART?

    Thanks!
     
  2. StayatHomeElectronics

    Well-Known Member

    Sep 25, 2008
    864
    40
    If you are using serial RS232 communication on the UARTs between the GPS and the Micro then that is a point-to-point communication scheme, one transmit and one receive.

    If you are using the data logger only to monitor the communication between the two devices, then you can use a RS232 Sniffer device to display the messages between the two devices without disrupting them.

    Here is a link that shows how to connect the monitoring device to the system.

    http://www.marcspages.co.uk/tech/3104.htm

    Is the GPS module equipped with serial or usb communications?
     
  3. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Besides the good link that SAHE gave you (nice and simple), you may want to get a copy of Serial Port Complete First Edition. I used to think that serial comm was relegated to two devices (one on one) but this book demonstrates networking multiple nodes with RS232. The book includes heaps of VB6 and PIC code.
     
  4. Jan Rune

    Member

    Apr 22, 2008
    17
    0
    Another option would be software Uart. Isnt that complicated that i might sound like...
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,140
    1,789
    I used a pair of MAX3100 UARTs with SPI interfaces when I ran out of UARTs. The 16-byte receive FIFO was a big help at the 38,400 bps coming from the GPS device. The Siemens cellphone module used the other one. I ended up using the onboard UART as a monitor port.
     
  6. myztic_man

    Thread Starter Member

    Apr 27, 2009
    21
    0
    I am not simply looking to 'monitor' the data between the GPS and the Micro, as I am performing some string handling on the data, and also need to add additional data to that being recorded.

    Here is how the current system operates:
    GPS Rx/Tx --> Micro Tx/Rx
    The Micro gets the Serial data from the GPS at 4800 baud, and performs some functions on the NMEA stings to split up the data etc.
    I then want to send some data back, via UART to: http://www.4dsystems.com.au/prod.php?id=22
    A small device capable of handling all the Fat16 filesystems, which will log the data.

    Both the GPS, and this device operate on Rx/Tx lines - however I only have one of each of those available on my Micro.

    Would it be possible to run Rx and Tx into a multiplexer which i can then control with my Micro in order to have two devices running from the same Rx/Tx lines on the Micro?
    To me this appears similar to the way in which the SS line in SPI operates..
     
  7. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
    If I'm correct, your GPS is continuosly streaming.

    TI's SN74LVC2G157 is a 2-1 data selector, in which you would dedicate a port line for selection purposes. If you wanted to Tx back to the GPS units, you should find a dual package.
     
  8. StayatHomeElectronics

    Well-Known Member

    Sep 25, 2008
    864
    40
    If the periods of time that you need to communicate with the two devices, GPS and uDrive, from the microcontroller is known, i.e. you only need to communicate with one at a time, then you can probably use the multiplexer on the logic level signals (TTL) to and from the microcontroller. You may have to reestablish the connection each time you switch to the other device.

    You may need to use pullup resistors, or pulldown resistors, on the logic level lines so the idle device does not read in garbage data and get confused.
     
  9. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
Loading...