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
// 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);
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
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?
Lori HeustessC2000 Software Engineering
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.