I didn't fully evaluate how your'e doing it, but it sounds suspiciously similar to a circuit I designed several years back, and has worked well ever since.
It should do what you need.
The "gist" of the way it works is the very first button push will switch power on. The PIC must quickly set the "Master_On" signal to keep power on. Subsequent button presses will simultaneously try to power the system up again, but since it is "already" powered up, it will simply toggle the "BTN1" signal.
The PIC must clear the "Master_ON" signal to turn power off.
None of the circuits are critical so feel free to make substitutions, but be sure to use two diodes.
![]()
Bookmarks