Dear Sir,
My project is if a received character on the RX5 pin of UART5 module is ‘A’, LED will turn on and if the received message is ‘B’, LED will turn off. For any other character, LED will retain its current state.
But I have a problem when a character is received via uart using this api (MAP_UARTCharGetNonBlocking(UART0_BASE);) , which is return int32_t value. How can I get character ? Which I type in terminal like A.
void UARTIntHandler(void)
{
uint32_t ui32Status;
int32_t data,A;
//
// Get the interrrupt status.
//
ui32Status = MAP_UARTIntStatus(UART0_BASE, true);
//
// Clear the asserted interrupts.
//
MAP_UARTIntClear(UART0_BASE, ui32Status);
//
// Loop while there are characters in the receive FIFO.
//
while(MAP_UARTCharsAvail(UART0_BASE))
{
//
// Read the next character from the UART and write it back to the UART.
//
data = MAP_UARTCharGetNonBlocking(UART0_BASE);
if(A==data)
{
MAP_UARTCharPutNonBlocking(UART0_BASE,
data );
MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0);
}
// MAP_UARTCharPutNonBlocking(UART0_BASE,
// data );
//
// Blink the LED to show a character transfer is occuring.
//
// MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0);
//
// Delay for 1 millisecond. Each SysCtlDelay is about 3 clocks.
//
//SysCtlDelay(g_ui32SysClock / (1000 * 3));
//
// Turn off the LED
//
else MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0);
}
}