Setoffsetticks() function

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

Setoffsetticks() function

Jump to solution
584 Views
alissonporto
Contributor III

I'm trying to use a timer do dim the RGB Led. I have configured the timer TU1, but the function Setoffsetticks() doesn't work.I know the counter is working because if I change the offset parameter in the initial configuration, the LED becomes more or less bright. help3.PNG.png

Could someone please help me?

Labels (1)
0 Kudos
1 Solution
353 Views
marek_neuzil
NXP Employee
NXP Employee

Hello,

If you want to dim a LED (or an RGB LED) you must change duty of the signal (the change of signal frequency with the same duty will not have any effect). Therefore I recommend that you should use the PWM (or PWM_LDD component) to dim the LED. This component also use timer module but it allows runtime changing of the signal duty (use one of the SetDutyXXXXX or SetRatioXX methods).If you want to drive an RGB LED you can add three PWM components into your project and share the same FTM device (three channels of a FTM device). You must select three channels of the same FTM device in each PWM component and set the same period of the signal. Duty can be driven independently for each channel.

PWM_RGB_LED.png


You can also find additional details about PWM on the page http://mcuoneclipse.com/2013/03/16/pwm-for-processor-expert-explained/

Best Regards,

Marek Neuzil

View solution in original post

0 Kudos
1 Reply
354 Views
marek_neuzil
NXP Employee
NXP Employee

Hello,

If you want to dim a LED (or an RGB LED) you must change duty of the signal (the change of signal frequency with the same duty will not have any effect). Therefore I recommend that you should use the PWM (or PWM_LDD component) to dim the LED. This component also use timer module but it allows runtime changing of the signal duty (use one of the SetDutyXXXXX or SetRatioXX methods).If you want to drive an RGB LED you can add three PWM components into your project and share the same FTM device (three channels of a FTM device). You must select three channels of the same FTM device in each PWM component and set the same period of the signal. Duty can be driven independently for each channel.

PWM_RGB_LED.png


You can also find additional details about PWM on the page http://mcuoneclipse.com/2013/03/16/pwm-for-processor-expert-explained/

Best Regards,

Marek Neuzil

0 Kudos