LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing a continuous input to a finite number of samples.

Hello,

 

I have modified the "Voltage-Continuous Input VI" example so that it acquires from multiple channels and writes to a text file. I am having trouble however when I try to change the sample mode from "finite" sampling to continuous "sampling". I set the "samples per channel" input on the DAQmx Timing VI to 100,000, which is the buffer size recommended for the 250KHz we are sampling at; and I set the "number of samples per channel" input on the DAQmx Read (VI) to -1. 

 

I get the error Error -200088 occurred at Voltage - Continuous Input.vi.

 

Can anyone suggest a recommendation on how to fix the problem?

 

Thank you. 

0 Kudos
Message 1 of 5
(1,896 Views)

Can you upload your code for LV 2012? Here is a help document on the error but I have no idea if it is relevant for you:

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000004AE6SAM

0 Kudos
Message 2 of 5
(1,883 Views)

Your code seems to show Finite Samples, not Continuous.  Also, I cannot find the Control "Number of Samples" -- it is hidden somewhere.  Your code seems to take only one set of data, then stop.  Where does it fail?

 

Have you ever considered writing a very simple VI with a single channel, sampling at 1000 Hz for 1000 samples (or 1 second), and simply plotting (or making an array of) the results?  Just to see that something works?  If it does, then start getting fancier, add channels, change sampling rate, number of samples (where is that control?), etc.

 

Sometimes it is better to "write your own simple code to do the one thing you want" than to take someone else's code that "handles every possible contingency, whether or not it is relevant to what you want to do".  You learn more the DIY route ...

 

Bob Schor

Message 3 of 5
(1,856 Views)

Here is the 2012 version, I got a warning that some of the VI's might break, not sure if they are not compatible with the 2012 version. Let me know if you can't open it and thank you so much for your willingness to try and help.

0 Kudos
Message 4 of 5
(1,825 Views)

Open up the original shipping examples for both Finite and Continuous sampling.  There's a few more differences than just that single setting when calling DAQmx Timing.   If you want to switch from Finite to Continuous, it's simpler to start from the example for Continuous than to modify the example for Finite.

 

The main thing is that for Continuous Sampling, the call to DAQmx Read will typically be in a loop so that data can be read, um, *continuously*.   You'll also note that you should specify an actual positive # of samples to read.  -1 has a special meaning and the behavior is different for Finite vs Continuous sampling tasks.

 

For Finite tasks, it means "wait for all samples to accumulate and read them all at once".  For Continuous tasks it means "don't wait at all, just give me all the available samples I haven't read before."   If you don't otherwise slow down your continuous reading loop, it'll iterate really really faster, and many of the reads will return 0 samples because you're requesting new ones faster than the task is sampling.

 

 

-Kevin P

Present job ending soon. Need DAQ expertise? PM with serious opportunities.
0 Kudos
Message 5 of 5
(1,813 Views)