⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
前腿帕特尔
Offline
Last seen:2 years 5 months ago
加入:2017-03-29 10:50
Timer0 PWM0

Dear Dialog_Support,

I am using timer0 pwm0 to operate and control LED brightness using timer0_set(uint16_t pwm_on, uint16_t pwm_high, uint16_t pwm_low); function. If i give timer0_set(0xFF, 0XFF, 0) then also my LED is not getting ON fully. Then i have used timer0's PWM1 then LED should fully turn OFF when i call timer0_set(0xFF, 0xFF, 0) but my LED is not going to OFF fully. LED glows at 5-10% brightness. And if i call timer0_stop function, then LED turns OFF fully. What could be the reason?

Keywords:
Device:
MT_dialog
Offline
Last seen:1 month 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Ruchi Patel,

Hi Ruchi Patel,

The timer when operating in PWM mode will load the values TIMER0_RELOAD_N_REG and TIMER0_RELOAD_M_REG which are 16-bit values so, if you use 0xFF and 0x00 then you should generate a PWM pulse with a duty cycle small enough and a frequency in order to see the LED dimming, but if you load to the TIMER0_RELOAD_M_REG the full value of the timer 0xFFFF, then you will get a duty cycle where which will be enough in order to fully light a LED and keep the other LED connected to the PWM1 turned off. But there will be a pulse, it will just be for a fraction of time.

Thanks MT_dialog