LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ read in a loop with finite samples

Solved!
Go to solution

Hi,

 

I'd like to acquire data from an instrument with a 6024E board and then fit the peaks and repeat that at the highest possible frequency. The DAQ task is configured for finite sampling using a trigger signal generated by the instrument (55Hz).  When I use a VI such as demo_v1 (see below) everything works fine but it takes around 200ms just for the DAQmx read VI to execute.

 

demo_v1.png 

 

It seems that starting the task outside the loop (see demo_v2) helps to reduce acquisition time but it does not work anymore with finite sampling. If I configure the task for continuous sampling the synchronization with the instrument trigger is lost.

 

demo_v2.png 

 

How can I overcome this problem?

Bernard 

0 Kudos
Message 1 of 15
(6,853 Views)

You can reserve the task before the while loop.

Also put the data handling in a separate loop and send the data with a queue to that loop.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 15
(6,849 Views)

Hey,

 

You wrote: "The DAQ task is configured for finite sampling using a trigger signal generated by the instrument (55Hz).  "

 

By "trigger" you mean that your Task runs with an external sample clock of 55Hz?

In general, why don't you use continous sampling and read 100 samples with every iteration of the loop?

 

 

Christian

0 Kudos
Message 3 of 15
(6,837 Views)

No, actually the task runs with an internal sample clock of 18kHz to measure a signal which is generated by the instrument every 18ms (55Hz). If I use continuous sampling it will not be synchronized with the instrument.

 

I'll try to reserve the task as Ton suggested and keep you informed on the progress.

 

Bernard 

0 Kudos
Message 4 of 15
(6,833 Views)
Solution
Accepted by topic author bernaille

Ok, thanks for the clarification.

Another hint would be to use retriggerable AI, which means you combine a Counter Task - which is retriggerable - to generate a sample clock for your AI Acquisition. E.g. everytime a trigger arrives from your instrument you take exactly 100 samples with the Clock generated by the Counter Task.

 

Christian

Message 5 of 15
(6,829 Views)

Hey,

 

Not sure to understand exactly how to reserve the task. I tried something like that (see below) but it didn't change much. I also tried to implement the queuing. Is this what you meant?

 

demo_v3.png

 

Thanks,

Bernard 

0 Kudos
Message 6 of 15
(6,816 Views)

Thanks Christian for the suggestion. If I understood well, you suggest to create a second task for the same board? As far as I know one can't do that with the kind of DAQ boards I have (PCI-6024E). Do you have an example?

 

Bernard 

0 Kudos
Message 7 of 15
(6,813 Views)
sorry edited out
Message Edited by Broken Arrow on 10-23-2009 10:12 AM
Richard






0 Kudos
Message 8 of 15
(6,805 Views)

Have a look here, in the LabVIEW examples (Help->Find Examples) do a search for retriggerable. The 6024E is explicitly named.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 9 of 15
(6,769 Views)

Bernard,

 

You said: "... you suggest to create a second task for the same board? As far as I know one can't do that with the kind of DAQ boards ....."

 

You can create different Tasks for AI, AO, DIO and Counter, but you cannot create more then one AI Task running at the same time (one timing source, multiplexer, ...).

Just have a look at the example suggested by Ton, then you will see it's a Counter Task generating the timebase for your AI Task.

 

 

Christian

0 Kudos
Message 10 of 15
(6,764 Views)