LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

No data received in continuous data acquisition when without delay in the reading loop

During continuous sampling, if there is no delay in the loop and the read number is set to -1, no data will be collected.

Is there no data in the buffer (according to the documentation, all data in the buffer will be returned when the read number is set to -1)???

 

nzywlll80gmailcom_0-1691407127171.png

 

 

 
0 Kudos
Message 1 of 4
(667 Views)

nzywlll80@gmail.com wrote:

During continuous sampling, if there is no delay in the loop and the read number is set to -1, no data will be collected.

Is there no data in the buffer (according to the documentation, all data in the buffer will be returned when the read number is set to -1)???

 

nzywlll80gmailcom_0-1691407127171.png

 

 

 

That is expected.  Since there is no delay there is no time to collect any samples and place them in the buffer and you return no samples.  A totally useless loop unless you simply want to use a CPU core to generate heat.

 

I can't read the enum and poly selector texts.  How is the Task timing set up?


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 4
(661 Views)

number of samples per channel specifies the number of samples to read. If you leave this input unwired or set it to -1, NI-DAQmx determines how many samples to read based on if the task acquires samples continuously or acquires a finite number of samples.

If the task acquires samples continuously and you set this input to -1, this VI reads all the samples currently available in the buffer.

If the task acquires a finite number of samples and you set this input to -1, the VI waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the VI reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.

 

Upon is the original text from the LabVIEW Help file, try to wait 1 second after starting sampling, but before getting into the loop. set a wait funtion in the loop, the wait time should longer than your sampling time.

 

AnalogInput ----sampling----> Buffer --------DAQmxRead-------> Your Indicator

0 Kudos
Message 3 of 4
(645 Views)

As was stated previously, when in Continuous Acquisition mode reading -1 samples will just immediately return all samples currently in the buffer.  So occasionally, you will get a single sample returned.

 

The proper solution is to set the number of samples to read at the DAQmx Read.  Or, if your sample rate is really slow (I see your sample rate is 10S/s = 100ms/sample), use the Single Channel->Single Sample mode of the DAQmx Read and it will then return a value when a sample comes in.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(617 Views)