Determining which LPC triggered an interrupt

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

cross mob
Anonymous
Not applicable

OK, so this might seem like a pretty basic level question, but I'm a bit of a newbie.

   

I have two Low Power Comparators in my design, and in order for these to kick my CPU out of DeepSleep, have these linked to a Global Signal component configured with a combined Low Power Comparator interrupt.

   

Where I'm having trouble is in determining which of the two LPC's has triggered the interrupt so that I can direct my ISR code to undertake the appropriate task.

   

I thought a simple "if" statement, using the GetInterruptSource() API, but I'm not actually sure what this API returns and so I'm not sure how to check it and see which of the two LPC's has triggered my interrupt.

   

Can anyone help me understand how to go about this?  I may not actually be approaching this from the correct angle, so if you're sitting here reading this thinking "hmmm, you're making life difficult for yourself there pal!", feel free to gently steer me in the correct direction

   

Cheers,

   

Mike

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

Looks like

   

Value = LP1Comp_GetInterruptSource();

   

if (Value & LP1Comp_INTR) LPC1_Triggered();

   

if (Value & LP2Comp_INTR) LPC2_Triggered();

   

 

   

or

   

Query each of the LPCs with LPComp_GetCompare() to see if it did trigger.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks Bob - all working now!

   

Cheers,

   

Mike

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

Great! 😉

   

 

   

Bob

0 Likes