You can use an output in the pwm mode and with a low pass fliter you will get a n analog value of this signal. You will get 256 steps of the analog value from 0 till 100% of the used supplyvoltage.