We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
This is govenred by the behaviour of the hardware, so the place to look is the so-called "bible" for the 8051 architecture - links here: www.8052.com/.../120112
See also: http://www.8052.com/tutorial