comments about Tx/Rx in C simultaneously

Thread Starter

tuanvoi

Joined Oct 31, 2008
56
Hi all,
I'm doing the project about Tx/Rx signalling. I have 2 PICs, these 2 PICs will use USART to transmit/receive the signal.
Each PIC will check the signal on PORTB pin0 (whether 5V or 0V in digital) and send this signal to the other PIC to inform that it is high or low. And the same procedure for the other PIC.
I want to write the code C that will transmit the condition of PORTB to one PIC and receive the condition at the other PIC sent at almost the same time (I know that it is impossible to do this, so one has to happen before the other. Because the time the PIC runs so quick that we feel like it is parallelly running).
Would you please give me some idea about the source code!
Thanks
 

AlexR

Joined Jan 16, 2008
732
What models PICs are you using?

How far apart are they?

What made you pick pin B0?
If you want to use the UART on-board the PIC you must use the pins allocated to the UART Tx and Rx. You can't just pick Tx/Rx pins at random.

If you only need to transmit one bit of data you probably don't need to use the UART. The UART will introduce a considerable delay into the data flow as it is geared to send bytes rather than single bits.

I somehow get the feeling you don't really understand what a UART does or how it works. It may help if you have a read of this link.
 

Thread Starter

tuanvoi

Joined Oct 31, 2008
56
Sorry for any misleads, I meant I PIC18F4550 will check the condition of the PORTB pin 0 (whether high or low), then It will send some data ('ABCD' -->high or 'DCBA' --> low) to the USART. I did not mean that I use PORTB pin0 for USART. Thanks
 
Top