LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why can I only write the samples to read during continuous acquisition?

Solved!
Go to solution

I am acquiring analog voltage signals and attemting to write to a text file when condition is true, thus there is continuous acquisition. However, the written files only contain 100 samples (the size of my buffer).. I need my files to read samples until the while loop is stopped. How can I go abotu doing this?

 

Thanks,

 

TFlax

0 Kudos
Message 1 of 7
(3,242 Views)
Could you post your code? You have not provided many details. Could it be that you've set whatever file write function to overwrite previous data? For continuous writing, you should be using a producer/consumer architecture.
0 Kudos
Message 2 of 7
(3,229 Views)

see response below

Message Edited by Online Courses on 12-21-2009 02:23 PM
Message Edited by Online Courses on 12-21-2009 02:23 PM
0 Kudos
Message 3 of 7
(3,195 Views)

Hi Tflax,

 

Without looking at your code, I believe what you are encountering is the fact that you are calling the "Write To Text File" VI multiple times but always passing in the same file reference. This is a problem because whenever you open that reference using the "Open/Create/Replace" VI by default the position that LabVIEW will write to is the beginning of the file. If you would like to write to the end of the file, use the "Set File Position" VI in the advanced file i/o functions. Set the "from" input to "end" and leave the number of bytes unwired (default 0) or wire a 0 and now you will write at the end of the file.

 

Currently you are writing continuously but over-writing each time. I agree with Dennis that if you are writing continuously we typically recommend a producer/consumer architecture, however if your rate is low enough your method will work fine.

With warm regards,

David D.
0 Kudos
Message 4 of 7
(3,190 Views)

I have been able to make this work, but  it only writes the buffer size. I am new to labview and programming in general and I have tried to make a producer and consumer design however I dont seem to understand the concept properly and fail to run my program properly... So here's my code before any attempt to producer/consumer design which only writes 100 samples to file. Advice on how to modify it to producer/consumer because Im not even sure where to start.

 

Thanks,

 

Tflax

0 Kudos
Message 5 of 7
(3,112 Views)

Double click on your writ to measurement express vi and go under the Action section and select Save to one file and then under If a file already exists, select Append to file. Hope this helps!

 

-RW

0 Kudos
Message 6 of 7
(3,095 Views)
Solution
Accepted by topic author Tflax

Hi Tflax,

 

The key here is the mechanical action of the "Start Collect" button. Since the mechanical action was "latch when released" the "true" value would be read once and then go back to false, so the write to measurement file "enable" input would only be true once, hence it would only write to file once.

 

Check out this KnowledgeBase and the "Mechanical Actions of Booleans.vi" example it mentions.

 

As for Producer/Consumer, I searched "producer consumer" at ni.com and came up with a description (first result), a tutorial, and an example using DAQmx all on the first page of results. Definitely utilize ni.com search because we have a lot of valuable resources available there.

With warm regards,

David D.
0 Kudos
Message 7 of 7
(3,092 Views)