Willie, do you have anything at address 0x4 (the interrupt vector)? Otherwise, the pic is just going to run from there on, which is probably not what you want. - Marcel On 2/22/07, Willie Malan wrote: > Good day > > I am fairly new to PIC microcontrollers and use the PIC16F690, which is > on the PICkit2 starter kit. At the end of the routine, which is working > fine, I want the PIC to go into sleep mode and must be wake up by a key > on the keypad. Is there anyone that could comment/assist with the > following code? The first part is initialising / preparing for sleep > and the latter (after the SLEEP instruction) set things to normal again. > I do not know if all the initialising and clearing is necessary. > > Thanks > > Willie Malan > > > > movlw 0x7F ;RC7=0, col4 low, RC6,5,4=1 col 1,2,3 high > > movwf PORTC > > movf PORTA,W ;read PortA as basis for interrupt > > bsf IOCA,2 ;enable IOC > > bsf INTCON,7 ;set GIE global interrupt enable > > bsf INTCON,4 ;set INTE interrupt enable > > bsf INTCON,3 ;set RABIE > > SLEEP > > NOP ;wait for * on keypad to wake up > > movf PORTA,W ;read PortA > > bcf INTCON,7 ;clear GIE global interrupt enable > > bcf INTCON,4 ;clear INTE interrupt enable > > bcf INTCON,3 ;clear RABIE > > goto Initialise > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist