PDA

View Full Version : Receiving and Transmitting Serial data at the same time



BobP
- 12th April 2007, 15:04
Hi All,

I need to build a unit to receive a small amount of serial data at 9600. Examine, change then send it out a second serial port at 9600.

My problem is a second or third batch of receive data could arrive before the 1st batch has been sent!

My idea is to use the USART to receive the data into a circular buffer using a ASM interupt routine. Then use PBP to examine and send using SEROUT2. If I keep the ASM routine short I am hoping it won't upset the SEROUT2 timings?

As usual it sounds too easy!!!

Any tips or pointers appreciated.

thanks,
BobP

Charles Linquis
- 12th April 2007, 15:49
The RXreg and TXreg in a PIC are different, so you can send and receive at the same time without resorting to SEROUT2.

Or... you could use a PIC with 2 USARTs, like the 18F8722.

BobP
- 12th April 2007, 22:00
Thanks, original spec was for different baud. Forgot I could use Tx and Rx if baud was same....

Many thanks,
Bob