OK ... a minor mystery ...
While I've used PICs for many things, I've never made use of the SLEEP mode. For my 18f2620, the docs state :
"All external interrupts (INT0, INT1 and INT2) can wake-up the processor from SLEEP, if bit INTxE was set prior to going into SLEEP. If the global interrupt enable bit GIE is set, the processor will branch to the interrupt vector following wake-up."
Well, it doesn't.
I *do* have GIE enabled, and INT1, because the PIC needs to be awakened by an external device. WDT timeouts DO happen. The external interrupt DOES work also, awakening from sleep and calling the ISR just like it's supposed to.
BUT ... a WDT timeout while sleeping does NOT branch to the ISR, but instead just picks up the program exactly where it left off, ie executing the code beyond the SLEEP instruction. This is OK, convenient even ... but not what the docs SAY it will do.
The program is writ in MikroPascal, but the actual SLEEP command is an in-line ASM statement, so MP ought not be saving the current program counter or anything else before SLEEP.
Any clues as to why this may be happening ? Mystery registers that could de-rail the call to the ISR when interrupts are enabled ? Any info helpful.