This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Resetting Timers

Part Number: TM4C123GH6PM

Hello,

I currently have TIMER0 set up as a 32-bit one-shot timer, which triggers interrupts on timeout. My question is, what is the best way to reset the timer before a timeout event? I'm not sure whether TimerEnable() and TimerDisable() will do the trick, or should I use TimerLoadSet()? Also, how should the timer be reset after a timeout event? Does TimerLoadSet() need to be used every time, or only once to configure the timer?

Regards,

Ksawery

  • I ended up using TimerLoadSet() and it works as expected.

  • Calling TimerDisable() and then TimerEnable() again will restart the one-shot timer. (It will clear and then set again the TnEN bit of GPTMCTL register which will cause the counter to reload (if counting down) or restart from zero (if counting up). In one-shot mode the TnEN bit is cleared automatically when the timeout period is reached. To restart with the same period, you just need to call TimerEnable() again.