A problem about the return value of function GFLIB_ControllerPIrAW

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

A problem about the return value of function GFLIB_ControllerPIrAW

599 Views
maxxu
Contributor IV

 Hi

   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

0 Kudos
1 Reply

589 Views
StanoA
NXP TechSupport
NXP TechSupport

Hello Maxxu,

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.

Best Regards,

Stano.

0 Kudos