Add UART DATA receive and LED logic

This commit is contained in:
Sanyog Nevase Nevase 2024-10-29 01:26:34 +05:30
parent 82b84be2c2
commit 2833cac1a3
1 changed files with 26 additions and 0 deletions

26
main.c
View File

@ -50,6 +50,32 @@ char UART1_READ(void) // UART1 READ DATA
return (char)UART1_DR_R; // RETURN RECEIVED DATA
}
void UART1_RXTX_to_DISPLAY(char RX_DATA)
{
if (RX_DATA == 0x52)
{
GPIO_PORTF_DATA_R |= 0x02; // IF RECEIVED CHARACTER IS R TURN ON RED LED
}
else if (RX_DATA == 0x42)
{
GPIO_PORTF_DATA_R |= 0x04; // IF RECEIVED CHARACTER IS B TURN ON BLUE LED
}
else if (RX_DATA == 0x47)
{
GPIO_PORTF_DATA_R |= 0x08; // IF RECEIVED CHARACTER IS G TURN ON GREEN LED
}
else
{
GPIO_PORTF_DATA_R &= 0x00; // RED LED FOR JUNK DATA
}
}
int main(void) // MAIN FUNCTION