Design tip: To improve touch sensitivity, the sensor wiring on the PCB should be as short as possible, laid around the ground, and a series resistor should be used to limit the charging current.
4.2 10 bit ADC and comparator
ADC: Conversion speed can reach 50 ksps, with multiple positive reference voltage options (internal FVR, external VREF, VDD). In battery powered applications, internal 1.024V or 2.048V fixed references can be used to avoid VDD fluctuations affecting measurements.
Comparator: rail to rail input, output with programmable SR latch. The latch mode can construct simple hysteresis comparators or edge triggered interrupts, suitable for overcurrent protection, zero crossing detection, and other occasions.

Motor and lighting control: flexible PWM array
The PIC16F182X series offers up to 4 independent time base PWM modules (extended from standard CCP/ECCP). This means:
It can simultaneously control multiple outputs of different frequencies, such as one for LED dimming (high frequency, small duty cycle variation) and the other for DC motor speed control (low frequency, large torque range).
Each PWM module has independent cycle registers and duty cycle registers, supporting edge alignment or center alignment modes.
Combined with on-chip comparator, cycle by cycle current limitation can be constructed to protect power devices.
Application scenarios: CNC lighting (generating multiple PWM dimming after DMX decoding), six step commutation of three-phase BLDC motors (requiring external logic or the use of multiple PWM outputs).
Quick selection checklist: Quickly locate the best model
This series is divided into three sub families based on the number of pins, sharing the same peripheral framework. The main differences lie in storage capacity and the number of communication interfaces.
Model Pin Flash RAM EEPROM Featured Peripherals
PIC12F1822 8 3.5 KB 128 B 256 B 1×SPI/I2C, 4×PWM
PIC12F1840 8 7 KB 256 B 256 B Same as above, larger storage
PIC16F1823/4/5 14 3.5/7/14 KB 128/256/1024 B 256 B 8 touch channels, 2 comparators
PIC16F1826/7/47 18 3.5/7/14 KB 128/256/1024 B 256 B Dual MSSP, 2 × CCP, 12 touch channels
PIC16F1828/9 20 7/14 KB 256/1024 B 256 B up to 18 I/O, dual MSSP (only 1829)
Selection suggestion:
Only requiring simple I/O control and low power consumption, choose the 8-pin PIC12F1822.
Requires touch buttons and a lot of I/O, choose the 14 pin PIC16F1825 (14KB Flash, the most cost-effective).
It is necessary to mount both the I ² C sensor and SPI display screen simultaneously, and require dual buses. Choose the 18/20 pin dual MSSP model (such as PIC16F1847).
Development Tools and Ecology: Starting from Zero Cost
Microchip provides a complete development chain for the PIC1XF182X series with an extremely low entry-level cost:
Integrated Development Environment: Free MPLAB X IDE, supporting cross platform (Windows/Linux/macOS).
Compiler: Built in free HI-TECH C Lite compiler, with optimization levels sufficient to meet most applications. If higher code density is required, it can be upgraded to the standard or Pro version.
Debugging and programming: All devices support online debugging without the need for additional debugging heads. Simply connect PICkit 3 (DV164131) or MPLAB ICD 3 (DV164035) to program and step debug through the ICSP interface.
Development board:
PICDEM Lab Development Board (DM163035): Supports all 182X series, onboard potentiometers LED、 Button and breadboard area, suitable for rapid prototyping.
PICkit 18 pin demo board (DM164120-4): For 18 pin DIP packaging, direct plug and unplug testing.
Common problem: When programming with low voltage (such as VDD=3.3V), it is necessary to ensure that the programmer can provide sufficient voltage (PICkit 3 can output 3.3V or 5V). If the target board is powered by a battery, it is recommended to disconnect the battery during programming and have the programmer provide power to avoid voltage conflicts.
Typical application traps and avoidance
Based on the analysis of the data manual and errata for this series, engineers need to pay attention to the following points in actual development:
Sleep wake-up time: It takes approximately 3-5 clock cycles (with internal oscillator enabled) to wake up from sleep mode and execute the first instruction. If an external crystal oscillator is used, the wake-up time includes the oscillator start-up time, which may last for several milliseconds. High real-time wake-up requires the use of an internal oscillator.
ADC reference voltage: When selecting internal FVR (fixed voltage reference) as the ADC reference, the FVR module must be stably started before ADC sampling. The standard practice is to enable FVR in ADCON1 and insert a delay of at least 50 µ s before starting the conversion.
Capacitive touch PCB layout: The sensitivity of touch buttons is affected by parasitic capacitance. The key wiring should be kept away from high-frequency signals (such as SPI clock), and the reference capacitance of each touch channel (CSM module requires external Cref) should be ensured to have an accuracy of at least 5%.
Output polarity of data signal modulator: The output polarity of DSM can be configured, but it should be noted that in ASK modulation, if both the carrier and modulation signals are high and effective, the output may be constant high. It is usually necessary to invert the modulation signal or adjust the logic mode to obtain the correct envelope waveform.