4
$\begingroup$

I want to convert the two's complement, 16-bit output from an ADC into a generic fixed-point format, $\rm Qm.n$, where $\rm m$ is the number of integer bits and $\rm n$ is the number of fraction bits.

Any hints/procedure to do this job would be appreciated.

$\endgroup$

1 Answer 1

14
$\begingroup$

You don't have anything to do, because $\rm Qm.n$ is just an "interpretation" of an integer. The only thing that really matters is that you need to correctly apply a shift operation when multiplying numbers; or when adding/subtracting numbers with different values of $\rm (m, n)$ - You can think of the $\rm Qm.n$ representation as a "tag" you attach to number, a bit like physical units.

In your case, the output of your ADC is an integer between $-32768$ and $32767$. This number can be interpreted as a $\rm Q15$ fixed-point number between $-1.0$ and $0.99997$. Or as a $\rm Q2.14$ fixed-point number between $-4.0$ and $3.99987$. Or as a $\rm Q8.8$ number between $-256.0$ and $255.992$. You don't have to do any arithmetic operation.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.