Jinx wrote: >Can anyone offer explanations please. This code did not work >quite as I expected. It's a test routine for checking WDT/b0 IRQ >on the F84 ......... >During this time, I expected b0 IRQs to be disabled. However, >without the explicit "bcf inte", b0 IRQs can still occur, even >though they should have been turned off by an implicit "bcf gie" >on entry into the ISR. If the pushbutton is pressed while the >green LED is on, it goes off and the red comes on, showing that >ISR has been re-entered > Hello Mr. Bad-luck [inside joke], I think I have an answer to some of your problems [but only the easy ones]. AFAICT, the docs aren't that clear about **all** of the weird interactions between IRQs, sleep, and WDT, but looking at Fig 8-14 for the 16C84 (pg 2-767 in '95 databook) shows that the interrupt inputs have a parallel "snaek" pathway that bypasses the normal IRQ channel and goes straight to the wakeup from sleep ckt. So doesn't matter whether GIE is enabled, but does matter if INTE is. Pushing the button in your code while sleeping doesn't actually cause an IRQ, but rather a direct wakeup from sleep. ============== >With "bcf inte" included, b0 IRQs are disabled as I thought they >should have been. Why is this so ? I can find no reason for it in the >documentation (it could be my paperwork that's deficient). What > As noted above, without that "bcf inte" included, the button press functions via the parallel sneak pathway just described, and then it looks like a "2nd" time, since after you come out of the ISR-sleep loop, and back into the real world, you get an actual IRQ. Hope this helps ring out the problems. As noted offlist, I think if I were writing this kinda thing, that I would move the sleep-LED-blink sequencing stuff outside of the ISR, and into a routine callable from the main program loop, and simply use the IRQ to trigger the sequence by setting a flag. An advantage of this approach is that you could actually insert this kind if thing more easily into a normal program with fewer interdependency problems. best regards, - Dan Michaels Oricom Technologies http://www.sni.net/~oricom ========================== -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.