AnsweredAssumed Answered

Controlling a Servo Motor with PWM - FRDM-KL43Z

Question asked by José Baretta on May 15, 2019
Latest reply on May 16, 2019 by José Baretta

So, basically, I'm trying to control a servo motor which pulse have 20ms, like the picture below:

Micro Servo 9g


I setup my PWM to 50 Hz, but when I'm updating the duty cycle (with the function TPM_UpdatePwmDutycycle), I can only work with percent changes, which give me like 10 differents angles (from varying the duty cycle from 1% to 10%, because 2 ms equals to 10% of the pulse), since the function expects an integer parameter.


void TPM_UpdatePwmDutycycle(TPM_Type *base, tpm_chnl_t chnlNumber, tpm_pwm_mode_t currentPwmMode, uint8_t dutyCyclePercent)


How can I work around it?