Hi All. I'm observing some behavior on the 16F877 that doesn't jive with the manual. Can someone shed some light on this? Application: WDT enabled, interrupts enabled, interrupts on RBO/INT enabled via INTE. No other interrupts enabled, no other peripherals in use. Behavior: The PIC goes to sleep just fine, and wakes up each time the WDT expires (roughly every 16ms). It also wakes up upon a change on the RB0/INT pin, and processes the interrupt properly. Problem: Regardless of the source of wake-up (WDT or RBO/INT), the -TO bit is always cleared (0) after waking up. My reads of the manual suggest that this is NOT expected behavior -- the -TO bit should be cleared after waking up only if the reason for waking up was the WDT. Relevant code looks like this: for(;;) { ... CLRWDT(); SLEEP(); if ( TO == 0 ) DoTimerFn(); ... } The compiler has compiled the if() statement properly. I "trapped" T0 == 1 and it never happens. I can view on the logic analyzer that no matter when the RB0/INT interrupt occurs relative to the periodic wake-up due to WDT, DoTmerFn() is _always_ called. I want it to be called only when the wakeup is due to WDT expiring. Any ideas? -- ______________________________________ Andrew E. Kalman, Ph.D. aek@pumpkininc.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu