> > I am assuming the UART is used only for communicating > > between the 2 PICs. In other words, pic 1-TX is > > connected to pic2-RX; pic1-RX is connected to pic2-TX. > > If that is the case, put a pull-up resistor on one of > > the 2 lines and put a pull-down resistor on the other > > line. > > At start-up, all lines are inputs. Read the state of > > the RX & TX lines. > > Pic 1 will have TX hi & RX low > > Pic 2 will have TX lo & RX hi > > > So, for example, the PIC that sees TX hi & RX low would > be the master, and the PIC that sees TX lo & RX hi > would be the slave. I just wanted to add two more points now that I have implemented this scheme: 1. The master and slave must be synchronized before initializing the UART (in other words, even before transmission commences). This is because UART initialization causes a 1 to be driven on the Tx line (idle state). 2. When the slave sends to the master, the slave MUST wait one bit time after TRMT=1 (to allow the stop bit to be transmitted) before "shutting down" (disabling the UART). Otherwise, the pull-down on the slave Tx line will interrupt the stop bit. I bring this last point up because there was a thread ("[PIC]: TRMT vs TXIF ..." on 04/30/03) debating under which conditions waiting for this bit time was necessary. Rick -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads