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?
Solved! Go to Solution.
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
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
And then the counter ouput is disabled. Any ideas on how can I solve this? Thanks.
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.