
IQmath Library
8 - 24
C2000 Microcontroller Workshop - Numerical Concepts
IQmath Library
IQmath Library: Math & Trig Functions
Accuracy of functions/operations approx ~28 to ~31 bits
IQsin(A),IQcos(A)
IQsinPU(A),IQcosPU(A)
IQasin(A),IQacos(A)
IQatan(A),IQatan2(A,B)
IQatan2PU(A,B)
IQsqrt(A),IQisqrt(A)
IQmag(A,B)
IQexp(A)
_IQsin(A), _IQcos(A)
_IQsinPU(A), _IQcosPU(A)
_IQasin(A),_IQacos(A)
_IQatan(A), _IQatan2(A,B)
_IQatan2PU(A,B)
_IQsqrt(A), _IQisqrt(A)
_IQmag(A,B)
_IQexp(A)
sin(A),cos(A)
sin(A*2pi),cos(A*2pi)
asin(A),acos(A)
atan(A),atan2(A,B)
atan2(A,B)/2pi
sqrt(A),1/sqrt(A)
sqrt(A*A + B*B)
exp(A)
trig
and
power
functions
IQsat(A,Pos,Neg)
_IQsat(A,Pos,Neg)
if(A > Pos) A = Pos
if(A < Neg) A = Neg
saturation
A – B
A - B
A - B
substract
>, >=, <, <=, ==, |=, &&, ||
>, >=, <, <=, ==, |=, &&, ||
>, >=, <, <=, ==, |=, &&, ||
boolean
A + B
A + B
A + B
add
A / B
_IQdiv (A , B)
A / B
divide
A * B
_IQmpy(A , B)
A * B
multiply
A = IQ(1.2345)
A = _IQ(1.2345)
A = 1.2345
constant
iq A, B;
_iq A, B;
float A, B;
type
“IQmath” in C++
“IQmath” in C
Floating-Point
Operation
Additionally, the "IQmath" library contains DSP library modules for filters (FIR & IIR) and Fast
Fourier Transforms (FFT & IFFT).
IQmath Library: Conversion Functions
IQmath.lib
> contains library of math functions
IQmathLib.h
> C header file
IQmathCPP.h
> C++ header file
atoIQ(char)
_atoIQ(char)
atof(char)
string to iq
IQtoQN(A)
_IQtoQN(A)
A
iq to qN
QNtoIQ(A)
_QNtoIQ(A)
A
qN to iq
IQmpyI32int(A,B)
_IQmpyI32int(A,B)
(long) (A * (float) B)
integer(iq*long)
IQmpyI32frac(A,B)
_IQmpyI32frac(A,B)
A - (long) (A * (float) B)
fraction(iq*long)
IQtoF(A)
_IQtoF(A)
A
IQ to float
IQmpyI32(A,B)
_IQmpyI32(A,B)
A * (float) B
iq = iq*long
IQfrac(A)
_IQfrac(A)
A – (long) A
fraction(iq)
IQint(A)
_IQint(A)
(long) A
integer(iq)
IQNtoIQ(A)
_IQNtoIQ(A)
A
iqN to iq
IQtoIQN(A)
_IQtoIQN(A)
A
iq to iqN
“IQmath” in C++
“IQmath” in C
Floating-Point
Operation
IQtoA(A,B,C)
_IQtoA(A,B,C)
sprintf(A,B,C)
IQ to ASCII
Summary of Contents for C2000 Piccolo LaunchPad
Page 74: ...Interrupts 4 18 C2000 Microcontroller Workshop Reset and Interrupts ...
Page 100: ...Lab 5 System Initialization 5 26 C2000 Microcontroller Workshop System Initialization ...
Page 218: ...Lab 8 IQmath FIR Filter 8 42 C2000 Microcontroller Workshop Numerical Concepts ...
Page 334: ...F28069 controlCARD A 4 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 ...
Page 336: ...F28035 controlCARD A 6 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 SW3 ...