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.

Compiler/TMS320F28069: Float to IQ conversion

Part Number: TMS320F28069


Tool/software: TI C/C++ Compiler

I moved a CCS 5.3 project to CCS 10 

using CGT 6.1.0

IQmath_fpu32 lib

I'm now having an issue with float to IQ24 conversion

here's the problem

float fp_num = 0.06;

_iq iq_num1;

_iq iq_num2;

iq_num1 = _IQ(0.06) gives a result of 0.06 in iq_num1;

iq_num2 = _IQ(fp_num) gives a result of 0.0 in iq_num2;

What am I missing here?

Thanks

Dhar

  • Dhar,

    Not sure what CGT 6.1.0 refers to. Can you use the C2000 Compiler 18.12.4.LTS or later when building the project? Let me know what version you end up using.

    <<<iq_num1 = _IQ(0.06) gives a result of 0.06 in iq_num1;

    The above should give a result of round(0.06 * 2^19) = 31,457

    Check the disassembly for both to understand what assembly instructions are being generated in each case.

    Also check what optimization level you are using. If optimization is OFF, try enabling it (-o0, -o1 etc.)

    Thanks,

    Sira

  • Above, I used the wrong Q, it should be round (0.06*2^24) = 1,006,633