5.4 Analog and Touch
Analog-to-Digital Converter (ADC)
The PIC16F, PIC18F and PIC32CM MCUs provide ADCs that convert analog signals to digital values, supporting a range of resolutions and input channels. All ADCs offer features suitable for applications requiring sensor interfacing, analog signal monitoring, and precise measurement.
There are different variations of the ADC peripheral for specific family of devices of each architecture. These variations include the PIC16F/PIC18F’s ADCC, and PIC32CM’s Sigma-Delta ADCs (SDADC). ADCC is an enhanced ADC module that adds built-in computation features, while SDADC provides higher resolution and better noise performance for precision applications.
The following table provides a comparison of features of the PIC16F, PIC18F and PIC32CM MCUs.
| Feature | PIC16F ADC/ADCC | PIC18F ADC/ADCC/ADC3 | PIC32CM ADC/SDADC |
|---|---|---|---|
| Variants | Standard ADC ADC with Computation (ADCC) | Standard ADC ADC with Computation (ADCC) | Standard ADC Sigma-Delta ADC |
| Resolution | 8-10 bits (standard), 12 bits (ADCC) | 8-10 bits (standard), 12 bits (ADCC and ADC3, 16-bit (through decimation) | 8-12 bits (SAR), 16 bits (SDADC) |
| Input Channels | Up to 45, varies per device | Up to 45, varies per device | Up to 32, varies per device |
| Max Sampling Rate | Up to 300 ksps (typical) | Up to 1 Msps | Up to 4.5 Msps SDADC: Up to 1.5 Msps |
| Computation Features | ADCC: filtering, averaging, threshold, etc. | ADCC: filtering, averaging,
threshold, etc. ADC3: improved computation engine, faster sampling, etc. | Window comparator, Event triggers, Oversampling |
| Differential Inputs | Supported in some families | Supported in some families | Supported (SDADC) |
| Programmable Gain | Requires external op amp or FVR | Requires external op amp or FVR | Supported (SDADC) |
| Reference Options | VDD, FVR, or external VREF | VDD, FVR, or external VREF | VDD, INTREF, or external VREF |
| Internal Inputs | Varies per device family: Temp indicator, DAC output, FVR, VDDCORE, op amp | Varies per device family: Temp indicator, DAC output, FVR, VDDCORE, VBAT/2 | Varies per device family: Temperature sensor Band gap VREF DAC Scaled supplies |
| Accumulation | Up to 256 samples | Up to 256 samples | Up to 1024 samples |
| Window Comparator | Supported | Supported | Supported |
| Conversion Modes | Single, Continuous, and Double Sample (for hardware CVD) | Single, Continuous, Basic, Accumulate, Average, Burst Average, Low-Pass Filter | Single, Continuous, Pin-Scan, and Sequencing |
| Auto-Trigger/Event System | Supported (ADCC) | Supported (ADCC) | Supported (EVSYS, advanced triggering) |
| Low Power | Supported (ADCC) | Supported (ADCC, Deep Sleep ADC) | Supported (sleepwalking, event-driven) |
| Self-Calibration | Supported (ADCC) | Supported (ADCC) | Supported (auto-calibration) |
Digital-to-Analog Converter (DAC)
The PIC16F, PIC18F, and PIC32CM DAC peripherals generate analog voltages from digital values. DAC features, such as high drive capabilities, the ability to route DAC output to other internal analog peripherals (like comparators), and support for real-time analog signal generation. These DACs are suitable for applications, such as waveform generation, audio output, and analog control.
Some PIC32CM family of devices have 12-bit DAC controllers with higher speed, dual-channel, and differential output options. The table below provides a comparison of the features of the PIC16F, PIC18F, and PIC32CM MCUs.
| Feature | PIC16F DAC | PIC18F DAC | PIC32CM DAC |
|---|---|---|---|
| Resolution | 5-bit/8-bit or 10-bit | 8-bit/10-bit/12-bit | 10-bit 12-bit (16-bit with dithering) |
| Max Conversion Rate | Supports up to 300 ksps | Supports up to 300 ksps | 10-bit: Up to 350 ksps 12-bit: Up to 1 Msps |
| Number of Channels | 1-2 | 1-3 | 1-2 |
| Output Range | Rail-to-rail; typically VSS to VDD or VREF+ | GND to selected VREF, VDD, or FVR | GND to selected VREF |
| Trigger Sources | Software, Timers, or Auto-Conversion Triggers from peripherals | Software, Enable bit | Enable
bit Event-driven |
| Internal Routing | Connects to ADC, Comparators, op amps, and FVR | Routes to ADC, Comparators, and op amps | Output can be used by other analog blocks |
| Voltage Reference Options | Vdd, FVR | Vdd, FVR, external Vref | Vdd, external/internal Vref |
| Waveform Generation | Basic (manual update) | Basic (manual update, with auto-trigger) | Advanced (event system, auto-trigger) |
| Event System Integration | N/A | N/A | Supported |
| Low Power Operation | Supported | Supported | Supported (sleepwalking, event system) |
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. The following table provides a comparison of the features of the PIC16F, PIC18F, and PIC32CM MCUs.
| Feature | PIC16F CMP | PIC18F CMP | PIC32CM AC |
|---|---|---|---|
| Number of Comparators | 2-8 | 2-3 | 2–4 |
| Output on Pin | Supported | Supported | Supported |
| Input Selection | 4 external
inputs DAC FVR VSS
| 4 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 |
Voltage References (VREF)
The PIC16F, PIC18F and PIC32CM MCUs provide programmable fixed voltage references (VREF/FVR) that supply stable reference voltages to analog peripherals, such as ADCs, DACs, and ACs. The PIC16F, PIC18F, and PIC32CM VREFs are designed to enhance measurement precision, support low-power operation, and allow easy configuration of the reference source for different application needs. The following table provides a comparison of the features of the PIC16F, PIC18F and PIC32CM MCUs .
| Feature | PIC16F FVR/VREF | PIC18F FVR/VREF | PIC32CM VREF |
|---|---|---|---|
| Integration | Stand-alone FVR/VREF peripheral | Stand-alone FVR/VREF peripheral | Integrated into the Supply Controller (SUPC) peripheral |
| Reference Voltage Options | Multiple internal voltages | Multiple internal voltages | Multiple internal
voltages External VREF pin |
| Target Peripherals | ADC, DAC, Analog Comparator | ADC, DAC, Analog Comparator, HLVD, CTMU, OPA | ADC, DAC, Analog Comparator |
| Programmable Levels | 1.024V, 2.048V, and 4.096V | 1.024V, 2.048V, and 4.096V | Varies per device
family: 1–4.096V |
| Low-Power Operation | Supported | Supported | Supported |
| Configuration | Software registers | Software registers | Software registers |
| Additional Features | Stabilization ready flags (RDY/FVRRDY) | Stabilization ready flags (RDY/FVRRDY) | May include advanced supply management features |
| Output to Pin | Supported | Supported | Supported |
Operational Amplifiers (op amp)
Some PIC16F, PIC18F, and PIC32CM MCUs have integrated operational amplifier (op amp) peripherals designed for flexible, low-power analog signal conditioning. The op amp peripherals provide up to three individually configurable op amps with rail-to-rail inputs, internal resistor ladders for feedback and gain control, and a wide range of selectable configurations. The PIC16F, PIC18F, and PIC32CM op amps enable complex analog signal processing with minimal or no external components. The table below provides a comparison of the features of the PIC16F, PIC18F, and PIC32CM.
| Feature/Aspect | PIC16F OPA | PIC18F OPA | PIC32CM op amp |
|---|---|---|---|
| Number of op amps | Up to four | Up to two | Up to three |
| Input Selection | I/O pins, DAC, Basic OPA: FVR Enhanced OPA: internal resistor ladder | I/O pins, DAC, internal resistor ladder | I/O pins, DAC, ground Other op amps Internal resistor ladder |
| Output Selection | I/O pin | I/O pins, ADC, AC | I/O pins, ADC, AC Other op amps |
| Internal Resistor Ladder | Configurable for internal feedback/programmable gain | Configurable for internal feedback/programmable gain | Configurable for internal feedback/programmable gain |
| Configurations | Stand-alone Unity gain buffer Inverting/non-inverting PGA Comparator | Stand-alone Unity gain buffer Inverting/non-inverting PGA Comparator | Stand-alone Unity gain buffer Inverting/non-inverting PGA Cascaded PGAs Instrumentation amplifier Comparator with hysteresis |
| Calibration | Automatic input or adjustable input offset voltage calibration | Automatic input or adjustable input offset voltage calibration | Offset/gain measurement with ADC |
| Power Modes | Standard | Standard | Four selectable modes (speed vs. power), on-demand start-up |
| Event System Integration | N/A | N/A | On-demand start-up for ADC/AC |
| Special Features | – | Built-in hardware peak detect | Voltage doubler Programmable hysteresis |
| Low Power Operation | Supported | Supported | Supported |
| Output to Pin | Supported | Supported | Supported |
Touch Controllers
The PIC16F/PIC18F MCU provides touch support through software and hardware CVD (Capacitive Voltage Divider) in their latest families, while the PIC32CM MCU delivers advanced, hardware-accelerated touch sensing for modern, high-performance user interfaces through the Peripheral Touch Controller (PTC). The following table provides a comparison of features of the PIC16F, PIC18F, and PIC32CM.
| Feature | PIC16F ADC+CVD | PIC18F ADC+CVD | PIC32CM PTC |
|---|---|---|---|
| Self-Capacitance Buttons | Any analog I/Os | Any analog I/Os | Standard: Up to 16 Enhanced: Up to 36, mix-and-match |
| Mutual-Capacitance Buttons | Through Guard ring outputs | Through Guard ring outputs | Up to 256, mix-and-match with self capacitance |
| Driven Shield+ | Includes "Guard ring digital output drive" | Includes "Guard ring digital output drive" | Enhanced: Any X/Y line |
| Boost Mode | Supported | Supported | Supported |
| Window Monitor | Supported | Supported | Supported |
| Analog/Digital Accumulation | Supported | Supported | Supported |
| Polarity Control | Supported | Supported | Supported |
| Channel Change Delay | Selectable | Selectable | Selectable |
| Noise Filtering | Differential CVD Hardware digital filters | Differential CVD Hardware digital filters | Hardware
filtering Desynchronization Enhanced: Driven Shield |
| Auto-Calibration | Supported | Supported | Supported |
| Touch Library | MTouchTM | MTouch | QTouch® |
| Touch Types Supported | Buttons, sliders, wheels (software/PTL) | Buttons, sliders, wheels (software/PTL) | Buttons, sliders, wheels, proximity, advanced gestures |
| Low Power Operation | Supported | Supported | Supported (sleepwalking, event system integration) |
