Add UART DATA receive and LED logic
This commit is contained in:
parent
82b84be2c2
commit
2833cac1a3
26
main.c
26
main.c
|
@ -50,6 +50,32 @@ char UART1_READ(void) // UART1 READ DATA
|
||||||
return (char)UART1_DR_R; // RETURN RECEIVED 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
|
int main(void) // MAIN FUNCTION
|
||||||
|
|
Loading…
Reference in New Issue