Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Interrupts using Variable values???

Status
Not open for further replies.

Jigar 4 Electronics

Full Member level 5
Joined
Apr 28, 2011
Messages
312
Helped
40
Reputation
82
Reaction score
38
Trophy points
1,318
Location
Hamilton, ON, Canada
Activity points
3,368
Hello All,

I am using LM4F120 Stellaris Launchpad.

Though this question is not related strictly to this only controller, I want to ask to solve my query which has been born while using this controller!

I am programming my logic and I need a strategy to active a software interrupt when the value of the particular variable is get exceeded by predefined threshold value.

Is it possible?? And when the value is get lower down to that threshold value the interrupt should be disable.

For ex. Variable name is flag

Threshold value Th = 200;

Whenever Flag is more than 200 the interrupt should be active (for ex a timer interrupt have a load value of 1 ms)

& whenever Flag gets lesser then 200 the interrupt should be disable.

Please guide me to develop such logic.

Thanks a lot for your help.
 

I dont whether this will help you or not.

Just set the flag of the interrupt you want to enable, when your condition satisfied.
That will work i think??? o_O
 

Thank you for your answer.

But can't we trigger the interrupt without checking the variable values??? my question was whenever the value goes higher than threshold it should be trigger the interrupt. I don't want to check it all the time...
 

When value of your threshold variable is equal to 200 then start the timer interrupt (or other interrupt) by enabling the timer and when value of threshold variable is < 200 disable the timer.
 

Thank you for your answer Jayanthji,
I'll implement it for sure. Actually I want to do this same task with minimum time. So I am gathering all possible ways to do it... And then I'll check which process is using minimum time and then I'll go for it. Any other method if you/anyone can mention then it'll also be helpful to me.
 

How does the variable value get changed? That is the time to test it's value. I do not see how it is related to interrupts - you simply test the value and call the desired function based on the result.

Keith
 

Jigar, as a variation on the post of jayanth, start the timer and check the variable during the timer interrupt routine. If you need to act on it, use a subroutine. If the sub is longer than the timer interrupt period, then set a flag so you won't go into the subroutine again.
 

okay I get the solution ... Thanks you all for your help :)
without your suggestions this could not be solved :)
once again thanks for your time.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top