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.

SW-EK-TM4C129EXL: EK-TM4C129EXL

Part Number: SW-EK-TM4C129EXL

Hi everyone,

How can I an array element is pass through UARTCharPutNonBlocking API. My code like that

int main(void)
{

int i=6;
unsigned int a[6]={17,03,02,45,37,45};

MB_Port();
while(i !=0)
{
ROM_UARTCharPutNonBlocking(UART2_BASE,a[i]);
i--;
}


}

Actually I want send a data stream (17,03,02,45,37,45) through uart with a delay of 10ms . How can I resolved the problem?

Thanks 

Imtiaj

  • Hi,

      If you want to use UARTCharPutNonBlocking you must check the return value to make sure there is space available in the FIFO and retry the operation. See below. You can also use the UARTCharPut instead where the API will wait until there is space available in the FIFO before returning. As far as 10ms delay, the easiest way is to add a software delay by calling SysCtlDelay() or you can use a timer module configured with 10ms. When the timer timesout, it sets a flag in the ISR. In your loop to send the UART, you wait for the flag to set before sending the next character. After the flag is set, you clear the flag so you can repeat the process.