This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Clarification on Clearing of the EX1 Interrupt Flag

Hi all,

I was wondering if anyone could shed some light on the behaviour of the external interrupts, especially their flag behaviour.

void int1 (void) interrupt 2 using 2  {

P1_4 ^= 1;      // Toggle the Green LED
EX1 = 0;
}

This code toggles our LED on/off if the interrupt occurs. The idea is that the interrupt only occurs once and then we disable it.

With an edge interrupt this code works.

With a level interrupt it doesn't and the interrupt remains enabled, however if I disable it as soon as the interrupt has returned it stays disabled.

I am guessing that in Level mode, I can't clear this flag because the level is still there when I try to clear it and so in hardware the bit is left set? Is this correct?

Ths ASM code shows the bit being cleared and then a correct RETI.

This is only a bit of test code as we are ultimately using this for power down/wakeup.

Cheers for any comments,

Dirk

0