On Fri, 26 Dec 1997 00:57:29 +0100 ZyLog writes: >I can't understand why in microchip's 16c84 documentation, in >interrupt >paragraph they say that we must poll the GIE bit, to ensure no other >interrupt acknolegded ? On an interrupt, the PIC always clears the GIE bit by hardware before starting the ISR at address 4. It is usually not necessary to deal with the GIE bit at all in an ISR since the RETFIE instruction automatically sets it. The 3-instruction "clear GIE and make sure it's clear" sequence is used in the *main program* to disable interrupts. Using just one BCF instruction has a potential problem; if an interrupt occurs during that instruction, the ISR will still execute. Then the RETFIE will reset GIE to 1. The PIC will continue executing with interrupts enabled. Using the BTFSC to loop until its clear prevents this. If it is known that consecutive interrupts won't occur (for example, the timer is the only interrupt source), it should work to just use 2 CLRF's. If the first one is interrupted, the second one won't be. In order to return from the ISR with interrupts disabled (e.g. the interupt is a "one-time" event, which should be ignored until the main program needs to look for another one), use a RETURN rather than RETFIE. This leaves GIE clear. Or clear the apropriate interrupt-enable flag before returning.