From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use 2 digital outputs at the same time NI USB 6210 / Matlab

Solved!
Go to solution

Can someone help me please? I have a National Instruments NI USB-6210 board and I need to use it connected to a stepper motor drive to control it in open loop. For this I need a pulse train that controls the stepper motor to be output from one of the NI USB-6210's digital outputs and, at the same time, a pulse train to control the direction of the stepper motor that is output from another of the NI USB-6210's digital outputs. How can I do this using Matlab's data acquisition toolbox?

0 Kudos
Message 1 of 5
(1,514 Views)

Hi Gabriel,

 

Not hard.  You're essentially looking for 2 functions from the USB-6210.  You'll need:

 

1. Counter output, to generate a pulse train for your stepper motor: https://www.mathworks.com/help/daq/generate-pulse-data-on-a-counter-channel.html

 

2. Digital output, to control direction of your motor: https://www.mathworks.com/help/daq/generate-non-clocked-digital-data.html

 

-John

 

Message 2 of 5
(1,488 Views)

Hi, John! Thank you for your help. The problem is that when I add the digital output for the direction control I get the following warning:

 

Warning: Added channel does not support clocked sampling: clocked operations are disabled. Only on-demand operations are
allowed.

 

And then the counter ouput is disabled. Any ideas on how can I solve this? Thanks.

0 Kudos
Message 3 of 5
(1,467 Views)
Solution
Accepted by topic author GabrielPGSilva

The digital task for direction control can be software-timed (a.k.a. "on demand", meaning: make no config calls to DAQmx Timing).  Set the direction DO state via a software call and then after DAQmx Write returns, generate your pulse train.  This was what I meant over here.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 4 of 5
(1,459 Views)

Thanks Kevin, you're absolutely right.  Didn't realize this was a double post.

0 Kudos
Message 5 of 5
(1,455 Views)