AnsweredAssumed Answered

console_get_command(received_cmd) can't quit.

Question asked by hpkamen on May 11, 2016
Latest reply on May 23, 2016 by CsomI

Dear Sir/Madam,

 

Platform:       Zedboard+FMCOMMS3-EBZ

 

 

NO_OS

 

I have tested with this code:

 

void console_get_command(char* command)

{

    unsigned char t=0;

  char  received_char = 0;

  unsigned char char_number = 0;

 

  while((received_char != '\n') && (received_char != '\r') && (t<50))

  {

    t++;

   uart_read_char(&received_char);

   command[char_number++] = received_char;

  }

}

 

what i found is that it can't quit,if i don't send '\n' or '\r'

 

but when i shield like this.

//uart_read_char(&received_char);

 

it can quit when i do nothing with the usart.

 

now my problem is that i want to use the usart when i send sth. if i do not, it can quit rather than sinking into a while.

 

sorry for my poor English.

 

Can anyone help me ?

 

thank you.

Outcomes