This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Is there any possible way to skip UART_read instruction after waiting for two seconds, if no character is received

Other Parts Discussed in Thread: TM4C1294NCPDT

Microcontroller : TM4C1294NCPDT

I am currently working on a small application that prompts the user to enter character serially, by using UART_read and displaying the information depending on the character entered serially.

But currently I am now in a requirement, where the UART_read function has to skip, if no character is entered and execute the existing function.

These are the current approaches that I have tried out.

Approach 1

uartparams.readTimeout = 2000// 2seconds

Description: Added a params.readTimeout instruction.

Result: IThe existing function is not executing continuously  as , the function is still in the UART_read function

Approach 2

int char_count;

char count = UART_read(uart,&mychar,1);

do

{

myfunction;

}while(count == 0);

if(my_char == 'n')

{

break;

}

Descriptiion: Here also it is stopping at UART_read function.

Note: I have declared params.readTimeout= BIOS_WAIT_FOREVER in the beginning and giving a 2 seconds timeout in this function. 

Kindly help me out.