I am trying to set up a pic to send and receive data using the Xbee RF transceiver. i can’t figure out how to do the communication between the receiver pic,the xbee and the rs232 in the same time since the pic 16f877 have only one UART .
You have a few options.
-
“Bit-bang” a serial port through some other I/O. This means you will use general purpose I/O on the PIC to simulate a UART. It requires a lot of software overhead and it is nowhere near as efficient or as fast as a hardware UART but it will get the job done and doesn’t require the addition of any hardware.
-
Use a multiplexer to feed the hardware UART with 2 different sources. This will give you the advantage of using the hardware UART in the PIC but the downside is you cannot talk to the XBee and your RS232 line simultaneously. This will require adding additional ICs to your project but they are fairly inexpensive.
-
Add an external UART to your project. This will give you a second physical UART allowing you simultaneous communications to both of your targets. External UARTs can be found with various interfaces including I2C and SPI which are both compatible with your PIC.
-
Change to a different PIC that has 2+ UARTS. The 16F877 is an old PIC and there are plenty of cheaper models with more features and better overall performance.
-Bill
i guess i ll add an external UART but Do you know some UART IC’s? and thank you for your help it means alote
Sparkfun has a board that does just this: https://www.sparkfun.com/products/9981 . Keep in mind that it is a 3.3V board with 5V tolerant inputs so be careful how you make connections.
If you want a raw IC, a quick search of Digikey for “UART” will bring up lots of options.
-Bill