Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Contributor
fabiend
Posts: 45
Registered: ‎07-22-2009
0

SNR, THD... in EDK !

Hi everybody,

 

I implemented an external 16 vits ADC using the SPI connection, and it works fine (great!).

 

I save the different output values of this ADC in a board in my C program.

 

Now, I have for example 1024 points, which are on 16 bits. When I make the FFT on matlab of a 1 kHz, the results are quite good.

 

Now, I would like to measure the SNR, and the THD of my sinewave, and store the value in my program... 

 

Do you know if it's possible to measure the SNR and THD using a C program ? If yes, could you give me some information, because I did not find anyone on the internet.

 

If it's not possible, do you know how can I measure it and store the results ?

 

Best Regards,

 

Fabien .D

Contributor
jimbrady
Posts: 48
Registered: ‎06-12-2009

Re: SNR, THD... in EDK !

As you may know, a common way to measure S/N and distortion is to use a good notch filter to remove your 1KHz, and look at what is left.  The same data that you compute S/N with will also give you THD.  See Wikipedia "signal-to-noise ratio" and "total harmonic distortion"  for the math.

 

So what I would suggest is to find some C code on the web (or have Matlab generate it) for a good notch filter (either FIR or IIR), implement that,  and run your A/D samples through that.

 

Alternatively, you could implement an FFT in C code to compute power spectrum, run your A/D samples through that, and compare the power at 1KHz to other stuff, like 2KHz, 3KHz, etc.

 

If you are using the C compiler in Xilinx Platform Studio, you can use floats, and can configure your MicroBlaze for floating point support to speed it up.

 

Jim

 

 

 

Contributor
fabiend
Posts: 45
Registered: ‎07-22-2009
0

Re: SNR, THD... in EDK !

Thanks a lot,

 

I'll see that ! :)

 

Fabien