News:

Let's find out together what makes a PIC Tick!

Main Menu

Signed fraction Q15

Started by flosigud, Jun 27, 2025, 01:26 PM

Previous topic - Next topic

flosigud

Most ADI examples in Microchip dsPIC33F/PIC24H Family Reference Manual use this format. Could some kind soul explain this to me? What are the advantages and how to handle this.

top204

#1
Q15 is a 'Fixed Point' format of 'Q1:15', and is a faster method of using fractional values. It is not as accurate, or as flexible, as floating point, but is a lot faster, so it is excellent when used for audio or other calculations that do not need precise results.

See the 'Q15.inc' file in the Includes folder at: "C:\Users\User Name\PDS\Includes\". The procedures are for the dsPIC33 devices and are often used in the DSP routines for them. See the demo programs in the 'PDS' folder of the 'Samples24' directory, at: "C:\Users\User Name\Proton Source\Proton_Installer\All_Users-PDS\Samples24\DSP\"

It has procedures to convert Q15 to float and float to Q15 and calculations on Q15, and some trigonometry with Q15 formatted variables. Which are actually just 16-bit signed integers. i.e. SWord. Hence 1 bit for the whole number, and 15 bits for the fractional part.