Dippy:
You must not have read all the posts. I have said repeatedly that this is tried and true WITH AN OUTPUT THAT RANGED FROM 0~5VOLTS ONLY. The two-resistor feedback circuit is entirely new to me, suggested by this thread's requirement to handle more than five volts and is untested. I have said that.
In my proven circuit, from 0~5 volts out, I have total control of output from 0 volts to 5.0 volts with precision and stability. and fast response -- the circuit can go from minimum to maximum in two or three seconds, small changes are virtually instantaneous.
BCJ:
1. try using setfreq to 8MHz to speed things up though I have not had to do that myself.
2. Your circuit is locking up at the top and bottom because you are asking the voltage to go where it is physically impossible, given the voltages you are using. Notice that the correction circuit goes into a loop and stays there trying to adjust to the voltage you have commanded until the objective is achieved. If it can never achieve the level, it will sit there and never return control to the main program, so your pot becomes inoperative.
At the low end, because the LM317 is not able to meet any demand for a voltage below 1.25 volts out, when you read the pot you must do some additional math. Average the pot reading as often as you like, then add a number equal to, say, 1.27 volts -- 260 count. This will prevent the 08M from commanding a voltage lower than you can get with the lm317 (1.25 volts).
Not sure what, if any, math adjustments are needed at the high end of your circuit. But don't set your pot to a value that the output can't deliver. Keep in mind that the control circuit must stay 1.25 volts below the 317 output in order to function properly.
3. Sounds like your circuit might be suffering somewhat from inadequate power supply. I use a single LM317 type regulator set to 5.00 volts.
4 Could you post the software code you are using in its entirety, it sounds like something is slowing things down unnecessarily, unless it's your weak power supply.
Overall, it sounds to me like you have proven the circuit capable of working with the input to the feedback separate from the mosfet. Clearly, resistor values and the implications of the 1.25v differential have to be considered and dealt with. The divider resistor values will always have to be determined based on maximum output value so as to deliver proper voltage to the 08M readADC (staying within the 0~5volt limits).
Good work so far, I'd say.
This afternoon I will go to my workshop and devise a circuit that separates the control circuit from the feedback circuit and see how it goes. I will use a 24V input to the 317 and regulated +5 for the control circuitry, and try to accomodate the 1.25v minimum voltage in my code.