Thread: Wait4TXEmpty
View Single Post
  #2   Spotlight this post!  
Unread 24-02-2004, 01:12
Jay Lundy Jay Lundy is offline
Programmer/Driver 2001-2004
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Berkeley, CA
Posts: 320
Jay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to all
Re: Wait4TXEmpty

There is a slight delay between the time when you put a byte in the Tx buffer and when that data is actually sent over the Tx pin. TXREG is just a holding register for data you want to sent over the Tx pin. The chip will load the data from TXREG into the transmit shift register once the stop bit from the previous byte is sent over the Tx pin. Once data from TXREG is loaded into the shift register, TXIF is set, signaling TXREG is ready to receive more data.

If you try to write another byte into TXREG before TXIF is set, that byte that used to be there will never be transmitted.

So if you have enough of a delay between writes to TXREG, you can get away with not calling Wait4TXEmpty(), but it's better to just call it.