5.4.3 Analog Comparator (AC/CMP)
Analog Comparators (AC/CMP) compare the voltage levels of two inputs and provide a digital output based on the comparison. The PIC16F, PIC18F, and PIC32CM ACs offer features suitable for zero-cross detection, threshold monitoring, and windowed analog signal analysis. Table 5-16 provides a comparison of features between PIC16F, PIC18F and PIC32CM.
| Feature | PIC16F CMP | PIC18F CMP | PIC32CM AC |
|---|---|---|---|
| Number of Comparators | 2–8 | 2, 3 | 2–4 |
| Output on Pin | Supported | Supported | Supported |
| Input Selection |
Four external inputs DAC FVR VSS |
Four external inputs DAC FVR VSS Internal ground |
Four pins (positive/negative) Ground band gap DAC AVDD scaler (64-level) |
| Internal Reference |
FVR DAC |
FVR DAC |
Band gap DAC AVDD scaler |
| Hysteresis | Selectable | Selectable | Selectable |
| Output Inversion | Supported | Supported | Supported |
| Interrupt Generation | Rising, Falling, or any edge | Rising, Falling, or any edge | Rising, falling, toggle, end of comparison Window function |
| Window Mode | N/A Through software | N/A Through ADC | Yes (window function, window interrupts/events) |
| Event Generation | Triggers ADC, Timers, or PWM shutdown (CWG) | Triggers ADC, Timers, or PWM shutdown (CWG) | Comparator output, window function (in/out) |
| Response Time | Selectable | Selectable | Selectable |
| Digital Filter | Supported for some devices | N/A | Supported |
| Output Options | Digital output, interrupt, PWM shutdown | Digital output, interrupt, PWM shutdown | Digital output, interrupt, event trigger |
| Window/Zero-Cross Detection | Supported | Supported | Supported (window mode, zero-cross, advanced) |
| Filtering/Debounce | Supported | Supported | Supported (programmable filtering) |
| Low Power Operation | Supported | Supported | Supported (sleepwalking, event-driven) |
| Interrupt on Output Change | Supported | Supported | Yes |
