LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop timing to control DAQ Write to File

Hi everyone,

 

I have a relatively simple problem that I cannot seem to solve (brain is fried, too many late nights on working, I think?)...

 

I want to program my DAQ so that "X" seconds of data is written to file every "Y" seconds for a total of "N" loops then stop... I need to be able to view continious data on the chart; but I only want to periodically save segments of this data....

 

Attached is my vi... Pretty sure I am on the right track (?)... Can't seem to put the final pieces of the puzzle to togther...

 

Any help/suggestions greatly appreciated.

 

Regards,

Jack

0 Kudos
Message 1 of 4
(2,291 Views)

Hey Jack,

 

The example you have just described sounds like a perfect "Producer-Consumer" set up.  You can view a sample one of these in the NI Example Finder.

 

In this scheme, you would have two loops running and pass the data between them using Queues.  One loop  is used to produces data, where your DAQ would be, and the other which consumes the data, where your write to file would be.  This way you can use separate timings in each loop to ensure that you are acquiring and writing data at the correct rates.

 

I hope this helps.  Your code looks nice - a good way of using time stamps and a shift register but I feel that you will get a lot of joy with the producer-consumer.

 

Regards,

Robert Ward
Applications Engineer, NI
0 Kudos
Message 2 of 4
(2,284 Views)

Hi Robert,

 

Thanks for the reply... I am familiar with the P/C loop... But not sure how it relates the interval-based write to file set-up I am seeking... Although I do normally use the P/C loop for saving continous data...

 

Either way, after a good night sleep I managed to get it to work... See attached if you are interested.

 

Regards,

Jack

 

Message 3 of 4
(2,252 Views)

Jack,

 

That code looks nice - good job.  Although PC is a good architecture I guess it is not always necessary for the task you are trying to solve... something you just showed well.

 

Hope the project goes well.


Regards,

Robert Ward
Applications Engineer, NI
Message 4 of 4
(2,245 Views)