AnsweredAssumed Answered

Fail to send a string via UART to the Terminal with KE06

Question asked by Marco Aurelio P. Coelho on Sep 17, 2015
Latest reply on Sep 18, 2015 by Mark Butcher

Hello,

 

I'm facing such a strange issue when I send a string to the Terminal. I'm using FRDM_KE06Z to perform the tests. I did something very simple in KDS. Acording to the character typed on the Terminal and received by UART Receive Buffer interrupt, I print a message back on the Terminal. That is my code:

 

void envia_string(byte *dado_string){

  for(x=0;x<strlen(dado_string);x++){

  if(UART1_S1&UART_S1_TDRE_MASK)

     UART1_D=dado_string[x];

     while(UART1_S1&UART_S1_TC_MASK==0){}

     }

}

 

 

int main(void)

 

{

 

  PE_low_level_init();

 

 

  for(;;){

 

   if(dado_recebido=='1'){

 

  envia_string("You typed 1\r\n");

  dado_recebido=0;

   }

 

   if(dado_recebido=='2'){

 

   envia_string("You typed 2\r\n");

  dado_recebido=0;

    }

 

   if(dado_recebido=='3'){

 

   envia_string("You typed 3\r\n");

  dado_recebido=0;

    }

 

When I put it to run, only the first letter or some letters are printed on the Terminal. If I run "envia_string" function step by step on Debugger, it prints all the messages correctly. I'm very confused about that.

 

Can anybody help me on it, please?

 

 

Thanks!

 

 

Marco Coelho

Outcomes