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 CCS Technical Support

using a pic 18f4520 with getc()

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



Joined: 08 Nov 2011
Posts: 1

View user's profile Send private message

using a pic 18f4520 with getc()
PostPosted: Tue Nov 08, 2011 8:02 pm     Reply with quote

May anyone advise me on why code on chip stops executing whenever it reaches a line with a getc() function. Do I need to include some libraries specifically for an 18F because with a 16F my code run smoothly on chip.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Nov 08, 2011 8:56 pm     Reply with quote

getc() waits for a character to be available, then it gets the character.
If you don't want to wait, then call kbhit(). It will check if a character
is available. If it is, then you can call getc(). If not, don't call it.
Read about these functions in the CCS manual:
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf

The getc() function operates exactly the same way for 16F and 18F.
So does kbhit().
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