LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous vs N samples in DAQ assistant

Can anyone explain the difference between N samples and Continuous in DAQ assistant?

I am counting external pulses coming into a counter, using the same pulse train as the external clock.

During configuration of the DAQ assistant, if I set to N samples (200) and use the test function, then I acquire a buffer with 200 readings as expected and the task stops. (as expected)

If I switch to Continuous samples and use the test, the counts scroll continuously through the 200 long buffer until I stop the task manually (as expected)

When I place the task on the block diagram, I get a message telling me to put the task in a loop. If the loop is not present, the task takes 200 readings and stops, even if set to continuous. Why doesn't the task continue until stopped as during the test?

The only difference I can find between N samples and Continuous is that the counter is reset at the start of each block of 200 when set to N samples.

Ok for a counter, but what about analogue etc and why the difference between the behaviour during test and on the block diagram?

0 Kudos
Message 1 of 5
(15,320 Views)

A continious task will try to keep all the samples in memory.

So you have a sample rate of 2 kHz, you read 2000 samples, wait 2 seconds and read againg 2000 samples, than these two sets should be timewise directly connected to each other (and you will find still 4000 samples in memory).

For a N samples task, you will read 2000 samples and then the acquisition will stop and you will have a gap in your data stream.

 

My advice is to use a continous task with a value of -1 (read all available samples) and wait x ms value inside a loop. The x will normally be set to 100 so you will read your buffer every 100 ms.

 

A N samples task is only interesting if you are investigating something that is started by a trigger.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 5
(15,313 Views)

Thanks for the advice.

I have set up a simple VI (attached) with a counter DAQ assist set to timeout -1, continuous with 10 samples. The output is displayed on a numeric counter, as is the iteration count of the while loop.

If this arrangement is the only thing on the block diagram, then all works as I expect. The counts increase with the external pulses (approx 500Hz sq wave) and stop when they do. The input count is 10 x the loop count and stops immediately the external pulses stop and restarts with them.

 

If I add a second while loop containing a front panel switch connected to an indicator, then the data counter and loop counter continue to count up even when the external pulses have stopped. The DAQ assistant finally produces error - 200141 Data overwritten before it could be read by the system.

 

If I change to 1 sample the behaviour is the same, but the two counts are always the same.

 

Any ideas.

 

Colin

0 Kudos
Message 3 of 5
(15,299 Views)

Hi Colin,

 

Just to say I was able to get the VI working in LabVIEW 8.6 by altering the configuration of the DAQ Assistant as shown in the attached jpeg.

 

I suspect the issue may be that you have not specified which PFI line to reference as the clock source.

 

Hope this helps,

 

Best Regards,

 

Steve

 

 

 

0 Kudos
Message 4 of 5
(15,255 Views)

Thanks for looking at this. I think that I have now found out what is going on.

I am running Labview 8.6 on an old PC, which will be used to run a dedicated piece of test equipment. Machine is about a 1GHz P3.

The problem occours with an input pulse frequency of around 1kHz. If I reduce the frequency to about 100Hz, the counters are able to keep up in real time and everything works as expected.

There appears to be buffering going on and the effect is similar to the old problem of holding you finger on a computer key and the repeats keep going long after you take your finger off the key.

Fortunately, I can use a lower pulse frequency on this machine so problem is worked around.

 

Colin

0 Kudos
Message 5 of 5
(15,236 Views)