PDA

View Full Version : TX RX Buffer Question



shawn
- 13th January 2005, 04:19
Could someone brefiely explain what and how the TX and RX buffers are on a pic and how one accesses them using PBP.
I'm interested in this because I want to connect multiple pics together so that they can comunicate with each other. I wanted to try useing i2c bus but I do not fully understand the slave mode function of it. It doesn't sound like microchip does either. haha.
Just a brief explanation would be greatly appreciated.

Thanks
shawn

mister_e
- 13th January 2005, 13:05
I'm interested in this because I want to connect multiple pics together so that they can comunicate with each other.I wanted to try useing i2c bus but I do not fully understand the slave mode function of it.

yiiiish... i'm not going to say that's the best way in I2C, IMO it will not work. Some SHIFTIN/SHIFTOUT to *emulate* SPI/Microwire could work BUT, i'll certainely prefer using the simplest way... Serial comm with Internal USART or SERIN/SEROUT statement with some RS485 multipoint driver/buffer or directly using different PIC i/o lines. One can be kinda *server* or *master*. That way you can also use some extra i/o for Flow control too.

Bruce
- 13th January 2005, 15:32
TXREG is the USART Transmit Register. If you have the USART configured, and turned ON, sending a byte to this register transmits the byte via the hardware USART.

RCREG is the USART Receive Register. Bytes received by the hardware USART are stored here.

You access them with PBP the same way you would with any other internal registers.

X VAR BYTE
X = "A"
TXREG = X ' Send character in X to TX register

Y VAR BYTE
Y = RCREG ' Load received data byte into Y from RX register

shawn
- 14th January 2005, 01:49
Thankyou
Steve and Bruce this helped alot.

Shawn