I need to get a simple PID application going using a PIC, and this PID include looks to be ideal for what I need to do.

The system I'm working with doesn't incorporate an output device that accepts a direction bit. Everything is a positive variable i.e. the setpoint value, feedback value, and the output to the process (a value that I'll plug into a hardware PWM channel). Specifically, everything operates within the span of a WORD variable, 0-1023.

If I'm properly interpreting how the routine works, I'll need to edit the include file to make the sign indicator passed to the include, currently B.0, a bit variable, and then do a sign determination in the main calling program to indicate if the error signal that I pass to the PID sub is below or above the setpoint.

Likewise, I'll need to take the output of the PID include that gets passed back to the main process, and add/subtract the new output with the last output based on the direction bit, currently B.15.

OR

Can I simply make the direction variable passed to the PID a constant 1, and ignore the sign information returned from the routine?

OR

Do I have this all wrong?

Thanks in advance for the help!

Mike