Ok, now I see the problem. Thank you all !!. > If the change occurs just as PORTB is being read, the interrupt flag won't be > set and no interrupt will be generated. What many people don't realize is that > every instruction that accesses PORTB will read it. ... > My suggestion is that either you use it ONLY for wake-up from sleep, or take > your chances otherwise and be prepared to spend MANY hours debugging a > seemingly random problem. Can it be done? Sure, but you have to really > know when you're modifying the port and keep any interrupts on pin change > COMPETELY separated from these port read/writes. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics