Can anyone suggest me a code for sensing ADC and giving to PWM channels, I'm having an problem regarding this
Solved! Go to Solution.
Hi surender elumalai,
Seems that you want to update PWM duty cycle according to the ADC value.
You don't need to initialize pwm(pwm_init) every time, The pwm_init only need to run one time in main function.
What you need to do is just update the duty cycle in ADC16_SE4_IRQ_HANDLER_FUNC.
TPM_UpdatePwmDutycycle can be use to achieve it.
For example:
TPM_UpdatePwmDutycycle(BOARD_TPM_BASEADDR, BOARD_TPM_CHANNEL_PAIR, kTPM_CombinedPwm, updatedDutycycle);
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for your answer
Hi surender elumalai,
Seems that you want to update PWM duty cycle according to the ADC value.
You don't need to initialize pwm(pwm_init) every time, The pwm_init only need to run one time in main function.
What you need to do is just update the duty cycle in ADC16_SE4_IRQ_HANDLER_FUNC.
TPM_UpdatePwmDutycycle can be use to achieve it.
For example:
TPM_UpdatePwmDutycycle(BOARD_TPM_BASEADDR, BOARD_TPM_CHANNEL_PAIR, kTPM_CombinedPwm, updatedDutycycle);
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------