Reseting timer interrupt by disabling and enabling.

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

Reseting timer interrupt by disabling and enabling.

958 Views
kaustubhkagalka
Contributor II

Hi,

I am working on MK24FN1M0VDC12 MCU, and using Timer Interrupt for 8ms periodic interrupt. I need to sync this interrupt with an external trigger. I read from the K24 Sub-Family Reference Manual pg no 1050, that, to reset the timer, enabling and disabling the interrupt is required. I am using following function calls as follows.

if (TI1_Disable() != ERR_OK) {

         static int err1 = 0;

         err1++;

}

if (TI1_Enable() != ERR_OK) {

          static int err = 0;

          err++;

}

When these lines are executed the interrupt is completely disabled, and I never the periodic interrupt after that.

Labels (1)
0 Kudos
4 Replies

775 Views
kaustubhkagalka
Contributor II

Sorry to be hasteful, I found a code in my bug, I was perpetually resetting the interrupt timer, and hence was not receiving the interrupt. Disabling and enabling the timer component works fine.

Thanks for your support.

0 Kudos

775 Views
kaustubhkagalka
Contributor II

Hi,

I want to reset the timer count, but periodic interrupt would be permanently disabled after calling TI1_Disable(), even after using TI1_Enable() after that.

So for ex. if a periodic 8ms interrupt is scheduled to come at 8ms,16ms ,24 ms and so on. At time 27ms I wish to reset the timer so the next interrupt comes at (27+ 8 ) 35 ms.

I am sharing the project here, most of the logic is in the file Task1.c.

Also, I am trying to find a way to share my project or send you a zipped folder but I cant find a way to do that.

Kaustubh

0 Kudos

775 Views
kaustubhkagalka
Contributor II

Please ignore this sentence

"I am sharing the project here, most of the logic is in the file Task1.c."  in  the last comment. :smileyhappy:

0 Kudos

775 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Kaustubh Kagalkar,

Do you mean that the PIT periodic interrupt would become disable after disable and reable operation? And I was wonder if you can share the whole the demo.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos