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.

TMS320F28027: IQmath manual example issue

Part Number: TMS320F28027
Other Parts Discussed in Thread: C2000WARE

Hi team,

An example from the IQmath Library A Virtual Floating Point Engine is referenced during the use of IQmath:

Example 1: Implementing equation in IQmath way
Floating point equation: Y = M*1.26 + 2.345
IQmath equation (Type 1): Y =_IQmpy(M, _IQ(1.26)) + _IQ(2.345)
IQmath equation (Type 2): Y =_IQ23mpy(M, _IQ23(1.26)) +_IQ23(2.345)

The customer is confused about when using the _IQmpy function, why the macro definition M dose not write as _IQmpy(_IQ(M), _IQ(1.26)) ?

And how is _IQdiv(A,B) implemented? Customer guesses (A/B) << GLOBAL_Q. Is it possible to provide the detailed process?

Could you help check this case? Thanks.

Best Regards,

Cherry

  • Cherry,

    You can choose any of the IQ multiply variants:

    _IQmpyI32int(_iq A, long B)

    _IQNmpyI32int(_iqN A, long B)

    _IQmpy(_iq A, _iq B).

    Depending on which one you choose, you can pass the arguments accordingly. Refer to the documentation found in <c2000ware>\libraries\math\IQmath\c28\docs

    And how is _IQdiv(A,B) implemented? Customer guesses (A/B) << GLOBAL_Q. Is it possible to provide the detailed process?

    Yes it divides the two long ints and returns the result in IQN format. WE dont release the source code of IQ library functions. What does he specifically want to know?

    -Shantanu

  • Hi Shantanu,

    Thanks for your support!

    Example 1: Implementing equation in IQmath way
    Floating point equation: Y = M*1.26 + 2.345
    IQmath equation (Type 1): Y =_IQmpy(M, _IQ(1.26)) + _IQ(2.345)
    IQmath equation (Type 2): Y =_IQ23mpy(M, _IQ23(1.26)) +_IQ23(2.345)

    May I know is there any feedback towards this question?

    Thanks and Best Regards,

    Cherry

  • Cherry,

    If M is in float, you should use _IQ(M) in the arguments to convert to IQ format. Othewise, no need to use _IQ()

    -Shantanu

  • Hi Shantanu,

    Thanks for your reply and this issue has been resolved. Can we just come back to the other question about PWM period value? The customer would like to know more about this value,

    Thanks and Best Regards,

    Cherry

  • Cherry,

    Please start another thread for PWM. If there are no further clarifications on IQMath, i will close this thread.

    -SHantanu