I am designing an application with a PIC microcontroller connected to an XBee module which receives and transmits RF data.
I would also like to use the PIC to communicate with a second PIC over a wired interface using it’s inbuilt UART.
Is this possible whilst it is still connected to the XBee?
I am hoping that when the XBee is in IDLE mode, the Din and Dout pins will be high-impedence so that they will not affect the levels that the PICs are driving their Rx and Tx pins.
Are there any tricks/workarounds to get this working?
In case it’s useful, the details of my system:
both PICs communicating with one another are PIC16F886
and the XBee will probably be a Series 1 although I could use Series 2.5 if this makes any difference.
any serial UART can send TX data to any number of receiving UARTS - if (1) the data polarity is the same among all and (2) that the voltage/current capabilities of the sourcing driver are not exceded (logic level or RS232), in combination with the capacitance of the wire for long lengths.
For multiple transmitters on the same wire, we have RS485
You could have some kind of slave-select signal, like in SPI. The other PIC could just have an input pin that disables the TX-pin (turns to an input) and UART receiver. I’m not sure about the XBee, maybe it has this functionality, or you could insert a tri-state buffer between it and the PIC RX-line.
You will have to be careful though, unless you use hardware handshaking to stop the slaves from transmitting, you could miss data when you’re not listening to the device.
However, can’t you use a PIC that has more than one UART, that would probably save you a lot of trouble.
All the above post are ways to use Async to/from multiple devices.
For PIC to PIC communications I would go with SPI. The 16F886 does have a MSSP module that is independent of the EUARST module and can be configure as a master or slave.
On the XBee, IDLE mode simply means that the XBee is not sending or receiving data on its serial line or on the RF link. I could not find any information in the XBee docs as to whether the Serial out line is driven high or held high by a pull-up. Also couldn’t determine if the serial lines are hi-Z during pin Sleep mode but since this does greatly decrease the XBee power consumption the serial line driver may be turned off.
A call to Digi Int may help clear up this question.
In the end I plumped for using 2 separate pins and a bit-banged solution for comms between the 2 PICs as that seemed easiest. (SPI already used for something else.)