Post Go back to editing

What is the best way to change a timer frequency without stopping the timer

Thread Summary

The user asked if it's possible to adjust the timer interrupt frequency from 70 Hz to 69.5 Hz without stopping the timer, as a function of commutator speed. The engineer confirmed that the timer settings can be changed on the fly, with the new settings taking effect after a few cycles. The example provided demonstrates changing from 70 Hz to 50 Hz.
AI Generated Content

I start out using a timer set to interrupt at 70 Hz. Then I want to adjust the timer interrupt to another value around 70 like 69.5Hz. My timer will need to adjust as a function of a commutator speed. I cannot stop the timer. Can I adjust TM0PRD while it is running?

Thanks,

  • Hi ,

    Yes ,  you could change the timer settings on the fly. All you need to do is wait for few cycles for the timer to get enabled with the original timer settings and then change the timer period and width for the following cycle. The new settings take effect after the inital timer setting cycle completes. Attached is  an example that shows this. In the example I change from 70 Hz to 50 Hz.

    Hope this is useful

    Thanks,

    Divya

    TimerExample.zip

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.