From 2833cac1a341e0cecfa03e08a42cf8d667e1a78a Mon Sep 17 00:00:00 2001 From: Sanyog Date: Tue, 29 Oct 2024 01:26:34 +0530 Subject: [PATCH] Add UART DATA receive and LED logic --- main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/main.c b/main.c index a1c914e..56a9874 100644 --- a/main.c +++ b/main.c @@ -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