14 LED PWM Controller (LEDC)
cost of a slight jitter in the duty cycle.
The channels also have the ability to automatically fade from one duty cycle value to another. This feature is
enabled by setting LEDC_DUTY_START_HSCHn. When this bit is set, the PWM controller will automatically incre-
ment or decrement the value in LEDC_DUTY_HSCHn, depending on whether the bit
set or cleared, respectively. The speed the duty cycle changes is defined as such: every time the LEDC_DUTY_CYCLE_
HSCHn
cycles, the content of
The length of the fade can be limited by setting LEDC_DUTY_NUM_HSCHn: the fade will only last that number
of cycles before finishing. A finished fade also generates an interrupt.
Figure
14-5
is an illustration of this. In this configuration, LEDC_DUTY_NUM_HSCHn_R increases by LEDC_DUTY_
SCALE_HSCHn
for every
output signal.
Notes
• When the LEDC is in fade mode, it is not supported to perform operations (e.g., pause) on the process or
configure the following registers:
–
LEDC_HPOINT_H/LSCHn
–
LEDC_DUTY_H/LSCHn
–
LEDC_DUTY_START_H/LSCHn
–
LEDC_DUTY_INC_H/LSCHn
–
LEDC_DUTY_NUM_H/LSCHn
–
LEDC_DUTY_CYCLE_H/LSCHn
–
LEDC_DUTY_SCALE_H/LSCHn
Configure the second fade only after
interrupt is generated.
• When LEDC is in decremental fade mode and
DUTY_SCALE_HSCHn
LEDC_LST IM ERx_DU T Y _RES
is 2
14.2.4 Interrupts
• LEDC_DUTY_CHNG_END_LSCHn_INT: Triggered when a fade on a low-speed channel has finished.
• LEDC_DUTY_CHNG_END_HSCHn_INT: Triggered when a fade on a high-speed channel has finished.
Espressif Systems
LEDC_DUTY_SCALE_HSCHn
Figure 14-5. Output Signal Diagram of Fading Duty Cycle
LEDC_DUTY_CYCLE_HSCHn
LEDC_DUTY_CHNG_END_HSCHn
cannot be set to 1. When LEDC is in decremental fade mode and
,
LEDC_DUTY_SCALE_LSCHn
Submit Documentation Feedback
is added to or subtracted from LEDC_DUTY_HSCHn[24..4].
clock cycles, which is reflected in the duty cycle of the
LEDC_HST IM ERx_DU T Y _RES
LEDC_DUTY_HSCHn
is 2
cannot be set to 1.
393
LEDC_DUTY_INC_HSCHn
or
LEDC_DUTY_CHNG_END_LSCHn
LEDC_DUTY_LSCHn
ESP32 TRM (Version 5.2)
is
, LEDC_
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?