Quote Originally Posted by flotulopex View Post
Hello,

I intend to power a PIC (it's a 16F630 at the moment) throught a switch and detect a "power-OFF / power-ON" sequence.

In other words, when I press the button, the PIC is switched "ON" and a Port (i.e. pin 3) reads a HIGH level. PIC performs Task 1 as long as the power is not cut.

I would like to be able to release the button for half a second to detect the LOW level on the Port and then switch the PIC back ON again to perform Task 2.

If the power-OFF state is longer than 0,5 second, the PIC will normally perform Task 1 when the power comes ON again.

I tried with a 10µ capa and then with a 470µ one but I can't get it working, the PIC switches OFF immediately. The total "load" on the PIC is around 2mA during the time a release the button (= no direct power from the supply). The diode is a 1N4148.

Is what I'm trying to achieve possible that simple way or not? If yes, what should I change or add to my circuit?
Reading again your post, why is it necessary to power off the PIC???

Just keep powering it normally and just connect the button to any input. Then the program will decide about which task to perform according to Press/No-press state of your button.

Am I missing something?

Ioannis