LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ and motor control in the same VI

Hello,


I am a beginner in labview and I am trying to control a maxon motor and run a NIDAQ at the same time. Basically, I need to measure the pressures and the angles at the same time and record these.

 

The problem that I am facing is that when I execute the VI, the motor runs first and this is followed by the measurement. I have twiddled around with it a lot getting a lot of help from this community but I can't figure it out. No matter what I do the motor starts running first and after the motor has completed its movement then the DAQ takes the measurements.

 

Is there any way to run the motor and the sensors together? I can run the motor seperately and I can run the sensors separately in their own VIs but can't seem to run them sequentially.

 

Any help would be appreciated.


Aman

0 Kudos
Message 1 of 5
(3,195 Views)

In LabVIEW, your wires between VIs (and structures like While Loops) determine the order in which things happen.

 

There are several approaches that you can take to de-couple the motor and DAQ processes.  The most obvious would be to put the motor control in one while loop, and the DAQ in another.  Yes, you can do this in LabVIEW.  Just don't get too carried away.  Each loop usually will go to a separate core to run.

 

If there is data that has to be shared between the loops, you can use local variables, or the Value property nodes of the controls and indicators of your VI.

Machine Vision, Robotics, Embedded Systems, Surveillance

www.movimed.com - Custom Imaging Solutions
0 Kudos
Message 2 of 5
(3,158 Views)

Hi John,


Thank you for the reply. I changed the order of the VIs in the program and I am getting better synchronization between the motor and the DAQ assistant. Is there any way to make sure that they are both starting at the exact same time? As far as I can observe using the highlight option  in labview, the DAQ assistant starts acquiring data slightly earlier than the epos VI that triggers the motor.

 

Thank you,


Aman

0 Kudos
Message 3 of 5
(3,047 Views)

Sorry forgot to attach the image of the modified VI..

0 Kudos
Message 4 of 5
(3,042 Views)

For a simultaneous start, I would use the DAQmx Trigger VI for one channel. Then set the source to be the Start Trigger of the other channel.

Note: I see you are using the DAQ Assistant. There is a 'Triggering' tab in the DAQ Assistant properties. I'm not sure you can set the source to be the Start Trigger of another channel using DAQ Assistant.

 

DAQ Simultaneous Start Trigger.png

Taylor B.
National Instruments
0 Kudos
Message 5 of 5
(2,952 Views)