Any way to vary the duty cycle in the runtime? And also LED Brightness?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Any way to vary the duty cycle in the runtime? And also LED Brightness?

Jump to solution
622 Views
Shrini
Contributor I

I want to vary the duty cycle in the run time. So that I can observe the pwm signal. And also want to change the LED brightness using potentiometer. Is it possible to do in the s32ds using s32k144 board? 

0 Kudos
1 Solution
594 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Shrini 

SDK: FTM_DRV_UpdatePwmChannel

RTD: Ftm_Pwm_Ip_UpdatePwmChannel

MCAL: Pwm_SetDutyCycle

View solution in original post

0 Kudos
4 Replies
610 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Shrini 

Yes, it is possible to change the duty cycle of a PWM. You need to change the value of the CnV register
FTM_->CONTROLS[channel].CnV= value;
I suggest you look at the included examples on the SDK/RTD or in the S32K1xx Series Cookbook.

 

B.R.

VaneB

0 Kudos
603 Views
Shrini
Contributor I
Hello @VaneB, I am thinking to do this task using API's not in register level coding.
0 Kudos
595 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Shrini 

SDK: FTM_DRV_UpdatePwmChannel

RTD: Ftm_Pwm_Ip_UpdatePwmChannel

MCAL: Pwm_SetDutyCycle

0 Kudos
586 Views
Shrini
Contributor I
Thank you @VaneB
0 Kudos