Q:

12V or 24V switch circuit

I need circuit to choice between two voltages. So, circuit has two input terminals 12V,24V and one output terminal. If there is no 12V on input (floating)  - output is connected to 24V, and if there is 12V - output connected to 12V. Is it possible to design such circuit without comparators? I think there should be P- channel mosfet on 24V.

A:

Use a SPDT Relay. Attach the coil to the incoming 12volts. Coil rating needs to be 12v of course. NC contact connects to 24v. NO contact to 12v. Contact pole (aka common) output to your load.

A:

For an electronic switch  you can use the circuit below :  

simulate this circuit – Schematic created using CircuitLab
R5/R6 create a voltage divider that keeps M2 gate at about 9.5-10v (if the 24v can be much lower you can use a zener instead of the divider).
R4 is a pull down resistor keeping the source grounded when there is no 12v supply, that results to Vgs=10v which turns on the mosfet, that pulls the lowr side of R2 down and R1/R2 works as a voltage divider that feeds about 12v to the gate of M1 turning it on.
When the 12v supply is applied then the source of M2 becomes 12v and Vgs becomes almost 0 (slightly negative actually) which turns the mosfet off. That leaves the lower side of R2 floating (high impedance to ground) so R1 works as a pull up with Vgs=0 and M1 turns off.
The two Schottky diodes are used to prevent the current flowing from 12v to 24v and from 24v to the M2 gate (or the 12v during the M1 transition).

