Login

Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.

ARM Community: Type conversion(short to Q15)Dear all - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Type conversion(short to Q15)Dear all

#1 User is offline   Ali Asadzadeh 

  • Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 01-March 11

Posted 30 July 2011 - 09:17 AM

Dear all

I have sampled some data using a 16bit ADC the data is inshort(16-bit int) format, now I want to use the Cortex CMSIS DSP library to do some calculations likecalculating rms values.I have used the arm_rms_q15function, but the input to this function is in q15 format. How can I convertthe short and other int types to the data that has been used in this library?

Any ideas are welcome.


0

#2 User is offline   Christophe31 

  • Member
  • Pip
  • Group: Members
  • Posts: 17
  • Joined: 06-July 11

Posted 01 August 2011 - 01:23 PM

Hi,

I don't know that library, but look at that wiki link !

Q15 is particularly designed for data ranging [-1;+1[ (like result of sin/cos).

For RMS calculation, I think the result should have the same scale as input data (could someone confirm please ?).

So, if your input data is unsigned, divide by 2 (to preserve the sign bit), transmit to RMS function, then mult by 2 for having same scale that original data. You loose 1-bit of precision.
If your input data is signed (2's complement), transmit as it is.
If your input data is signed (shift signed), sub 0x8000 then transmit.

For a better help, you should provide the physical representation of data returned from ADC, e.g. :
phy range : [0;5[ volt <==> data16 : [0x0000;0xFFFF] (unsigned)
or [-5;5[ volt <==> [0x8000;0x7FFF] (signed 2's complement)
or [-5;5[ volt <==> [0x0000;0xFFFF] (shift signed)
etc.

Regards

Christophe
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic