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
706 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
678 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
694 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
687 Views
Shrini
Contributor I
Hello @VaneB, I am thinking to do this task using API's not in register level coding.
0 Kudos
679 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Shrini 

SDK: FTM_DRV_UpdatePwmChannel

RTD: Ftm_Pwm_Ip_UpdatePwmChannel

MCAL: Pwm_SetDutyCycle

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