Control LEDs with Pulse-Width Modulation (PWM)

There are multiple ways to generate Pulse-Width Modulation (PWM) control signals to control power circuits such as an LED driver.

  • Devices with the Capture-Compare-PWM (CCP) module can generate PWM signals to control power circuits using an on-chip digital timebase. The signal pulse width is controlled by the MCU clock and duty cycle register.
  • The Enhanced CCP (ECCP) module allows one PWM signal to control two or four output pins for half-bridge or H-bridge control, respectively.
  • Devices that have a comparator and the ECCP module can use the comparator signal to control the turn-off time of the PWM signal.
  • Devices with comparators and a PWM Switched Reluctance (SR) latch can use comparator signals and/or clock pulses to turn the latch output on and off.
  • An external PWM peripheral Integrated Circuit (IC) may be used. This option is useful when additional high speed PWM channels are required.
  • PWM signals can be generated using software and I/O pins. This option is less costly when PWM frequency and duty cycle resolution requirements are not too high. A PIC® microcontroller with an on-chip comparator such as the PIC12F609 can be used to implement a simple LED driver. The PIC12HV609 has an internal regulator, allowing operation from a Direct Current (DC) bus that is higher than 5 V.

8-, 14-, and 20-Pin PIC® Microcontroller Mixed Signal Features

Device Pins Voltage Reference Comparator Op Amps ADC Digital PWM Module PWM SR Latch
PIC12F609/PIC12HV609 8 1
PIC12F615/PIC12HV615 8 1 10-bit 1
PIC12F1822 8 Yes 1 10-bit 1 1
PIC16F610/PIC12HV610 14 2 1
PIC16F616/PIC16HV616 14 2 10-bit 1 1
PIC16F785/PIC16HV785 20 Yes 2 2 10-bit 1 2
PIC16F1828 20 Yes 2 10-bit 4 1

HV part numbers have internal shunt voltage regulator.

Buck LED Driver Using a PIC12HV615 On-Chip Comparator


RGB Color LED Application Using PIC12HV615

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.