Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control whether writting data to the file or not before runs?

Solved!
Go to solution
Hi all,
 
I'm doing multiple channels DO, AO and AI. I want this DAQ programme run continuously at 100K S/s. After I acquire the data I want to write them into a file. But rather than write the whole data block, I would like to write only some of them. A digital wavefrom is generated to determine which part of the data block is to be written, in which high stands for writting and low for not to write. I used a queue to store the acquired data, and I want to do the "filtering" things in the dequeue part so that it won't slow down the acquistion. I think there may be 2 ways to do that, by controlling the enable state of writting fuction or extract a subset of the data block. For the second manner, I need to extract several subsets from a single array (data block), I don't know how to do that. Could any one give me some advice? Or, is there some other way to implement the "segmental writting"? Thank you all.
 
Best wishes
Bo
------------------------
My blog Let's LabVIEW.
0 Kudos
Message 1 of 6
(3,587 Views)
Hi Bo,
 
I have done and attached an example of data acquisition and analysis using producer/consumer loops. Using queuing no data is lost.
 
However, for your application time may be critical.. so synchronization may need to be considered more.
 
Also, with the example, you may want to do the 'its switch true aka is digital waveform high' test in the consumer loop.
 
Im not sure how you'll keep the timing for the data if (in my example) we only write values when 'x' is true..
 
let me know what you think, and maybe you could attach your code to allow me (and others) to get more involved.
 
Have a great day,
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 2 of 6
(3,574 Views)

Hi Hillman,

Thank you for your reply and your code. Sorry I didn't programme the "data selection" part yet, so I cannot show it to you. In your code, you enqueue the data when the switch is on. But since I need to do the DAQ at 100k S/s and I'm afraid the selection in the enqueue part might slow down the acquisition. I prefered to do it in the dequeue loop. I think I didn't describe my question clearly, and the selection is set 'before' we acquire the data. e.g.
I set the manner of selection as 00011111000111, which is transmitted from a digital waveform set by the user. And if the data acquired later is ABCDEFGHIJKLMN, then the data written into the file should be DEFGHLMN. So will it be a better way to extract a subset from the data block right before we write it?

Regard,

Bo

------------------------
My blog Let's LabVIEW.
0 Kudos
Message 3 of 6
(3,554 Views)
Solution
Accepted by foolooo
Hi Bo,
Thanks for replying - I did suggest the filtering may need to be done in the de-queue loop.
I have pulled together another example - built on top of the original.

It does exactly what you’re talking about in your latest post.

i.e.
It could take in N samples from your DAQmx task so you keep your 100k S/s rate, queues them.
Then in the de-queue part, it goes through sample per sample, and if the digital line (switch) is high it writes them to file (tdms).
You may need to consider the amount of memory the buffer (in the queue is using).
Also, my only want to write to fill once as writing to file in every loop will take a lot of time (relativity). Therefore, maybe write to an array firstly. Then after all the samples have been filtered, write to file.

I hope this makes sense, please post again soon if you wish to discuss this further.
Regard,

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 4 of 6
(3,543 Views)

Hi Hillman,

Thank you for your reply and your code. I'm trying it and I believe this is the right way. Thank you so much.

Best wishes,

Bo

------------------------
My blog Let's LabVIEW.
0 Kudos
Message 5 of 6
(3,505 Views)

Hi.

Thanks for the reply.. its always nice to hear good feedback.

Good luck with it all.

Have a nice day.

Regards

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 6 of 6
(3,503 Views)