48.5.5 Comparison Function on Received Character
When a comparison is performed on a received character, the result of the comparison is reported on UART_SR.CMP when UART_RHR is loaded with the new received character. The CMP flag is cleared by writing a ‘1’ to UART_CR.RSTSTA.
UART_CMPR (see UART Comparison Register) can be programmed to provide different comparison methods. These are listed below:
- If VAL1 equals VAL2, then the comparison is performed on a single value and the flag is set to 1 if the received character equals VAL1.
- If VAL1 is strictly lower than VAL2, then any value between VAL1 and VAL2 sets the CMP flag.
- If VAL1 is strictly higher than VAL2, then the flag CMP is set to 1 if either received character equals VAL1 or VAL2.
By programming CMPMODE to 1, the comparison function result triggers the start of the loading of UART_RHR (see the figure below). The trigger condition occurs as soon as the received character value matches the condition defined by the programming of VAL1, VAL2 and CMPPAR in UART_CMPR. The comparison trigger event can be restarted by writing a ‘1’ to UART_CR.REQCLR.