Control LEDs with 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 2 or 4 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 SR latch can use comparator signals and/or clock pulses to turn the latch output on and off.
- An external PWM peripheral 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 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|
‘HV’ part numbers have internal shunt voltage regulator.