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.

_IQsin and _IQdiv not giving expected output

Other Parts Discussed in Thread: CONTROLSUITE

_iq alpha = _IQsin(_IQ(2.0));

I expect that the answer of this should be sin(radians) = sin(2.0) = 0.90929

However, I am getting an answer of 0.134223938 (IQ24 converted to float) as I enter breakpoint into my debugging window.

Here are a few examples and outcomes:

_iq alpha = _IQsin(_IQ(1.0)); ---> gives a IQ24 output of -12772547 and a float converted output of -0.7613031864

_iq alpha = _IQsin(_IQ(3.0)); ---> gives a IQ24 output of 15223745 and a float converted output of 0.9074059129

_iq alpha = _IQsin(_IQ(3.14159)); ---> gives a IQ24 output of 16111031 and a float converted output of 0.9602923393

Also, _IQdiv(ANY VALUE) gives me 581117741 which is float 34.63731652

Please advice. No errors are found during project build.

  • A couple things you can check.

    1. did you get any warnings about "implicit function defined" - it could be the project cannot find "IQMath.lib"

    2. is GLOBAL_Q set to 24

    3. Are the IQMathTables in the right location in the linker command file

    4. can you use the IQ specific function, IQ24sin instead of IQsin - does that make a difference

  • Global_Q is set to 24 I have confirmed.

    I do not get "implicit function defined" error.

    I think there is some problem with the IQMathTables however, I am getting the following warnings when the code is complied:

    "C:/ti/controlSUITE/device_support/f2806x/v151/F2806x_common/cmd/28069_RAM_lnk.cmd" "C:/ti/controlSUITE/device_support/f2806x/v151/F2806x_headers/cmd/F2806x_Headers_nonBIOS.cmd" -l"IQmath_fpu32.lib"
    warning: build attribute vendor section TI missing in
    "C:/ti/controlSUITE/libs/math/IQmath/v160/lib/IQmath_fpu32.lib<IQ24sin.obj>"
    : compatibility cannot be determined
    warning: build attribute vendor section TI missing in
    "C:/ti/controlSUITE/libs/math/IQmath/v160/lib/IQmath_fpu32.lib<IQmathTables.
    obj>": compatibility cannot be determined
    warning: build attribute vendor section TI missing in
    "C:/ti/controlSUITE/libs/math/IQmath/v160/lib/IQmath_fpu32.lib<IQ24toF.obj>"
    : compatibility cannot be determined
    warning: creating output section "DLOG" without a SECTIONS specification
    'Finished building target: Example_2806xEPwmTimerInt.out'



    I am not sure how to fix these warnings.