The UART receiver functional block diagram is shown in Fig. 10-5. The heart of the receiver is the receive shift register UxRSR where a serial sequence is converted to a parallel word (9-bit word). After sampling the UxRX pin for the STOP bit, the received data in UxRSR are transferred to the receive FIFO buffer, if it is empty.
Fig. 10-5 UART receiver functional block diagram.
program Uart_Test; var text, delimiter : string; test : word; begin Uart1_Init(9600); //Initialization of UART module on 9600Kbps delimiter := 'stop'; //Delimiter is word 'stop' while TRUE do begin if Uart1_Data_Ready() = 1 then //If data are received begin Uart1_Read_Text(text, delimiter); //Only if STOP is received Uart1_Write_Text(text); //Message is returned (echo) end; end; end.