Setoffsetticks() function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Setoffsetticks() function

跳至解决方案
598 次查看
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?

标签 (1)
0 项奖励
1 解答
367 次查看
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 项奖励
1 回复
368 次查看
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 项奖励