Here is the topic:

I am using two curcuits, based on PIC16F684.
Main circuit is powered by 5V (9V battery to 5V voltage regulator).
Auxiliary circuit is powered by 3V (one small battery) because it will be its backup supply.
Auxilliary circuit is supposed to be normaly connected to the power supply of main circuit (5V) but, if disconnected, it should use the 3V power supply.

Would someone know and be so kind to tell me how I could, electricaly design my circuits so I can implement such diagram?
I will need a system to switchover from 3V to the 5V of the main circuit and vice versa when separating auxiliary circuit from main circuit.

The fact is that this switchover must be immediate because the PIC CANNOT loose its power supply and reset.

Thanks for your help.

Regards.