diff --git a/main.c b/main.c index dfa31af..a1c914e 100644 --- a/main.c +++ b/main.c @@ -38,6 +38,20 @@ void GPIO_PORT_B_init(void) UART1_CTL_R |= 0x301; // ENABLE UART1, RX AND TX } +void UART1_WRITE(char data) // UART1 WRITE DATA +{ + while (UART1_FR_R & 0x20); // WAIT UNTIL TX FIFO IS NOT FULL + UART1_DR_R = data; // WRITE DATA TO UART DATA REGISTER +} + +char UART1_READ(void) // UART1 READ DATA +{ + while (UART1_FR_R & 0x10); // WAIT UNTIL RX FIFO IS NOT EMPTY + return (char)UART1_DR_R; // RETURN RECEIVED DATA +} + + + int main(void) // MAIN FUNCTION { GPIO_PORT_F_init(); // GPIO PORT F INITIALISATION FUNCTION @@ -46,4 +60,4 @@ int main(void) // MAIN FUNCTION while (1) { -} \ No newline at end of file +}