Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

getchar problem in C

Status
Not open for further replies.

AliBahar

Member level 2
Joined
Feb 4, 2015
Messages
42
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
337
Hi
as you know if we use getchar() function it waits for typing char by keyboard.
in my requirement the compiler must return to code and perform the next command line if there is no character typed with keyboard.
so after specified delay time the subsequent command must be performed if if there is no typed character .
any suggestion
 

which processor and compiler are you using

some libraries have a function which enables one to check if a character has been received
otherwise you can always check the UART receiver flag yourself
 

You can input the value upon some condition like that:


Code C - [expand]
1
2
3
4
if ( kbhit() )
   {     
   variable= getch();    
   }

 
The problem with kbhit() is that the microcontroller must be in the kbhit(), for it to process the next line, better use an interrupt.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top