I am trying to design a circuit that, depending on a value that a microcontroller recieves (between 1 and 10), a fixed voltage of 20 V, 40 V, 60 V,... or 200 V (depending on the value recieved by the microcontroller) appears at the output. So, for example, if the value 2 is read, then 40 V should appear at the output; if the value is 6, then 120 V; and so on. In other words, I have to control digitally a switch that short-circuits the output of the circuit with one of the ten voltage sources available.
This is what I've done so far:
The microcontroller recieves a value between 1 and 10 (via USB, but that doesn't matter). The thing is that I put that number in an output port using 4 bits. Those pins enter a demux that is connected to 10 different outputs. So the thing is that I want these pins to control a set of interruptors that make a short-circuit between the output and the voltage sources. I have available ten voltage sources of the ten different values (20 to 200 V). I don't know how to implement this part of the circuit.
I've thought of each output pin of the demux being connected to a MOSFET that would act as switches, but I don't know how to connect them in order to get what I'm looking for. I believe some drivers would be needed here, but again, I can't think of a way to connect them to get the desired result.
Do you have any ideas? If the question is not clear please let me know, and I'll try to clarify it.
The resistance load for the circuit will be 50 \$\Omega\$. The output has to be a rectangular wave (its duty cycle can be varied with a variable resistor). The maximum amplitude of the wave can be 200 V, and the minimum 20 V.
The maximum average output power reaches 1.92 W (there are peaks of instantaneous power of 800 W), and the mean value of the output current is 9.6 mA.