Microchip® Advanced Software Framework

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

This module regroups the options used to configure the signed fixed point Q format.
This module regroups the options used to configure the signed fixed point Q format.
Here is a description of the Q-Format:
Q-format: Qa.b

Here is the formula linking a Q-format number (x) to a decimal number (d):

qformat_main_formula.gif

The resolution of a Q-formatted number is calculated as follow:

qformat_resolution.gif

The range of a Q-formatted number x defines the maximum and minimum numbers which frame x. Here is a formula to calculate those values:

qformat_range.gif

Example:
For the Q1.15 type:

  • Resolution: 0.00003
  • Range: -1. <= range <= 0.99997

For the Q1.31 type:

  • Resolution: 0.00000000047
  • Range: -1. <= range <= 0.99999999953

Here is a link where you can find more information http://en.wikipedia.org/wiki/Fixed-point_arithmetic on fixed-point formats.

Q Format definition for the 16-bit type

Note
The 16-bit functions are optimized to work with a Q1.15 format:
Resolution: 0.00003
Range: [-1.; 0.99997]
#define DSP16_QA   1
 number of integer bits More...
 
#define DSP16_QB   15
 number of fractional bits More...
 

Q Format definition for the 32-bit type

Note
The 32-bit functions are optimized to work with a Q1.31 format:
Resolution: 0.00000000047
Range: [-1.; 0.99999999953]
#define DSP32_QA   1
 number of integer bits More...
 
#define DSP32_QB   31
 number of fractional bits More...
 

#define DSP16_QA   1

number of integer bits

Referenced by dsp16_debug_print(), dsp16_debug_print_complex(), and print().

#define DSP16_QB   15

number of fractional bits

#define DSP32_QA   1

number of integer bits

Referenced by dsp32_debug_print(), dsp32_debug_print_complex(), and print().

#define DSP32_QB   31

number of fractional bits