* Z:\home\khalils\Downloads\files\data\raw_asc\95f98a548e34_power_supply_priority.asc
* Generated by LTspice 26.0.1 for Windows.
* Power supply OR-ing. One and only one (not zero, not more than one) gate must be low at a time.
* V1 = PRIO1, V2 = PRIO2, V3 = PRIO3
* This only works as long as lower priority supply doesn't have a value > diode drop above a higher priority supply.
D1 V2 N001 BAT54
R4 G2 0 10k
V1 V1 0 PULSE(0 4.9 1m 1n 1n 1m 2m)
R5 G3 0 10k
Rload OUT 0 100
D4 V1 G2 BAT54
D5 V1 G3 BAT54
D6 V2 G3 BAT54
R1 V1 P001 10k
V3 V3 0 PULSE(0 5 4m 1n 1n 4m 8m)
M3 V3 G3 OUT OUT AO6407
Q1 G1 P001 N001 0 BC857B
R2 G1 0 10k
D3 N002 G2 BAT54
D2 V3 N001 BAT54
M1 V1 G1 OUT OUT AO6407
M2 V2 G2 OUT OUT AO6407
R3 V2 P002 10k
Q2 N002 P002 V3 0 BC857B
V2 V2 0 PULSE(0 4.95 2m 1n 1n 2m 4m)
.model D D
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.dio
.model NPN NPN
.model PNP PNP
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.bjt
.model NMOS NMOS
.model PMOS PMOS
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.mos
.tran 8m
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 1432 1144
WIRE 336 -128 160 -128
WIRE 560 -128 336 -128
WIRE 736 -128 656 -128
WIRE 752 -128 736 -128
WIRE 800 -128 752 -128
WIRE 640 -32 640 -80
WIRE 288 16 224 16
WIRE 640 16 640 -32
WIRE 640 16 384 16
WIRE 640 32 640 16
WIRE 800 32 800 -128
WIRE 176 112 160 112
WIRE 288 112 288 16
WIRE 288 112 240 112
WIRE 640 176 640 112
WIRE 800 176 800 112
WIRE 160 352 128 352
WIRE 288 352 160 352
WIRE 560 352 288 352
WIRE 736 352 736 -128
WIRE 736 352 656 352
WIRE 640 432 640 400
WIRE 160 496 128 496
WIRE 240 496 160 496
WIRE 384 496 336 496
WIRE 496 496 448 496
WIRE 640 496 640 432
WIRE 640 496 496 496
WIRE 640 512 640 496
WIRE 160 592 128 592
WIRE 384 592 160 592
WIRE 496 592 496 496
WIRE 496 592 448 592
WIRE 640 656 640 592
WIRE 144 800 128 800
WIRE 560 800 144 800
WIRE 736 800 736 352
WIRE 736 800 656 800
WIRE 640 880 640 848
WIRE 144 912 128 912
WIRE 400 912 144 912
WIRE 512 912 464 912
WIRE 640 912 640 880
WIRE 640 912 512 912
WIRE 640 960 640 912
WIRE 400 1008 160 1008
WIRE 512 1008 512 912
WIRE 512 1008 464 1008
WIRE 640 1104 640 1040
SYMBOL schottky 400 1024 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D6
SYMATTR Value BAT54
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL res 624 496 R0
SYMATTR InstName R4
SYMATTR Value 10k
SYMBOL voltage -304 448 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value PULSE(0 4.95 2m 1n 1n 2m 4m)
SYMBOL schottky 384 512 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D3
SYMATTR Value BAT54
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL schottky 384 608 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D4
SYMATTR Value BAT54
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL pnp 336 432 R90
SYMATTR InstName Q2
SYMATTR Value BC857B
SYMBOL res 624 16 R0
SYMATTR InstName R2
SYMATTR Value 10k
SYMBOL schottky 176 128 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D2
SYMATTR Value BAT54
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL voltage -304 880 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value PULSE(0 5 4m 1n 1n 4m 8m)
SYMBOL schottky 400 928 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D5
SYMATTR Value BAT54
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL res 272 336 R0
SYMATTR InstName R3
SYMATTR Value 10k
SYMBOL res 784 16 R0
SYMATTR InstName Rload
SYMATTR Value 100
SYMBOL pnp 384 -48 R90
SYMATTR InstName Q1
SYMATTR Value BC857B
SYMBOL pmos 560 -80 R270
SYMATTR InstName M1
SYMATTR Value AO6407
SYMBOL res 320 -144 R0
SYMATTR InstName R1
SYMATTR Value 10k
SYMBOL voltage -304 -80 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value PULSE(0 4.9 1m 1n 1n 1m 2m)
SYMBOL pmos 560 400 R270
SYMATTR InstName M2
SYMATTR Value AO6407
SYMBOL schottky 160 32 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D1
SYMATTR Value BAT54
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL res 624 944 R0
SYMATTR InstName R5
SYMATTR Value 10k
SYMBOL pmos 560 848 R270
SYMATTR InstName M3
SYMATTR Value AO6407
FLAG -304 16 0
FLAG -304 544 0
FLAG -304 976 0
FLAG 640 176 0
FLAG 800 176 0
FLAG 752 -128 OUT
FLAG -304 -64 V1
FLAG 160 -128 V1
FLAG 640 656 0
FLAG 160 592 V1
FLAG 640 1104 0
FLAG 144 800 V3
FLAG 160 496 V3
FLAG 160 112 V3
FLAG 160 16 V2
FLAG 160 352 V2
FLAG 160 1008 V2
FLAG 144 912 V1
FLAG -304 464 V2
FLAG -304 896 V3
FLAG 640 -32 G1
FLAG 640 432 G2
FLAG 640 880 G3
TEXT -256 1128 Left 2 !.tran 8m
TEXT -352 -376 Left 2 ;Power supply OR-ing.  One and only one (not zero, not more than one) gate must be low at a time.
TEXT -344 -344 Left 2 ;V1 = PRIO1, V2 = PRIO2, V3 = PRIO3
TEXT -352 -296 Left 2 ;This only works as long as lower priority supply doesn't have a value > diode drop above a higher priority supply.