LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquisition buffer

Solved!
Go to solution

Hi,

I'm a beginner in LabVIEW and NI DAQmx. My objective is to do a simple acquisition program using a cDAQ and a NI 9236 module.

The acquisition must be at 2400 Hz to be able to detect any error in the system. However, if there isn´t  any, data must be stored at 1Hz in binary, to be processed afterwards.

I have used a producer/consumer loop system in order to achieve that, where only the data belonging to the slower sampling rate is sent to the queue.

The program is sometimes giving me errors I can't identify. If someone coud give me some tips for improving it I would appreciate it. 

On the other side, I´ve read than in continuous acquisition it's better to make use of the input buffer and read N samples in order to keep up with in software. Currently the program is simple but I would like to be able to make progress on it. Is there any intuitive way of taking only the needed samples out of the 1D waveform array its generated on the DAQmx read function? 

 

Thanks!

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

Hi Beginer,

 


@BeginerInLV wrote:

My objective is to do a simple acquisition program using a cDAQ and a NI 9236 module.

The acquisition must be at 2400 Hz to be able to detect any error in the system.


  • That module does not support a sample rate of 2.4kS/s as is written in its datasheet! (Did you read it?)
  • Reading just one sample at a (desired) sample rate of 2.4kS/s is not recommended! I usually recommend to read 1/10 of the sample rate, so 240 samples in your (desired) case...

@BeginerInLV wrote:

The program is sometimes giving me errors I can't identify. If someone coud give me some tips for improving it I would appreciate it. 


Unless you tell us which errors you get we also cannot identify their source!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(1,020 Views)

Hello GerdW,

 

As I understand this module`s sampling rate can go up to 10kS/s, but it's minimum rate is 794 S/s. Therefore my desired value is within rage, am I wrong?

 


@GerdW  ha escrito:
  • Reading just one sample at a (desired) sample rate of 2.4kS/s is not recommended! I usually recommend to read 1/10 of the sample rate, so 240 samples in your (desired) case...


There lies my second question, when I obtain multiple samples per channel, how can y divide them in a sensible way so that I can gather only the needed samples?

 

As for the errors, the main one was that the consumer loop wouldn`t stop when the stop button was pushed. I've solved it adding a timeout value in the dequeue function and it seems to work. 

 

Regards

0 Kudos
Message 3 of 4
(1,000 Views)
Solution
Accepted by BeginerInLV

Hi Beginer,

 


@BeginerInLV wrote:

As I understand this module`s sampling rate can go up to 10kS/s, but it's minimum rate is 794 S/s. Therefore my desired value is within rage, am I wrong?


Yes, you're wrong. Again: did you read the datasheet?

The NI9236 does NOT offer a "range" of samplerates, but a "number" of samplerates!

Your desired samplerate is not within the given numbers…

 


@BeginerInLV wrote:

There lies my second question, when I obtain multiple samples per channel, how can y divide them in a sensible way so that I can gather only the needed samples?


When you want to save just one sample of 2400 samples you might consider using the mean function for each block of 2400 samples…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(987 Views)