LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to store data obtained from daq?

Greetings.

 

I have the following problem: I want to store the data obtained from my daq device (pci-6014), but I don't know how. I tried the Storage VIs, but I get the error -2558. I tried the measurement file, but it doesn't store the data continously (every random amount of time it just doesn't record the data, and I lose tons of info.) What can I do?

 

I need to record the data obtained from two channels of my daq device when I push a "record" button, and stop saving such data when I push a "stop" button (different from the stop application default button).

 

Can anyone help me out with this?

0 Kudos
Message 1 of 21
(4,913 Views)

 I tried the Storage VIs, but I get the error -2558.

 

If you have an error cluster showing an error, then once the program stops, you can pop up on the error cluster and ask to EXPLAIN ERROR.

If you do that for -2558, you probably get "LabVIEW cannot open the data storage file".

 

That means there's something wrong - I suggest you find out what.

Maybe your path is invalid.

Maybe your disk is write-only.

Maybe the file is busy.

 

Post some code and we'll have a better shot at helping you. 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 21
(4,897 Views)

Well, I knew about the error code. In fact, by searching through labview support I found out that due the the type of file (end-to-end type or something like that), the files can't be edited (funny thing, as if they can't be edited then how will I be able to create them in the first place?). 

 

I'll try to post some code, but that will have to wait until Tuesday (due to the work being in my office). In the meantime, can someone please give me some support on how to store data from the daq device (at a somewhat high speed rate without data loss)?

 

Thanks. 

0 Kudos
Message 3 of 21
(4,894 Views)

What does "somewhat high speed" mean to you?

If I'm monitoring temperatures, 10 Hz is high speed.  If I'm monitoring vibrations in structure, 10,000 Hz is high speed.  If I'm digitizing video, 10 MHz is high speed.

 

In general, without knowing any specifics about your system, here's the way I would attempt it:

 

  1. Decide if I need a single data file, or a directory structure full of files.  Only you can answer that.  I'll assume a single file for starters.
  2. Open (Create, actually) the data file. I'd use BINARY mode for speed.
  3. Set a WRITING variable to FALSE.
  4. Set up a task to continuously acquire data.  You only want to configure this task once, and start the task once.  You want a fairly large buffer.
  5. Have a WHILE loop running that reads N samples (waiting if necessary), checks the WRITING flag, and writes the latest batch of data to the file if set.  The loop is always reading the data, but not always storing it.
  6. Have another loop with an EVENT structure in it, handling the UI: If the START button is pressed, set the WRITING flag TRUE, if the STOP button is pressed, set the WRITING flag FALSE, if the QUIT button is pressed, terminate both loops, stop the DAQ, close the file.
  7. Write a separate function to read the file and graph it, or analyze it, whatever.

 

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 21
(4,892 Views)

I'm sorry if I keep bothering you, but I quite don't know how to do that. I'm just a beginner, and I don't have much knowledge about Labview. I understand what you are telling me to do (I thought of that), but I just don't know how to do it. I don't know how to open binary files, nor how to store the data in a buffer as it's been read. 

 

Ok, if you are still willing to help me, here's a bit more of specifications: I'm using Labview 7.1. I need to read samples at 100KHz (possible more). The samples come from two different channels, both of them must be recorded. I know I'm being a nuisance by asking, but, could you help me? I really need this, but I'm a bit clueless about Labview (and, I have to use Labview).

 

Thanks

0 Kudos
Message 5 of 21
(4,864 Views)

Take a look at the examples.  Under the HELP menu, choose FIND EXAMPLES and look in FUNDAMENTALS - FILE I/O.

There are examples dealing with reading and writing binary files there.

 

Study what happens there and apply it to your own situation.

 

As far as the "buffer" comment goes, NI-DAQ will take care of managing the buffer for you.  What I meant was to ask for a large buffer, since you will be writing to disk (a fairly long operation) while data is still coming in, so you need a larger buffer to hold the new stuff while you write the older stuff.

 

Also in the examples, take a look at HARDWARE I/O - DAQmx - ANALOG MEASUREMENTS - VOLTAGE.  You should find some examples dealing with continuous (as opposed to finite) DAQ.

 

HTH, 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 21
(4,844 Views)

 Ok, I tried the examples (specifically the High Speed Data Logger), and it works wonderful. But, now I have another problem. I want to apply an user-specified filter to the data I'm reading. I tried with the IIR filter vi, but it generates me an error (-20023).

 

Here, I'll upload the vi. It's mostly a modification of the example I used. 

 

Any help with this?

0 Kudos
Message 7 of 21
(4,805 Views)

Since you chose to acquire unscaled data, your signal has no timing information - no dt. Converting to dynamic data does not do any good. You should convert to a waveform data type and provide the dt information. You would use the Build Waveform function as shown below. Converting the output of the filter to a 2D array seems silly as well.

 

Convert to Waveform Array.PNG

Message 8 of 21
(4,801 Views)

 Ok, I did that, but I'm still getting the same error from the Filter VI. Searching, I found that such error is due to either wrong cut frecuencies (which it isn't the case) or "An array of data is being passed to the filter without waveform information".

 

But, am I not transforming the array into a waveform? Then, what's the problem?

0 Kudos
Message 9 of 21
(4,770 Views)

Put a breakpoint on the IIR FILTER vi, and trace your execution into it.  See what it comes up with for dT.

If it doesn't match your expected sample rate, find out why. 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 21
(4,768 Views)