LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with program, taking samples

Hey y'all, I was wondering if I could get some help with a program I am trying to build.  I am attempting to run a daqmx-related program; it involves controlling a set of pistons w/ voltage and collecting data coming in from a set of sensors.  My largest issues at the moment are:

  • I want to be able to collect data only at certain points, not over the whole length of the program, i.e. run the program for 50,000 cycles, but only collect data 5-10 times every 5,000 cycles.  My previous problem was that the program would crash because too much data would be written to the target file.
  • When I try to run the program, I get the error "-20061" and I don't understand exactly what this means or what is wrong.

Whatever help you could provide would be much appreciated.  I have attached a copy of the vi that I am working on.  Thanks in advance!

 

-Hendrik

 

0 Kudos
Message 1 of 3
(2,368 Views)

Hi Stefenmcloven, 

 

The error you're seeing refers to a sampling rate error:

 

-20061 Error Invalid selection

Error occurred in [BlockName] step. A signal frequency is higher than half the sample rate (Nyquist violation) or conflicts with other frequency values.

 

You can fix this by increasing the sample rate or decreasing the frequency you are trying to write/read. 

 

I had a look through your code and I have a few comments on how you could achieve desired functionallity. 

 

If I understand correctly, you have input and output simultaneously, but at different rates. If this is the case you may want to have two loops running at different speeds to accomplish this. One way to do this would be through a producer-consumer architecture, you can find more information at this thread:

http://forums.ni.com/t5/LabVIEW/Producer-Consumer-Architecture/td-p/494883

 

A few other comments I have on this:

1) It is not a great idea to use both DAQ assist and DAQmx in the same VI, use one or the other but not both 

2) Nestled while loops may lead to unexpected behavior, as you will not be able to access the first loop while the second is running. Here's a good example on using the same producer-consumer architecture for writing data to a file. 

https://decibel.ni.com/content/docs/DOC-2431

 

Please let me know if this helps or if you have any other questions!

 

-N

National Instruments
Staff Certification Engineer
0 Kudos
Message 2 of 3
(2,324 Views)

Thanks for the pointers, I appreciate it quite a bit!

0 Kudos
Message 3 of 3
(2,305 Views)