Disable interrupt while interrupt is running?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
markus747
Posts: 33
Joined: Mon Jul 23, 2012 7:17 pm
Location: Petaluma california USA
Has thanked: 26 times
Been thanked: 2 times
Contact:

Disable interrupt while interrupt is running?

Post by markus747 »

I have been trying to prevent stack corruption and wonder if I need to disable interrupt for ( RB0 interrupt on change ) and if so how do I clear bit 1 in intcon register (10Bh) GIE

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: Disable interrupt while interrupt is running?

Post by brandonb »

what chip are you using?
when i set and clear bits i do it in a generic way for all compilers for instance to set bit 2 in t2con register
t2con|=1<<2;
to clear bit 2
t2con&=~1<<2;
if you look at bens tutorial on sleep function he shows how to do it in in a more eligant way
on your interrupt you can disable it with the icon, and if you want to do it in c drop in a icon and set it up for disable, then veiw the c code it generates, this should get you what you need to know, then look at datasheet to set and clear those bits,
sorry limited time

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Disable interrupt while interrupt is running?

Post by Benj »

Hello,

Clearing bit 1 can be done like this using a C icon.

Code: Select all

clear_bit(intcon, 1);
GIE is not bit 1 so here is the code for the GIE bit.

Code: Select all

clear_bit(intcon, GIE);
So you know an interrupt cannot be re-triggered until after the interrupt macro has been completely processed and exited. Any interrupts which occur while the interrupt macro is being executed will be missed.

Post Reply