ZHCSJ02A november 2018 – august 2020 DRV5057
PRODUCTION DATA
Many microcontrollers have a capture and compare timer mode that can simplify the PWM decoding process. Use the timer in capture and compare mode with an interrupt that triggers on both the rising and falling edges of the signal to obtain both the relative high (on) and low (off) time of the PWM. Make sure that the timer period is significantly faster than the period of the PWM, based on the desired resolution. Calculate the percent duty cycle (%D) of the PWM with Equation 1 by using the relative on and off time of the signal.