857
// Main function void main() { // Initialize UART and LEDs UART_TX_Init(); LED_Init(); // Buffer to store received data char received_data[50]; while (1) { // Transmit prompt message over UART UART_Write_Text("Please write your message and press enter \n"); // Blink LED1 to indicate waiting for data LED1 = 1; __delay_ms(500); LED1 = 0; // Receive data via UART UART_Read_Text(received_data, sizeof(received_data)); // Blink LED2 once to indicate data received LED2 = 1; __delay_ms(500); LED2 = 0; // Transmit received data back over UART with professional formatting UART_Write_Text("\r\n"); UART_Write_Text("*********************************** \r\n"); UART_Write_Text("Your message is: \n"); UART_Write_Text(received_data); UART_Write_Text("\r\n"); UART_Write_Text("********************************** \r\n"); } }