-4
$\begingroup$

In my project, the ADC is an 16-bit unipolar type, 0 - 3.3 V. This 16-bit data we are making as bipolar ($-1.65$ to $+1.65$ range), converting as Q15 data.

The conversion is as follows.

Q31_data = (q31_t) ((16bit_ADC_data- Offset) <<15) 

Here I am making it as a Q30 format, so I'll get Q30 (range is $-2$ to $+2$).

We only have the Q format like Q31, Q15 and Q7 (the processor is a 32-bit ARM Cortex-M4), FFT and FIR is a Q31 format.

My input range is $-1.65$ to $+1.65$, and then I am doing the above scaling process.

If my input range is $-5$ to $+5$ that time I want to multiply with 3.03 (in hardware if the input is $-5$ to $5$ attenuate as $-1.65$ to $+1.65$ in software we are reconstruct to the $-5$ to $+5$ range).

Then this data I want to process to FIR and FFT. For this case, I didn't get an idea for scaling. How I can muliply 3.3 with a Q31 value? How do I do this? Is it possible to do?

$\endgroup$
2
  • 4
    $\begingroup$ I have a very hard time reading this and trying to understand what you're really asking... Could you try rephrasing your question to make it simple and clear? $\endgroup$ – Lorem Ipsum Oct 12 '11 at 18:40
  • 1
    $\begingroup$ Didn't you ask pretty much this same question about a month ago ? dsp.stackexchange.com/questions/173/… $\endgroup$ – Paul R Oct 13 '11 at 12:45
4
$\begingroup$

I think what you are asking is how to convert your samples (which are $16$ bit values) back to the original $+-5V$ range.

I'd ask why?

You have numbers between $-32768$ and $32767$ which you know represent $-5V$ to $+5V$. Just carry on, doing your processing as you require. Keep track of the conversions "in your head" (in code comments if it gets complex). The processor has no idea about the real world and just sees numbers: it's up to us to put meaning on the numbers.

If at some point during the processing you need to convert some value back into a voltage, then (assuming you haven't scaled the signals any more during the processing), just perform a linear scaling to convert the numbers back to volts. You'll get very close by multiplying the internal number by $5$ (take care to use a wide enough data type to not overflow) and then dividing by $32768$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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