From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong time increment are writen out in text file with "Write to measurement" function

I am using NI USB-6361 to collected voltage data from system. The block diagram as what I showed below in Pic. 1, it is very straight forward, It is like a While loop includes DAQ assistance and Write to measurement. I set 500 as samples to read number, 1000 as rete. However when I check the text file which was written by Write to measurement function, the time increment column have big time gap at the end of each 500 samples, as shown in Pic. 2. 

 

Also I tried DAQMX serious instead DAQ assistance to acquire signal, now the time increment delay onset to each of samples. It shown in Pic. 3.

I am so confusing about what is happening, and please help me to solve this problem!  

Download All
0 Kudos
Message 1 of 9
(2,663 Views)

Well, LabVIEW needs time to write to the file before the loop can go to the next iteration, at which time the DAQ needs to start again. You want to use lowlevel daq and file IO and a produce/consumer architecture to take the file IO out of the DAQ loop.

0 Kudos
Message 2 of 9
(2,645 Views)

sorry what are lowlevel daq and produce/consumer architecture means? and If I move the Write in measurement out of loop, it will not write in data anymore.

0 Kudos
Message 3 of 9
(2,639 Views)

"Baby LabVIEW" (Express VIs and dynamic data) are not suitable if performance is an issue. As a first step, go here and look for the section "LabVIEW training resources". Then look at the examples that ship with LabVIEW, and search the forum for similar questions.

0 Kudos
Message 4 of 9
(2,634 Views)

I have been using Labview for 1year, I have never met this problem because what I am currently using is the only DAQ card without chassis which means no embed clock. And during last couple, days I tried all potential block diagram, none of them work. And I search through the form and did not find any solution. That is why I am need help, if you can give me the rough ideal with a block diagram, I will really appreciate. 

0 Kudos
Message 5 of 9
(2,631 Views)

Hi John,

 

if you can give me the rough ideal with a block diagram, I will really appreciate. 

- LabVIEW comes with a huge library of example VIs, lots of them dedicated to explain (nearly) all aspects of DAQmx! (NONE of those example VIs use the DAQAssistent…)

- There is this wonderful article about DAQmx!

 

On your task:

When you set a sample rate of more than 100Hz you should NEVER use DAQmxRead with mode "1 chan 1 sample"! Use "1 chan N samples" with "number of samples" set to ~ 1/10 of the sample rate to read an array (or waveform) of samples! Reading just one sample is way too demanding for such a task…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(2,621 Views)

@JohnJoy wrote:

.... because what I am currently using is the only DAQ card without chassis which means no embed clock. .....


The USB-6361 with its price tag and its 2 MS/s sampling rate certainly has an internal clock!

0 Kudos
Message 7 of 9
(2,590 Views)

Go to the Help Menu then Choose Find Examples, search DAQmx  Voltage - Finite Input or Continuous Input. Those VIs are extremely helpful for getting started. They also have logging built in, so no need for producer consumer.

 

mcduff

Finite Input ExampleFinite Input Example

 

 

 

Message 8 of 9
(2,582 Views)

@GerdW wrote:

Hi John,

 

if you can give me the rough ideal with a block diagram, I will really appreciate. 

- LabVIEW comes with a huge library of example VIs, lots of them dedicated to explain (nearly) all aspects of DAQmx! (NONE of those example VIs use the DAQAssistent…)

- There is this wonderful article about DAQmx!

 

On your task:

When you set a sample rate of more than 100Hz you should NEVER use DAQmxRead with mode "1 chan 1 sample"! Use "1 chan N samples" with "number of samples" set to ~ 1/10 of the sample rate to read an array (or waveform) of samples! Reading just one sample is way too demanding for such a task…


Better yet use 1 channel n samples with samples to read =-1

Why are you not using TDMS. and the DAQmx LOGGING feature?  (Look in the examples)  Tha DAQmx logging is hyper-optomized with streaming to file that is ORDERS OF MAGNITUDE. Faster than Write to measurement express.vi set to text data.

 

Some of my fellow Champions need a DAQmx refresher.  Look around the Badge section for free training.


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 9
(2,569 Views)