From 3ab1c54fad467e93181b3878aefa2ead89192e0b Mon Sep 17 00:00:00 2001 From: Vikram Rajput Date: Tue, 29 Oct 2024 00:56:10 +0530 Subject: [PATCH] Code for UART 7 write --- main.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index e12522e..89f3f7a 100644 --- a/main.c +++ b/main.c @@ -50,12 +50,21 @@ void UART7_init(void) } -char UART0_Read(void) { +char UART0_Read(void) + { + while((UART0_FR_R & 0x10) != 0); // Wait until RXFE is 0 (receive FIFO not empty) return UART0_DR_R & 0xFF; // Read the received character -} - - + + } + +void UART0_Write(char data) + { + + while((UART0_FR_R & 0x20) != 0); // Wait until TXFF is 0 (transmit FIFO not full) + UART0_DR_R = data; // Transmit the data + + }