CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

1 interrupt different alerts

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
global



Joined: 01 Feb 2005
Posts: 21
Location: Paris

View user's profile Send private message

1 interrupt different alerts
PostPosted: Wed May 11, 2005 8:40 am     Reply with quote

Hello,

i want to use one interrupt, but that makes possible to check if it comes from an alert or another. I would like the interrupt to be different depending on which alert was setted.

It should be something pretty much like this :

Code:

#INT_EXT
ext_isr()
{
if (alert1) output_highe(LED_1);
if (alert2) output_highe(LED_2);
if (alert3) output_highe(LED_3);
}


How could i do to track if i setted the interrupt of alert1 so execute what i should do for alert1 in the interrupt ?

Should i put a variable like alert1 = 1 when setting up interrupt and then alert1 =0 when the interrupt is done ?
Ttelmah
Guest







PostPosted: Wed May 11, 2005 9:04 am     Reply with quote

INT_EXT, is a single pin, so you can't have different interrupts from it, but what you can do, is implement a small piece of external logic, to generate the signals. Wha you need would depend on the nature of the signals (can they happen together, or only one at a time, what is the polarity etc.), but if (for instance), the signals are 'unique', then you could have an 'or' gate (assuming the signals are +ve logic), whose output feeds the interrupt pin, and then have the signals presented via a multiplexer to allow you to detect which one has occured.
Why not use the portB interrupt on change feature though?. This supports up to four pins, that will generate an interrupt if any one changes. You only then need to read the pins, look at which one has changed, and branch to the required code. This is built for this type of application...

Best Wishes
global



Joined: 01 Feb 2005
Posts: 21
Location: Paris

View user's profile Send private message

PostPosted: Wed May 11, 2005 9:12 am     Reply with quote

Thank you for your response.

I use an alarm on a DS1306 that generate an interrupt when i set an alarm on it.

For example, i take time now and then add 10 minutes. So the interrupt will be generated 10 minutes later.

I use only one alarm so on interrupt pin to seeif these 10 minutes are reached.

The problem is that i use this alarm of 10 minutes for different situations.

For example, i have sensors, if one sensor is up for 10 minutes it sets the interrupt.

The trouble is i would like to use it for different sensor for example, and if it is another sensor, i want to be able to know of which sensor it is because depending on this, i have different tasks ...

So i only have one interrupt but i'd like to know which one it is.

Is it more clearer ?
Ttelmah
Guest







PostPosted: Wed May 11, 2005 9:43 am     Reply with quote

So, how can you detect which device is involved?. If there is a signal wire from the device, connect this to another pin, poll this input inside the interrupt handler, and use this to determine what you do.

Best Wishes
global



Joined: 01 Feb 2005
Posts: 21
Location: Paris

View user's profile Send private message

PostPosted: Wed May 11, 2005 9:45 am     Reply with quote

Quote:
So, how can you detect which device is involved?

That was my question Wink

Anyway i'll find out !

Thanks for your help !
Propositions are welcome. Idea Question
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group