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.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Stepper Control on cDAQ-7192 through NI 9401

Hello,

I'm a senior Electrical Engineer at Rensselaer Polytechnic Institute trying to perform basic stepper motor control via LabVIEW for a project and, having only limited training with the programming environment, have been muddling through the basics for some time. I currently have a pulse control sub-vi (screenshot attached) that generates a pulse signal for a specified number of output "toggles" before exiting. The vi works as expected both alone and in the main program, however "pulse output" data is not seen by the main program during execution (the information doesn't seem to be passing from the sub-vi to the main vi).

What is the proper method for getting this pulse data from the sub-vi, to the main vi, and to the DAQ Assistant so that it can be sent to the stepper? Are there any good tutorials for this type of control that I may have missed? (I've read the "9401 four pulse trains gen.vi," numerous cDAQ getting started manuals, and searched the forums as of yet to no avail)

Thanks!

- Trevor
Download All
0 Kudos
Message 1 of 3
(4,082 Views)
Any thoughts on this? Am I interfacing the pulse signal incorrectly with the DAQ Assistant using the 'Build Array' function?
0 Kudos
Message 2 of 3
(4,059 Views)
Hi Trevor,

To answer your question about dataflow, a common way to get data out of a subVI is the method that you used with the terminals. From a brief look at your code, the use of local variables seems extraneous but everything seems to be functional. The section titled Using Local and Global Variables Carefully in the LabVIEW in the LabVIEW help gives good advice on the use of local variables. I noticed that there is also a stacked sequence structure with 20 frames in it. Is this particular frame being reached? I would recommend using other tools such as highlight execution and probes to see how the data is being transferred within your program.

I assume that you are trying to write a port of digital data with the DAQ Assistant in your code. Currently, you have a 1-D array of boolean wired into it, one boolean for each line which will update whenever the loop is ready to run. I was wondering if you needed any specific timing between the pulses. The pulses being generated may be too fast to be detected since the current VI will run as fast as the processor allows. To add timing in software, you can add a Wait function inside the loop with the pulse control subVI. The NI-9401 is a correlated DIO module which means that it will support hardware timed generation. To accomplish this, an array of boolean data or a digital waveform will have to be written to each line. For more information on how to do this, see the hardware timed digital generation section starting at the bottom of page 35 in the NI-cDAQ 9172 User Guide.

Regards,
Kent
Applications Engineer
0 Kudos
Message 3 of 3
(4,042 Views)