0

Im reading a sine wave from a wave generator with a Labview FPGA code, when the frequency is around 1Hz, this is what I read (as expected) enter image description here

However when I increase the frequency, this happens.

enter image description here

I see that the ticking speed does not change, so I think it would be solved if it accelerated just as much as I needed to match my sine wave. Also, I passed the data through a FIFO and to a .txt file that I then plotted and I cant see the sine wave either, so its not only a problem of the chart display.

How can I control this?

PS. I checked my hardware and it supports 50 MS/s, so it should not be a problem to nicely read a 10 Hz sine wave. In particular, Im using the NI 5751 ADC, FPGA 7951R, PXI 1071 chassis.

This is the code enter image description here

  • You are talking about code but I can see only two plots. Maybe the LABVIEW scheme does not translate well to the FPGA world but I am sure there are several example codes around for this kind of application. Did you check for those first? – Christian B. Apr 22 '21 at 15:43
  • @ChristianB. I just added the code. I cannot find any example actually. Besides, I think this should be easy enough to do it myself and learn in the process, but Im stuck – Juan Pablo Arcila Apr 22 '21 at 16:44
  • As far as I can see from the code, there are two main parameters which influence the acquisition speed. One is clock you are using - you can see this in the project explorer under FPGA target. It defines frequency (fclk) of clock that your FPGA uses. Other is Loop Timer VI which you use in the loop of VI you provided. Your sampling period should be roughly 1/fclk * number of ticks (in your case, this is defined by Count(usec) control wired to Loop Timer) if I am not mistaken. So, if you want to sample faster, trying to decrese Count(uSec) value would be my best guess. – Kerghan Apr 23 '21 at 12:00

1 Answers1

1

You are seeing Aliasing of the data being presented in your waveform.

In this case it is due to a significant under-sample rate of the data that is being passed up to your waveform. As @Kerghan mentioned, the primary issue here appears to be that your data rate for grabbing is not correctly related for the data sampling you are trying to see. I would suggest that if you are trying to see a 10 Hz waveform you should be using a minimum display rate of 20 Hz ( 50000 uS ).

As an aside, you have fallen into a traditional LabVIEW trap for developers coming from text based languages. I would recommend that you remove the Flat Sequence Structure from the code, as this is enforcing the following logic:

  • Wait X uS of time
  • THEN read data from the AI If the time taken to read the data and write to the DMA is non-zero, your timing will be off by just the slightest amount and it will be very hard to tell why.
Steve
  • 963
  • 5
  • 16