LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Read in Event Stucture

Solved!
Go to solution

Hi everyone,

 

I am currently working on a DAQ application which will (ideally) have 3 DAQ tasks sampled at different rates with the results displayed on different charts.

 

I am using a USB-6009 alongside a cDAQ-9174 with 9201 and 9211 modules so should have enough clocks.  I would like the application to be able to either sample continuously or for a finite time dependant on user input.

 

After reading the DAQmx help files and looking at the example code I have come up with some code for a single task; I have attached a snippet and the VI.

 

The code is acting almost as expected, when "Capture" is clicked the DAQ task starts reading data and displaying it every 0.1s.  The issue I am having is that I am unable to select the "Stop Test" button to end the read.  I am guessing it is because of the event structure, but I don't know how to solve the problem.

 

I would like to develop a program which will read from all 3 tasks simultaneously in this single event.  I have limited experience so any and all help appreciated! Smiley Happy

 

Many thanks,

 

Peter

 

 


Regards,

Peter D

Download All
0 Kudos
Message 1 of 6
(2,986 Views)

Fast fix (quick and dirty). In the event structure -> event to aquire the data. Unselect 'lock front panel until event is completed'.

Long term solution: Use a message handler (kind of producer/consumer design).

BTW: The error wire on the while loop needs a shift register!

 

Felix

Message 2 of 6
(2,980 Views)

@f. Schubert wrote:

BTW: The error wire on the while loop needs a shift register!

 


Why do you say that?

 

If there is an error coming in or an error generated by the DAQmx read, the while loop will only run once and the error will be passed out.  No need to try to return it to the beginning of the loop since it won't run again.

 

If there is no error, there is not need to return it to the beginning of the loop since you've already established that there is no error coming in.

 

In this piece of code, a shift register doesn't hurt, but it also isn't needed.

Message 3 of 6
(2,963 Views)

Thanks for the quick replies, I have changed the 'lock front panel..' and it now works to plan.

 

I have another task which I would like to run in parallel with this task (as part of the same event).  If I just repeat the code and change the tasks it will work, but there is a delay between each.

 

How can I syncronise these to start at the same time?  They are both Continuous AI Voltage but they have different sample rates.  Synchonising the 'Stop' would also be useful.

 

Many thanks,

 

Peter


Regards,

Peter D

0 Kudos
Message 4 of 6
(2,943 Views)
Solution
Accepted by topic author Pete.Dunc

You need a shared start trigger. See this document for more infomation:

http://zone.ni.com/devzone/cda/tut/p/id/3615

 

Felix

Message 5 of 6
(2,933 Views)

I used the same concept but triggered from te0 on the cDAQ.  I have attached the code snippet.

 

Problem solved! Smiley Happy I still need to add the 3rd device but I have an understanding of the concept now.

 

Now onto analysis and control, I will no doubt have another post for that!

 

Thanks again,

 

Peter


Regards,

Peter D

0 Kudos
Message 6 of 6
(2,910 Views)