Professional Documents
Culture Documents
it. Baude rate is set to 9600 bps. The program uses UART library routines UART1_init(), UART1_Write_Text(), UART1_Data_Ready(), UART1_Write() and UART1_Read().*/ char uart_rd; void main() { ANSEL = ANSELH = 0; C1ON_bit = C2ON_bit = 0; UART1_Init(9600); Delay_ms(100); UART1_Write_Text("Start"); while (1) { if (UART1_Data_Ready()) { uart_rd = UART1_Read(); UART1_Write(uart_rd); }` } } // // // // // // // // Configure AN pins as digital Disable comparators Initialize UART module at 9600 bps Wait for UART module to become stable Endless loop If data is received, read the received data, and send data back via UART