EasyManuals Logo

Texas Instruments C2000 Workshop Guide And Lab Manual

Texas Instruments C2000
342 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #199 background imageLoading...
Page #199 background image
IQmath
C2000 Microcontroller Workshop - Numerical Concepts 8 - 23
IQmath Provides Compatibility Between
Floating-Point and Fixed-Point
All “IQmath” operations have an equivalent floating-point operation
Compile & Run
on Fixed-Point
F2803x
Y = _IQmpy(M, X) + B;
#if MATH_TYPE == IQ_MATH
#if MATH_TYPE == FLOAT_MATH
Y = (float)M * (float)X + (float)B;
1) Develop any mathematical function
2) Select math type in IQmathLib.h
3) Compiler automatically converts to:
Floating-Point
Math Code
Fixed-Point
Math Code
Compile & Run
on Floating-Point
F2806x *
* Can also compile floating-point code on any floating-point compiler (e.g., PC, Matlab, fixed-point w/ RTS lib, etc.)
Selecting FLOAT_MATH or IQ_MATH Mode: As was highlighted in the introduction, we would
ideally like to be able to have a single source code that can execute on a floating-point or fixed-
point target device simply by recompiling the code. The "IQmath" library supports this by setting
a mode, which selects either IQ_MATH or FLOAT_MATH. This operation is performed by
simply redefining the function in a header file. For example:
#if MATH_TYPE == IQ_MATH
#define _IQmpy(M , X) _IQmpy(M , X)
#elseif MATH_TYPE == FLOAT_MATH
#define _IQmpy(M , X) (float) M * (float) X
#endif
Essentially, the programmer writes the code using the "IQmath" library functions and the code
can be compiled for floating-point or "IQmath" operations.

Table of Contents

Other manuals for Texas Instruments C2000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments C2000 and is the answer not in the manual?

Texas Instruments C2000 Specifications

General IconGeneral
BrandTexas Instruments
ModelC2000
CategoryMicrocontrollers
LanguageEnglish

Related product manuals