![NXP Semiconductors DSP56800E User Manual Download Page 76](http://html1.mh-extra.com/html/nxp-semiconductors/dsp56800e/dsp56800e_user-manual_1721703076.webp)
A.22 FRAC32
The
macro serves to convert a real number to the
type. Its definition is
as follows:
#define FRAC32(x) ((frac32_t)((x) < 1 ? ((x) >= -1 ? (x)*0x80000000 : 0x80000000) :
0x7FFFFFFF))
The input is multiplied by 2147483648 (=2
31
). The output is limited to the range
<0x80000000 ; 0x7FFFFFFF>, which corresponds to <-1.0 ; 1.0-2
-31
>.
#include "mlib.h"
static frac32_t f32Val;
void main(void)
{
f32Val = FRAC32(-0.1735667); /* f32Val = -0.1735667 */
}
A.23 ACC16
The
macro serves to convert a real number to the
type. Its definition is as
follows:
#define ACC16(x) ((acc16_t)((x) < 255.9921875 ? ((x) >= -256 ? (x)*0x80 : 0x8000) : 0x7FFF))
The input is multiplied by 128 (=2
7
). The output is limited to the range <0x8000 ;
0x7FFF> that corresponds to <-256.0 ; 255.9921875>.
#include "mlib.h"
static acc16_t a16Val;
void main(void)
{
a16Val = ACC16(19.45627); /* a16Val = 19.45627 */
}
A.24 ACC32
The
macro serves to convert a real number to the
type. Its definition is as
follows:
FRAC32
GMCLIB User's Guide, Rev. 2, 10/2015
76
Freescale Semiconductor, Inc.
Summary of Contents for DSP56800E
Page 1: ...GMCLIB User s Guide DSP56800E Document Number DSP56800EGMCLIBUG Rev 2 10 2015 ...
Page 2: ...GMCLIB User s Guide Rev 2 10 2015 2 Freescale Semiconductor Inc ...
Page 4: ...GMCLIB User s Guide Rev 2 10 2015 4 Freescale Semiconductor Inc ...
Page 64: ...GMCLIB_SvmU7n GMCLIB User s Guide Rev 2 10 2015 64 Freescale Semiconductor Inc ...
Page 78: ...GMCLIB User s Guide Rev 2 10 2015 78 Freescale Semiconductor Inc ...