PICers - here's something that really had me stumped for a couple of days. I wrote code to operate a camera. It configs the OPTION_REG and the INTCON as shown, then waraps up housekeeping functions and goes to sleep to wait for an interrupt on RB0 or RB6/RB7 keychange as case may be. What nearly drove me nuts was the hardware kept self interrupting all the time, yet the simulator (MPLAB) behaved normally. ie It went to sleep, stayed asleep. The protoboard hardware version (4MHz) would get to the sleep instruc then jump to the ISR. Even if I left GIE cleared. I "cured" (?) it by changing the OPTION_REG from b'10000111' to b'00001000' What I can't figure out is why? When you disable the INTCON (GIE=0), then it shouldn't make any difference what you have in OPTION_REG? Any ideas what's going on? ie are there any restrictions on what you can out into the option register v/v interrupts? Debbie setint: BANK_1 movlw b'00001000' ;Original config = '10000111' ;b7 - RBPU' = 1 => Pull-ups disabled, ;b6 - INTEDG = 1 => RB0 int. on rising ;b5 - TOCS = TMR0 Clock Slct. ;b4 - TOSE => Clock edge select ;b3 - PSA = 1 => Prescaler assigned to WDT, ; 0 => Prescaler assigned to TMR0 ;b2, b1, b0 : Prescaler Rate Select movwf OPTION_REG BANK_0 PAGE_0 movlw b'00011000' ;Disable interrupts for now. GIE=0 ;b7 - GIE=0 temporarily ;b6 - Disable EE write ;b5 - Disable TMR0 interrupt ;b4 - Enable RB0 interrupt ;b3 - Ensable Interrupt on change RB4-7 ;b2 - Clear TMR0 flag = no overflow ;b1 - Clear RB0 int. flag ;b0 - Clear RB port Change Int. flag movwf INTCON <..snip..> call power_off bcf STATUS_LED clrf flags movlw b'10011000' ;Now enable the interrupts movwf INTCON nop sleep ;Shut down and wait for an interrupt nop <..snip..> ____________________________________________________ Do you Yahoo!? Yahoo! News: Get the latest news via video today! http://au.news.yahoo.com/video/ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist