FRDM-KW41Z

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,184件の閲覧回数
surender1896
Contributor I

Can anyone suggest me a code for sensing ADC and giving to PWM channels, I'm having an problem regarding this

ラベル(1)
0 件の賞賛
返信
1 解決策
1,119件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,119件の閲覧回数
surender1896
Contributor I

Thank you for your answer

0 件の賞賛
返信
1,120件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信