This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDSCNCD28335: __IQsat definition missing + using PID_GRANDO_IQ function from the Solar Library

Part Number: TMDSCNCD28335

Does any one knows where to find the __IQsat definition?

We had a similiar issue with __IQmpy that   solved with:

Now we are wondering wether exist a similar definition for __IQsat function

Thanks in advance.

  • Hello Yaki,

    If you are looking for the definition as part of the IQmath library, the IQmathLib.h file contains the definition on line 3788 (for codegen tools V5.2.2 or later):

    #define   _IQsat(A, Pos, Neg)  (__fmax(((__fmin((A),(Pos)))),(Neg)))

    I hope this helps.

    Best regards,

    Omer Amir

  • Thanks Omer, but that definition it belongs to floating point only, we are running with IQ , fixing point math. Do you know which would work over there?

    Thanks in advance

  • Hello Yaki,

    I was unable to find any exact definition in the code or documentation, but I can explain what the function is doing based on a CCS example:

    *-SP[4] is tempX, *-SP[16] is t1, *-SP[18] is t2, and *-SP[20] is result. It does not look like IQsat calls a particular function, but instead is a macro which replaces the code with the above assembly instructions. tempX is move to the accumulation register, then it finds the minimum between tempX and t1 (loading the accumulation register with the minimum), next it finds the maximum between the minimum from MINL and t2. Finally the result is stored in the output variable result. Let me know if you need further information.

    Best regards,

    Omer Amir