Hi, I am having a problem with waking my 16F628 from SLEEP, I want it to = wake up when the button is pressed, in other words RB0 is now at 0V. I = have set the PIC to wake up on the falling edge, does this mean that = when the button is at 0V =3D PIC now awake?, as this is how I understand = it? Problem=3D If long cables are used for the switch, it picks up noise and = the software thinks the button has been pressed! =20 The problem is that I cannot find away of debouncing the button, as the = way I have it configured, it will not Wake Up until the button is = pressed AND released, the exact opposite of what I want. I want it to wake on Button down AND wait X milli seconds, then check it = is still at 0V, the code I have written, is below, and the button = connections, any ideas where I am going wrong? Thanks Gary =20 =20 ----- +5V | ---- | | 10K Resistor | | ---- | |---------------------------------- to RBO | Button here | | ----- 0V Code enters here ;------------------------------------------------------------------------= ------=20 call Goto_Sleep ;Returns here after Wake Up ;------------------------------------------------------------------------= ------=20 =20 Pseudo Code here Test Button =3D 0V Wait 20ms Test Button =3D 0V No =3D Goto_Sleep=20 Yes =3D Do something End of Pseudo Code=20 ;------------------------------------------------------------------------= ------=20 Goto_Sleep =20 clrf INTCON call Set_RB0_Interrupt=20 bcf RB0_Int_Flag ;MUST clear this before Sleep sleep ;as any previous activity return ;on RBO stops sleep mode =20 ;------------------------------------------------------------------------= ------ Set_RB0_Interrupt =20 clrf INTCON BSF INTCON,INTE ;Enable interupts on RB0/INT =20 movlw B'10000000' ;Bit6 Selects RB0 Interrupt edge movwf OPTION_REG ;BIT7 PortB pullups =3D off =20 return ;------------------------------------------------------------------------= ------- -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body