What output voltage range do you need? If you don't need a very wide range, you can use this trick.
This diagram is part of a battery charger I designed. The LM2676S (U10) is used as a buck regulator with its output voltage controlled by the MCU via Q11 and Q10. This circuit has an output voltage range of about 9~19V DC. In this application, the output voltage was monitored by the MCU, to compensate for semiconductor forward voltage variations due to temperature. This (or some other) method of "closing the loop" is needed if you want accurate output voltage (very important for a battery charger).
The output voltage is controlled by a 0V/3.3V PWM signal from the MCU, which comes in on the wire just below the text "OUTPUT VOLTAGE ADJUSTMENT" and is smoothed by R15 and C15 for the CCV (charger control voltage) node. You could also use a DAC output if one is available on your MCU, connected straight to CCV.
The regulator's output voltage is on the COV node (charger output voltage). R12 provides the main voltage feedback to the CFN node (charger feedback node), and five diode junctions in series provide a (fairly) constant voltage drop of about 3.1V from CFN down to the regulator's feedback input, which the regulator maintains at 1.21V.
If R14 wasn't present, the regulator would operate with a fixed output voltage, determined by the ratio between R12 and R13 with the 3.1V diode drop effectively in series with R12.
Any other current drawn from CFN will cause the CFN voltage, and thus the regulator feedback voltage, to drop, and the regulator will increase its output to compensate. R14 provides the path for this current, which is sinked by Q10 and Q11 operating as a Darlington. The current drawn through R14 depends on the voltage difference between CFN (which has a constant voltage) and Q10's emitter. Therefore, pulling Q10's emitter towards ground sinks more current from CFN and causes the regulator to increase the output voltage, to counteract the current being drawn through R14, and keep the CFN voltage constant. (The regulator remains in regulation at all times.)
A control voltage of 0~3.3V at CCV produces a Q10 emitter voltage of around 1.2~4.5V, so actually when CCV is more than about 3.1V, current is actually sourced, not sinked, through R14. So the CCV voltage controls the output voltage. At CCV=3.3V the output voltage COV is at minimum; as CCV is reduced towards 0V the output voltage increases.
If anything's unclear feel free to ask.
Edit: Make sure that the buck regulator is disabled on startup, and won't be enableld until the PWM is active and the voltage on CCV has been given time to settle. If the regulator starts up immediately, it will start at maximum output voltage.