You could use a PWM-based digital-to-analog converter (D2A or DAC). You change the PWM duty-cycle which changes the DC-bias of the PWM waveform. YOu then use an RC filter (or some other filter) to filter out the high frequencies leaving you with the DC-bias of the PWM signal which is your analog output voltage. If you choose this method, you need a MCU that has PWM that has 16-bit resolution.
For example, for a 0-5V square wave:
0% duty cycle would produce 0V
25% duty cycle would produce 1.25V
100% duty cycle would produce 5V
You could also just use a pre-made D2A/DAC IC and control it with your MCU. In this case you would need SPI or I2C, or whatever serial protocal the DAC IC uses.