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.

Example Code

Stepper Motor Driver with USB9472

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview
The example demonstrates how to interface a stepper motor driver using the NI USB 9472

Description:
This example was for a customer who had a USB-9472 and wanted to interface it with a stepper motor driver. This example could also be of interest for any programmer coding a software timed clock signal.
The inputs of this particular motor stepper driver were as follows:

  1. Clock Signal
  2. MS1
  3. MS2 (MS1 and MS2 used for step resolution of the stepper motor)
  4. Direction
  5. On/off for stepper motor driver
  6. 12VDC-24VDC
  7. 0VDC

WARNING: This particular driver was able to take inputs from 3.5-24VDC. The USB-9472 is a High Voltage Digital Output so the supply voltage for the stepper motor was also the supply voltage used for the 9472 and the outputs of the 9472 were all at a high voltage. Always check the input specs for the driver.
One caveat of this system is that it is a software timed clock. Typically a user would want a high frequency and more consistent clock. Since it is software timed a frequency of 50 Hz was all that could be attained. With any software timed clock the pulse will sometimes take longer or shorter depending on the operating system and its processing load.


Walkthrough:
The basic outline of this VI is that it uses a DAQmx driver to update the USB-9472. The VI initializes the output cluster, updates it every iteration of the loop, converts the cluster to an array, and outputs to the pins of the USB-9472. Initializing the cluster uses local variables of Booleans on the front panel. This was done instead of an empty cluster because the initializing cluster gets sent to the DAQmx Write before being updated. Further documentation is located in the block diagram of the VI.

Steps to implement or execute code
To implement this example:

  1. Define the Ports to be used
  2. (optional) Set the rest of the parameters as needed
  3. Run the VI
  4. (Optional) Turn on the Highlight Execution to see the flow of the VI

To execute this example:

  1. Install the required software.
  2. Connect the DAQ hardware that supports the Digital Output features
  3. Confirm the connection with the MAX with TestPanel
  4. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible
NI-DAQmx 16.0 or compatible

Hardware
cDAQ with C series Digital Output Module

 

fp.JPGbd.JPG

**This document has been updated to meet the current required format for the NI Code Exchange.**

Ben J.
National Instruments
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Jeck avla
Member
Member
on

I would like to ask how did u conect the motor to the DAQ??

Marand
NI Employee (retired)
on

Hi,

I would like to know if you used an specific H Bridge in order to connect the USB-9472 to the stepper motor, because I was searching some H Bridge but they do not have the same signals that you created as an output in this vi.

Thank you for your help