CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Indication of Pending Hardware TX

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

Indication of Pending Hardware TX
PostPosted: Mon Apr 16, 2007 6:29 pm     Reply with quote

Hello All,

I just had stroke of brilliance....

Instead of placing a delay_ms after printfs to avoid losing data when I shut attached radios down, I'd like to check and see if there is any pending data on the hardware RS232 port. Once all the pending data is sent, then I can shut the radio down.

What do I check to see if there is nothing left for TX in the RS232 port?

Thanks,

John
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 1:55 am     Reply with quote

Test the TRMT bit. If it's high, then the 1 or 2 bytes that were pending
transmission in the hardware UART have been sent. Though, according to
the timing diagram in the 16F877 data sheet, TRMT goes high before
the final stop bit is sent on the last byte. So you really should wait for
one bit time after TRMT goes high (assuming only one stop bit is used).
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group