已回答假定已回答

console_get_command(received_cmd) can't quit.

xiaojianxia 在 2016-5-6 詢問的問題
最後回覆由hpkamen於2016-5-12提供

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.

結果