The function GFLIB_ControllerPIrAW()，Can it return negative values？
Its return value format is tfrac16, that is to say, its return value can be assigned value.
However, in actual use, I found that it seems that it can only return a > = 0 number . When the system is seriously overshoot, the most extreme work that the controller can do is to turn off the output, but it is not enough. For example, when the brushless DC motor is in the power generation state, the motor speed has exceeded my given value, I want to apply the brake, but PID has no negative output,
For this kind of problem, which PID function should I use?
I hope to return a negative value, so that I can implement braking
The return values from function GFLIB_ControllerPIrAW() (speedPIOut, currentPIOut) are defined as tFrac16 this means: 16-bit signed fractional value. So it has the positive or negative value in range <-1;+1).
In the example code the result of function GFLIB_ControllerPIrAW() is limited to positive value only, so in case you need active break motor, you need build your own code for this functionality.
I wish you success in your work.