LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Acquisition and Save into a text file

Hi,

I am using cRIO-9215 with USB-9162 to talk to my PC.  I am trying to acquire 3 channels of inputs sampled at 500Hz and display them and write the data into a text file at the same time.

1.   Is "while loop"  a  necessity  here  in my case?

2.  How do I manage my data flow?  Is it supposed to be array or something else?

3.  What is the difference between using "write to text" and "write to measurement file"?

4.  I got an error message as follow

Possible reason(s):

 

Attempted to read a sample beyond the final sample acquired. The acquisition has stopped, therefore the sample specified by the combination of position and offset will never be available.

 

Specify a position and offset which selects a sample up to, but not beyond, the final sample acquired. The final sample acquired can be determined by querying the total samples acquired after an acquisition has stopped.

 

Attempted to Read Sample: 1000

 

Property: RelativeTo

Corresponding Value: Current Read Position

 

Property: Offset

Corresponding Value:



Can any one explain what it means to me?


Thanks much.
0 Kudos
Message 1 of 2
(2,784 Views)
Hey hellolv,

In general you would need a while loop when you want an acquisition to be continuous rather than finite.  There are examples for both in the Example Finder.  For a continuous acqusition you would need a way to stop the daq, so that's why you need the while loop.  Your dataflow will be controlled by how the connections are made to each VI.  A VI cannot execute unless each connection has data.  Your data can be whatever you want, which all depends on how you need to display it.  There is one main difference between the writing to text and to a measurement file, and that is if you would like to use these files externally or only in LabVIEW.  If you aren't going to use them with anything but LabVIEW then a measurment file will work well.  External applications such as Excel will be able to use text files much easier than a measurement file.  Lastly, your error message looks like it is occuring due to a mismatch between the number of points available and the number of points being acquired.  This could be due to the two DAQmx read VIs that you are using which could cause that error and throw off the daq. 

Hope this helps!  Repost with any questions.
Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 2 of 2
(2,754 Views)