Hello Henrik,

Thank you for your reply. Sorry, last night was a brain dump and a "thinking out loud" of what was going on.

Your first point about proportional control, I was playing around with numbers to see what the effect was. So, for my case then, this number should be 0.5 or lower, correct? This would mean the output would swing when CHANNEL1 was above 480. (An ADC of 480 means 2.10A at the output.)

Ok, so lets recompile this with a 0.5 Kp and setpoint = 480.

I know that 27.5Vin with a duty cycle of 240 = 2.10A (ADCof 480) at the output. What I actually see if I WRITE the duty cycle values is exactly half the time (memory locations) at 240 and half the time at a duty cycle less than 240. Why is it clamping at 240 for half the time when it should be there all the time? If I raise the input voltage, there should be no clamping at 240 yet the higher the input voltage goes, there is still clamping at 240 for half the time but the other numbers will go down to 0. This means that eventually the output is flashing on and off at 50% duty cycle.

Current change response is quite fast. 20% - 80% change will be taken care of in ~1.2mS. However, the load change is very slow. These are 50W LED's and their current only changes due to self heating. They are on a huge big fan cooled heat sink. All this pid filter should have to maintain a very similar duty cycle, slowly dropping it over time. The lower the duty cycle, the cooler the LED, thus the less current, thus increased duty cycle etc etc. It takes about 1 minute for the LED to get to a temperature where the pid filter should start changing the duty cycle.

The ONLY thing I can think of here that is upsetting the system is ripple from the 30KHz switching circuits. I could add a lot of capacitance to the ADC pin to slow down the response and remove any ripples.

The control loop seems to be running a bit faster than what you have mentioned. I only have the WRITE in there for diagnostics, and run any changes twice, once with and once without the WRITE command. I was using the pause at the end of the loop to see what was happening with the 50% clamping at 240. If I make that pause 1S long, the duty cycle is 240 for 1 second and 0 for one second. If I take it out, the duty cycle is 240 for ~1mS and 0 for ~1mS. Thus the loop is running at ~1Khz. I cant see the on/off, I can only hear the inductors making noise.

I hope this clears up some things!