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

What's the best way to loop while waiting for a character

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



Joined: 14 Mar 2005
Posts: 1

View user's profile Send private message

What's the best way to loop while waiting for a character
PostPosted: Mon Mar 14, 2005 8:48 pm     Reply with quote

I'm working with a 16F873, using the PCWH compiler. I can transmit just fine at 1200 baud using "printf's", but when I try to read, my buffers are just filled with zeros. I've got a loop that spins in 21us increments while waiting for "kbhit()", but once that happens my program just gets a bunch of zeros in the buffer that I've set up.
1) Can I use something other than "kbhit()" to check for a character in the USART buffer, or is "kbhit()" looking for a bit flag somewhere?
2) Does anyone have an code example of the use of the serial interrupt (#INT_RDA)?
3) Which bit flags a received character in the USART receive register?
Thanks y'all..... Rolling Eyes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 14, 2005 8:59 pm     Reply with quote

Use an interrupt-driven receive fifo. See the CCS example file,
EX_SISR.C for sample code.

Also, tell us if you're using the hardware UART or a software UART.
(The hardware UART will use pins C6 and C7).
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