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

resetting kbhit()

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







resetting kbhit()
PostPosted: Mon Apr 07, 2008 9:18 pm     Reply with quote

hi everyone.. is there a way to reset the kbhit function?
like if when a character enters then the kbhit will return 1, how can i do this so that its value will go back to 0?

Code:

#include <16F877.h>
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

void func1(void)
{
   if (kbhit())
      {
      do something...
      }
}

void func2(void)
{
   do something...
}


void main (void)
{
while(1)
   {
   func1();
   func2();
   }
}



how can i reset the value of kbhit so that after a character has entered and it has already entered the func1 function, it wont enter this function not until a new character has arrived.. please help.. thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 07, 2008 9:39 pm     Reply with quote

Call the getc() function to get the character.
xindy
Guest







thanks
PostPosted: Mon Apr 07, 2008 9:56 pm     Reply with quote

thanks pcm programmer.. thanks for sharing your expertise for newbies like me..
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