Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

This group regroups all the defined macros you can use in your project.

Limit values in floating-point format of a signed fixed-point number typed Qa.b

#define DSP_FP_MAX(a, b)   (((float) (1 << ((a)-1))) - DSP_FP_RES(a, b))
 Return the maximal value of a fixed-point Qa.b typed number. The result is returned as a floating point number. More...
 
#define DSP_FP_MIN(a, b)   (-((float) (1 << ((a)-1))))
 Return the minimal value of a fixed-point Qa.b typed number. The result is returned as a floating point number. More...
 

Limit values in fixed-point format of a signed fixed-point number typed Qa.b

#define DSP_Q_MAX(a, b)   ((S32) (((U32) -1) >> (32 - ((a)+(b)-1))))
 Return the maximal value of a fixed-point Qa.b typed number. More...
 
#define DSP_Q_MIN(a, b)   ((S32) ((-1) << ((a)+(b)-1)))
 Return the minimal value of a fixed-point Qa.b typed number. More...
 

Resolution in floating-point format of a signed fixed-point number typed Qa.b

#define DSP_FP_RES(a, b)   (1./((unsigned) (1 << (b))))
 Return the resolution of a fixed-point Qa.b typed number. More...
 

Convertion macro from a float to a Q Formated value

Note
These macros limit the number in its range
#define DSP_Q(a, b, fnum)
 Convert a float into a signed fixed-point typed Qa.b. More...
 
#define DSP16_Q(fnum)   ((dsp16_t__) DSP_Q(DSP16_QA, DSP16_QB, fnum))
 Convert a float into a 16-bit signed fixed-point type. More...
 
#define DSP32_Q(fnum)   ((dsp32_t__) DSP_Q(DSP32_QA, DSP32_QB, fnum))
 Convert a float into a 32-bit signed fixed-point type. More...
 

#define DSP16_Q (   fnum)    ((dsp16_t__) DSP_Q(DSP16_QA, DSP16_QB, fnum))

Convert a float into a 16-bit signed fixed-point type.

#define DSP32_Q (   fnum)    ((dsp32_t__) DSP_Q(DSP32_QA, DSP32_QB, fnum))

Convert a float into a 32-bit signed fixed-point type.

#define DSP_FP_MAX (   a,
 
)    (((float) (1 << ((a)-1))) - DSP_FP_RES(a, b))

Return the maximal value of a fixed-point Qa.b typed number. The result is returned as a floating point number.

#define DSP_FP_MIN (   a,
 
)    (-((float) (1 << ((a)-1))))

Return the minimal value of a fixed-point Qa.b typed number. The result is returned as a floating point number.

#define DSP_FP_RES (   a,
 
)    (1./((unsigned) (1 << (b))))

Return the resolution of a fixed-point Qa.b typed number.

#define DSP_Q (   a,
  b,
  fnum 
)
Value:
(((fnum) >= DSP_FP_MAX(a, b) - DSP_FP_RES(a, b))?\
DSP_Q_MAX(a, b):\
(((fnum) <= DSP_FP_MIN(a, b) + DSP_FP_RES(a, b))?\
DSP_Q_MIN(a, b):\
(((fnum)*(((unsigned) (1 << (b))))))))
#define DSP_Q_MAX(a, b)
Return the maximal value of a fixed-point Qa.b typed number.
Definition: dsp_types.h:258
#define DSP_Q_MIN(a, b)
Return the minimal value of a fixed-point Qa.b typed number.
Definition: dsp_types.h:262
#define DSP_FP_MAX(a, b)
Return the maximal value of a fixed-point Qa.b typed number. The result is returned as a floating poi...
Definition: dsp_types.h:245
#define DSP_FP_RES(a, b)
Return the resolution of a fixed-point Qa.b typed number.
Definition: dsp_types.h:271
#define DSP_FP_MIN(a, b)
Return the minimal value of a fixed-point Qa.b typed number. The result is returned as a floating poi...
Definition: dsp_types.h:249

Convert a float into a signed fixed-point typed Qa.b.

#define DSP_Q_MAX (   a,
 
)    ((S32) (((U32) -1) >> (32 - ((a)+(b)-1))))

Return the maximal value of a fixed-point Qa.b typed number.

#define DSP_Q_MIN (   a,
 
)    ((S32) ((-1) << ((a)+(b)-1)))

Return the minimal value of a fixed-point Qa.b typed number.