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.

Instructions getting skipped in Loop

Other Parts Discussed in Thread: TM4C129XNCZAD

Hello Experts,

I am using TM4C129XNCZAD micro-controller, I have to send data in packets of 20 bytes and data bytes must follow some hard-coded macro such as 0xFF05. So, I have written a code which looks some thing like this

Cmd_Length = Int_length;
 while(Cmd_Length != 0)
 {
   if(Cmd_Length > p_len)
   {
     while((GPIO_PORTM_DATA_R & 0x80) == 0);  //Check for pin to go low
     UARTSend(HANDLE_WS_UPGRADE_DATA,2);
     UARTSend(p_len,1);
     UARTSend(0x000000,3);
     for(ui32Loop = 0; ui32Loop < 20; ui32Loop++)
     {
           UARTCharPut(UART0_BASE,*q++);//(Local_Buffer[ui32Loop],1);
      }
    }
    else
    {
        while((GPIO_PORTM_DATA_R & 0x80) == 0);  
        UARTSend(HANDLE_WS_UPGRADE_DATA,2);
        UARTSend(Cmd_Length,1);
        UARTSend(0x000000,3);
        for(ui32Loop = 0; ui32Loop < Cmd_Length; ui32Loop++)
        {
        UARTCharPut(UART0_BASE,*q++);//(Local_Buffer[ui32Loop],1);
        for(i=0; i<9000000; i++)
        {
         }
        }
         Cmd_Length = 20;

} Cmd_Length = (Cmd_Length - p_len);

}

In this code the three lines highlighted above are skipped after first itretion of the loop.

please anyone suggest any solution!!!