From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW DAQmx-6001 DIO Pulse generation

Solved!
Go to solution

Hey All,

 

     I am working with a linear motor and trying to measure the speed using an laser measuring setup that outputs an analog voltage based on distance using a DAQmx-6001 analog input. But that is for another forum post...  I just wanted to give you a general idea of the scope of the project.

 

     I am currently trying to actuate the drive signals to a motor controller which accepts a logic-low input signal.  There are two inputs, one for motion left, one for motion right. Using my DAQmx-6001, I am trying to generate a 100ms pulse to actuate the motor in one direction, pause for 1000ms, then actuate the motor in the other direction with a 100ms pulese, then pause for 1000ms.  This repeats until the user stops the loop.

 

     Using the DAQmx Assistant I am able to "test" the controller by pressing RUN and the signal DOES indeed actuate the motor.  The motor moves so I know the electrical setup works and the DAQmx-6001 is able to to control the motor.  My code however does not actuate the motor.

 

     Attached is my VI and a PNG of the block of code that should actuate the motor.  I am at a loss of what I am doing wrong as this should be a simple DAQmx Write.  When I run the code nothing happens.  The motor does not actuate in either direction.

 

     Using the Highlight Execution feature, I get an error 200088.  I searched for this and was unable to find a cause of why this is happening...

 

     Any help would be much appreciated!

 

I am using LabVEIW Version 13.0f2

DAQmx-6001

 

Thanks,

Nicholas

0 Kudos
Message 1 of 5
(4,244 Views)
Solution
Accepted by nnagrodski88

Well, I don't have a USB-6001, try to avoid the Dreaded DAQ Assistant, and am allergic to Sequence Structures and Local Variables, especially when it obscures the objective.

 

To replace the DAQ Assistant, I opened MAX and created a Task that used a USB-6002 (which I do have) and two lines of a Digital Output (since you want to change two channels at the same time, why not make a task that ... changes two channels at the same time?).  I noticed that you basically have four cycles of boolean settings for specific times, which suggests a 4-For Loop (a For loop with 4 wired to N), with a Case Statement to select Cases 0 .. 3.  If you stop at the end of the 4-cycle, the final State is T, T, so you don't need a special Exit condition.

 

Note -- after I coded this up and got it ready to send, I noticed that I should have put the Stop control inside Case 3.  Exercise for the Reader -- why?

 

Here's a Snippet (in LabVIEW 2016) -- the VI is attached as LabVIEW 2013.

 

Linear Sweep.png

Bob Schor

 

Message 2 of 5
(4,183 Views)

Hi nnagrodski,

 

to add to the other suggestions above:

in your DAQAssistent you created a task containing 13 DIO lines. In your VI you try to set just one line - and then you wonder about this error message.

 

Did you read the error message?

Why do you even mix DAQAssistent with standard DAQmx functions? They are so easy to use, you don't need any Assitents here!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 5
(4,158 Views)
@Bob_Schor wrote:

try to avoid the Dreaded DAQ Assistant

 

^^  Best help I could have asked for!  And thank you very much for your solution/example.

 

I have the working solution below using sequence structures and local variables (sorry).  Thanks again for your time!

 

Linear Motor - DIO Drive Solution.PNG

 

 

 

0 Kudos
Message 4 of 5
(4,132 Views)

Hi nnagrodski,

 

I have the working solution below using sequence structures and local variables

Just to give an idea of a (simple) state machine:

check.png

State 3 issues a TRUE to stop the loop…

(You are free to improve this very simple implementation!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 5
(4,127 Views)