nice! i tried the 'finePWM' thing and it works great! I have a pot thats read into the ADC to set the desired current and the program changes the duty cycle until the current reading matches it (after a little scaling).
I did a proportional method that's overdamped - the current just ramps up to the desired current and levels off without any overshoot. I even moved my alligator clips around so that the load resistance reduced to about 1 ohm and the current control was still stable. That should be about right for my pack of 72 cells, but i bet a pack of AGMs would be less. I have a 12V AGM i can test it on - i'm just a little nervous about testing on a battery for whatever reason...
anyway, i could control the current up to 20A and down to 1.5A with the pot. I think my opto-isolation circuitry messes with the low duty cycle output which shouldn't be a problem with a battery (needs a higher dutycycle to overcome the battery's voltage).
here's the part of the control code...
USERcurrent is the setting from the pot, outputcurrent is from the current sensor, and PWMfine is a 16bit variable.
Code:
currenterror=USERcurrent-outputcurrent;
deltaPWM = currenterror/2;
PWMfine=PWMfine+deltaPWM;
OCR1A=PWMfine/128;