Use a PNP - -e.g. 2N3906; connect emitter via a 1N4148 (or any other) diode to +9V; connect base via ~ 10k to +12V. Connect the collector via a R (e.g. 10k) suitable for LED brightness to the LED to GND.
When the 12 V falls below 9V-2*0.7, the PNP will will turn on and light the LED.
The 1N4148 is to protect the E-B junction of the PNP if 12 V is present and 9 V not. If you are still concerned, you can add > 1Mohm in parallel with the E-B junction also.
To light a LED when the regulator output is "good", you don't do anything to the EN pin.
When the output is good, the PG pin is high impedance, and when not good, it is pulled low. This needs to be inverted if you want the LED to light when power is good.
The simplest solution, although hard on the PG output, is to connect a resistor between the PG output and 5 V, and the LED between the PG output and ground. For a green LED that drops 2.1 V and 10 mA LED current, the resistor would need to be 300 Ω. When the PG output goes low, it sinks the current instead of the LED, so the LED shuts off. In this example, the PG output would need to be able to sink 17 mA.
Here is a more sophisticated solution:
![](https://i.stack.imgur.com/BBsY0.gif)
It still runs the LED at 10 mA when power is good, but puts much less of a load on the PG pin. It's possible that the PG pin can't sink 17 mA, as required by just the resistor and LED circuit described earlier. This circuit puts less than 1 mA load on the PG pin, which it almost certainly can do. It also draws less current from the 5 V supply when the LED is off. The first circuit actually draws more when the LED is off.
Best Answer
Depending on BKUPB current capabilities you could just connect the LED cathode to the port pin and the anode to a current limiting resistor and then to 5V.
Updated schematic to show ~1.5mA draw with a 2.5kΩ resistor.
simulate this circuit – Schematic created using CircuitLab
Below is the other common way to do it using an P-Channel enhancement mode MOSFET , and then you don't have to worry about the current draw of your open collector pin.
simulate this circuit