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.
This post addresses some common questions about the C2000 IQMath Library. The library is fully documented in the C2000Ware software package.
Q: How do I change an IQmath project to a native floating-point project for the C28x+FPU?
This is a list of tips and tricks that have been found when converting an IQmath application to floating point:
Compiler Version
FastRTS Support Library (RTS)
Include two RTS libraries in your project:
Modify the MATH_TYPE
Interfacing to Registers
// // Example: // Convert from float to IQ15 // // If MATH_TYPE == IQ_MATH // Use the IQmath conversion function // if MATH_TYPE == IQ_MATH PwmReg = (int16)_IQtoIQ15(Var1); // // If MATH_TYPE == FLOAT_MATH // Scale by 2^15 = 32768.0 // else // MATH_TYPE is FLOAT_MATH PwmReg = (int16)(32768.0*Var1); endif
Dividing by a Constant
// // This will use the division routine in the RTS library to divide by a constant // AdcVal is type float32 // DEFINE ADC_SCALE 4096.0 ... AdcVal = AdcMirror.ADCRESULT0/ADC_SCALE; // // Preferred solution: // This will perform a multiply instead of the divide // DEFINE ADC_SCALE 1/4096.0 ... ... AdcVal = AdcMirror.ADCRESULT0* ADC_SCALE;
Shifting to Multiply or Divide by Multiples of 2
Compiler Intrinsics
long __qmpy32(long src32a, long src32b, int q); long __qmpy32by16(long src32, int src16, int q);
Q: I get an error that a library is not compatible with the --float_support=fpu32 build option. What can I do?
Q: I want to mix IQmath and floating-point math on a C28x+FPU device. Can I do this?
Q: If I use IQmath_f32.lib, does it do native floating point operations?