03-11-2022 02:55 AM
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!
Solved! Go to Solution.
03-11-2022 03:22 AM
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.
@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!
03-11-2022 06:10 AM
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
03-11-2022 07:48 AM - edited 03-11-2022 07:51 AM
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…