Digitally Controlling an LM317

I threw together this schematic fairly quickly but I think it is all correct. The resistor values would have to change depending on your voltage input into the LM317. The LM324 can get a maximum output gain of VCC - 2 volts, so I set up the resistor to get a gain where 5 volts ends up to be 18 volts. The LM324 can be driven with ground and the +20 volt line, no need for a negative power supply at all.

This design gives two variable outputs from ~2.6 volts to ~18.5 volts. I'm working on finishing up a bench top power supply, just hammering out the bugs right now. I use a 4x4 keypad to adjust the voltages, LCD to present all the information, and using a few voltage dividers to read in the analog output to tie it all together.

You could use the PWM output to drive the op-amp, but then you have to bother with filtering out the waveform. I tried that initially and I didn't have very good luck with get a smooth output, which through off everything later on. I didn't put too much effort into it, and I must confess I know very little about the appropriate way of filtering it. I am using the DAC because it uses an internal R-2R ladder, so the output is constant. If you are more interested in going this route, here is a useful link: http://electronicdesign.com/Articles/ArticleID/13077/13077.html
It is basically the same principle, except using the PWM output.

The MAX548 is outdated as far as I can tell, I just had a few laying around. I'm sure maxim makes a very similar, current DAC that could be interfaced the same way. Really any DAC can be used, its just a relatively simple matter of communicating with the DAC correctly.