Hi,
Yeah, someday I need to update the routine to allow optional inclusion of the feedforward terms. At the time, PBP3 wasn't available so we had no conditional compilation.
If it works it works but I'm not quite sure about the duty=duty+pid_out, that way you keep accumulating the output of the filter. But perhaps that's what you want.
Right, the nagging question then...
pid_EiT is a WORD variable so as far as PBP is concerned it can never be <0. It's either 0 or positive.
The idea behind that piece of code is to allow the accumulator to grow even if the calculations "this time", due to truncation etc, would otherwise yeild a result of 0. It's not perfect but at least it guarantees that the accumulator WILL grow no matter how small the error and/or integral gain is.
Does that answer your question?
/Henrik.
Bookmarks