Quote:
Originally Posted by MPaulHolmes
I didn't do the PI loop the traditional way.
|
No argument from me there
You're right in that you're calculating deltaPWM rather than PWM so there's an additional differentiation that comes into play.
Quote:
Originally Posted by MPaulHolmes
(5) deltaPWM = P*errorNew + (I*deltaT - P)*errorOld
|
(As a PI equation that seem intuitively horribly wrong, but I can' see a problem in the mathematics).
What bothers me about (5) is that somewhere I'm missing an inversion (possibly U5C?). With a "direct" drive I think that lower pwm, lower OCR1A would lead to an increased current which would imply a negative proportional term. However, I think that output of that loop increases with increasing error.