Timer Continuous TC Interrupt only triggered once

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I am trying to set up a periodic interrupt using the Timer 2.7 module. But I see that the interrupt is only triggered once ever.

   

I tried the same setup with the TCPWM module, and the periodic interrupt works fine.

   

The only difference in firmware that I see is the clearing of interrupt flag with TCPWM implementation. But Timer's datasheet says that interrupt is cleared automatically with this module, and there is no software interface to clear the interrupt either.

   

Could anyone give me an idea why the Timer module is not working the way I expect it to?

   

Edit 1: Update with Workspace Bundle as requested.

0 Likes
1 Solution
Anonymous
Not applicable

Hi,

   

I must have changed the Timer mode to "One-shot (halt on interrupt)" while tweaking things around figuring out why the initial setup did not work. I meant to use Continuous. Sorry about that.

   

Regarding the having to read the Status Register, I admit only wentthrough the datasheet anywhere it says "Interrupt." It never occurred to me that the interrupt is tied to the TC flag, which being cleared requires reading the Status Register.

   

It works now. Thank you,

View solution in original post

0 Likes
4 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum!

   

Can you please post your complete project (that one that doesn't work as expected), so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

I upload the project, Bob. I forgot to make a minimal bundle and made a complete one.. I hope that is not a big issue since the bundle is only 2MB even after all that.

0 Likes
Anonymous
Not applicable

I tested you project and suggest the following changes:

   

1) Change the 'Run mode' to 'Continuous'. In the project attached, it is 'One Shot(halt on Interrupt)'.

   

2) Include this line in the ISR:

   

TIMER1_STATUS;

   

This basically reads the status register of the Timer. If you read the datasheet carefully, you will see that the interrupt on TC is "sticky". So you have to read the Status register in order to clear the sticky Terminal Count (TC) bit in the status register.

0 Likes
Anonymous
Not applicable

Hi,

   

I must have changed the Timer mode to "One-shot (halt on interrupt)" while tweaking things around figuring out why the initial setup did not work. I meant to use Continuous. Sorry about that.

   

Regarding the having to read the Status Register, I admit only wentthrough the datasheet anywhere it says "Interrupt." It never occurred to me that the interrupt is tied to the TC flag, which being cleared requires reading the Status Register.

   

It works now. Thank you,

0 Likes