I need to take a keyboard input but I can't use getch(); because I wanna start a counter. If counter exceeds it will not wait for the keyboard.
I give you the image of flowchart.
Means the circuit may attach with pc or not. While attach with pc it will wait 5sec to take keyboard input. If input ok then go to main program or wait 5sec and seek for input. If 5sec is over it also goes to main.
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
Posted: Wed Oct 27, 2010 4:31 am
Use kbhit() to see if a character is coming in. Only if there is a character call getc(), else count time. If you use a software UART you must call kbhit() at least 10 times the serial bit rate to make sure you don't miss the first bit from the keyboard. For a hardware UART you have up to 2 character lengths to catch the character. _________________ The search for better is endless. Instead simply find very good and get the job done.
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