33.5.7 Threshold Comparison
At the end of each computation:
- The conversion results are latched and held stable at the end-of-conversion.
- The error (ADERR33.7.19 ADERR) is calculated based on a difference calculation which is selected by
the ADCALC bits. The value can be one of the following calculations
(see Table 33-6 for more details):
- The first derivative of single measurements
- The CVD result when double-sampling is enabled
- The current result vs. a setpoint
- The current result vs. the filtered/average result
- The first derivative of the filtered/average value
- Filtered/average value vs. a setpoint
- The result of the calculation (ADERR) is compared to the upper
and lower thresholds, ADUTH33.7.21 ADUTH and ADLTH33.7.20 ADLTH registers, to set the ADUTHR and
ADLTHR
flag bits. The threshold logic is selected by ADTMD bits.
The threshold trigger option can be one of the following:
- Never interrupt
- Error is less than lower threshold
- Error is greater than or equal to lower threshold
- Error is between thresholds (inclusive)
- Error is outside of thresholds
- Error is less than or equal to upper threshold
- Error is greater than upper threshold
- Always interrupt regardless of threshold test results
- If the threshold condition is met, the threshold interrupt flag ADTIF is set.
Note:
- The threshold tests are signed operations.
- If ADAOV is set, a threshold interrupt is signaled. It is good practice for threshold interrupt handlers to verify the validity of the threshold by checking ADAOV.
ADCALC | ADERR | Application | |
---|---|---|---|
ADDSEN = 0 Single-Sample Mode | ADDSEN = 1 CVD Double-Sample Mode(1) | ||
111 |
ADFLTR | ADFLTR | Filtered results above or below the threshold. |
110 |
ADRES | ADRES | Measurement above or below the threshold |
101 |
ADLFTR-ADSTPT | ADFLTR-ADSTPT | Average/filtered value vs. setpoint |
100 |
ADPREV-ADFLTR | ADPREV-ADFLTR | First derivative of filtered value(3) (negative) |
011 |
Reserved | Reserved | Reserved |
010 |
ADRES-ADFLTR | (ADRES-ADPREV)-ADFLTR | Actual result vs. averaged/filtered value |
001 |
ADRES-ADSTPT | (ADRES-ADPREV)-ADSTPT | Actual result vs.setpoint |
000 |
ADRES-ADPREV | ADRES-ADPREV | First derivative of single measurement(2) |
Actual CVD result(1,2) | |||
Note:
|