I need to know how to detect whether the power supply is coming from an external source or from the battery. I'm using a 3.3 V LDO regulator from Micrel and the output is in series with a diode. The battery is parallel with that diode and also comes with a diode. I attached the circuit here. Can I take the output of the regulator to know the power source as indicated by the red dotted line in the circuit. The MCU is taking power from the VCC point.