Using MC to drive DC output.

Hello, I’m trying to use the digital output from a micro controller to drive a power circuit. My desired output is 0-12 volts (5 discrete levels). I have a old computer power supply as the supply.
To clarify the type digital signal, i have four pins that will be in one of 5 configurations (and what i want the value to represent):
0000 (0V)
1000 (3V)
1100 (6V)
1110 (9V)
1111 (12V)

I’ve currently got the following schematic… but im not sure if this will work.
also - my voltage levels may have to change - does anyone know what calculation i would do for the resistors if i needed, for example, 3.5 V instead of 3?

I suggest to use LTSpice to simulate the circuit. It is easy and free to download.

so im trying to find a p-channel mosfet to add in LTspice and i cannot for the life of me find any LT MOSFET... lots of MOSFET drivers... no MOSFETs.

im looking for something similar to FQP27P06

You have an R-2R ladder there which will give 16 possible output voltages from 4 pins,
if you only need 5 outputs you can get away with fewer pins.

The coding scheme you wrote down is linear and would work with identical resistors on
each pin to a summing junction.

If you don't mind a little ripple on the output PWM will do it with one pin so long
as you low-pass filter the output before amplifying.

odimachkie:
so im trying to find a p-channel mosfet to add in LTspice and i cannot for the life of me find any LT MOSFET
im looking for something similar to FQP27P06

LTspice is not limited to only LT parts and other spice models will work.
It's been a while since I've used LTspice, but I think it uses PSPICE syntax as opposed to HSPICE syntax (could be wrong though).
Easy way to check is to open an existing spice model of say a NPN and compare the syntax with one for PSPICE.
Many manufactures will provide the SPICE models for their devices.
For the FQP27P06 have a look here:
http://www.fairchildsemi.com/models/