Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop a DAQ Assistant within a while loop

Hi:
 
does anybody know how to stop a DAQ Assistant within a while loop?
 
I have two while loops running concurrently. One is for driving a motor and the other is for measuring. In some specific cases (for example measuring a too high torsional moment OR move of the motor is complete OR a stop button is pushed) both loops should stop concurrently. I created local variables and wired them to the stop buttons of the two while loops (so that they stop concurrently), but the DAQ Assistant of the one while loop doesn't stop when the other loop stops. I tried to wire the "stop cases" to the stop of the DAQ Assistant (instead of the stop of the loop), but then an error occurs which says that the DAQ Assistant is reserved?
If I want to run the DAQ Assistant for a specific time, I wired the desired time to the time out of the DAQ Assistant. Is this correct?
 
Thank you!
0 Kudos
Message 1 of 6
(4,046 Views)
Hi Steffi,

please  post your VI, so I can take a look at it.

Daniel
NIG
0 Kudos
Message 2 of 6
(4,030 Views)

An almost duplicate post Smiley Wink

see here

0 Kudos
Message 3 of 6
(4,026 Views)

Hi Daniel,

 

thanks to Dev I know now why it's not working: I'm allowed to have one task in one block diagram only (I had two). I also know how I can create a second channel in the DAQ Assistant (same task). But there is still only one entrance for the data in the DAQ Assistant and as you can see in my VI I want to write different data to the two different channels (5V DC to the one and a square wave to the other).

 

I have attached my VI (even now I know it's wrong, but I don't know how to do it in the correct way). Maybe you can help me.

THANKS!

0 Kudos
Message 4 of 6
(4,010 Views)
Sorry, here is the attached VI...
0 Kudos
Message 5 of 6
(4,009 Views)

Hi Steffi,

yes, your right. There is always just one Data Input for a DAQ Assistant! But that is no problem. You simply have to merge the signals together (Merge Signals.vi). Below there is a example (motor1.vi), that shows how to do that. The tricky thing is, that you had to different data typs involved (one dynamic and one waveform). Choose either dynamic or waveform for your signals, so you won't run in to conversion problems.
I also added two other VIs (motor2.vi and Config.vi). This VI does exactly the same, as the motor1.vi, except that it's using Low-Level programming, which is much more efficient. The configuration of the task is done within the Config.vi (as you can see the data matches the configuration of the DAQ Assistant). By right-clicking a DAQ Assistant you can select "Create NI-DAQmx-Code" ("NI-DAQmx-Code erzeugen") to generate the Low-Level code from the DAQ Assistant. Also, the motor2.vi uses a 1D Array of Waveforms instead of the dynamic datatyp.
With the two examples added it should not be a problem to continue working.

Bye

Daniel
NIG

Download All
0 Kudos
Message 6 of 6
(3,997 Views)