LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Building a array form Signal from DAQ

Hello all

I have a problem with building an array from the DAQ signal. The signal itself is an oscillating signal with fast frequency. The frequency of data can be changed in broad range so defining the exact frequency is not necessary(it's dependent on mechanical movement). I have used DAQ assistance VI to control the sampling rate and sample per channel and used output signal to build an array to make waveform chart plot. The reason why building an array is to find peak and valley of an oscillating signal. However, when I build the array from DAQ assistance VI data, I get 'chunk' of data plot, mean there is too many data points in single x(time) value [Plot LASER in image]. So, I have tried to pull out single data column from the 'chunk' data, but if I use this code, oscillation frequency does not measure properly.

I am assuming that buffer from the computer is too slow, or using array building is not a good coding to acquisition these data.

what is the problem with this?

any new idea to plot this?

 

thx

p.s. sorry for the Korean language in img

 

Download All
0 Kudos
Message 1 of 4
(4,207 Views)

You should really forget using DAQ Assistant. It can be useful for fast testing, and for slow signals, like temperature. If you need to deal with high sampling rate, I really advice you to use proper low level DAQmx functions. There are lots of examples shipped with LabVIEW, you can find these via the Help menu.

Another problem, if you use build array functions as you do, they introduce a nice memory leak in your code. Your code will crash eventually due to memory overload.

What I advice:

  1. Start learning LabVIEW via the available resources (Core 1-2)
  2. Have a look at the DAQmx functions: https://www.ni.com/en/support/documentation/supplemental/06/getting-started-with-ni-daqmx--main-page... (forget using the DAQ Assistant Express VI)
  3. In general, if you have high sampling rate, it is a good idea to decouple the DAQ part from the Data analysis/display/file logging. What you can use is the so called "Producer Consumer" design pattern. In this case you have two parallel while loops, one is exclusively for fast DAQ. The data reaches the second while loop (analysis, display, file logging) via a lossless Queue.
0 Kudos
Message 2 of 4
(4,165 Views)

Hello, I have tried to not use DAQ assistance VI and used lower level DAQ VI(which are formed in following order; create channel  VI> start task> Read VI (analogue N channel N sample 2D DBL and analogue N channel N sample 1D waveform, I made 2 version) > stop VI.

However, like you mentioned "if you use build array functions as you do, they introduce a nice memory leak in your code. Your code will crash eventually due to memory overload", still occur during acquisition. (the graph I get after the array builder contains a lot of different color of lines) So, I am trying to get information directly from the DAQ board in waveform, not by re-making array.

 

  •  let me briefly introduce what I am trying to do.

            I am building a home-made FTIR, and the code that you have seen yesterday is for the HeNe Laser signal detection code. However, with my older version code, I have encountered the problem that 'arrayed' signal is not exactly same as waveform that I am looking with my oscilloscope. The information that I need for my system is 'peak and valley' of HeNe signal; the oscillation frequency and # of oscillation in time scale. Since, HeNe Laser signal detecting is critical part of FTIR, I need to get information of Laser fast as I can and accurately. 

 

  • Waveform analyzing 

            So, I have been trying to analyze waveform directly from DAQ board. I have used Get waveform components and index waveform array VI to get information from the waveform. However, I don't see a difference between doing so with building a array. Do you have any suggestion with waveform analyzing?

 

Thank you

 

0 Kudos
Message 3 of 4
(4,095 Views)

I can only repeat what I already wrote in my previous post. You should first learn the basics of LabVIEW programming before trying to code your application. You will see it will help a lot, and the invested time will pay back later.

 

You should first create a producer/consumer design, and get the waveform data via the Queue into your Consumer loop. Try to go step by step. First you should only program the DAQmx part for the top loop, and make decision about the timing (sampling rate, number of samples, etc.). For a first version of your code, try to plot only the incoming data (inside the Consumer loop!) without any data analysis. Post your VI (or project zipped) here, so people can have a look and advise you...

 

When this first step is done, and your code works OK, you can try to program the data analysis part.

0 Kudos
Message 4 of 4
(4,084 Views)