LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using pulse width with DAQ to control stepper motor speed

I am trying to generate a pulse width in Labview, and then use a physical counter output on my 6216 USB to the Stepper motor controller. The problem I am having is trying to have DAQ actually output this "virtual" generated pulse created in a VI. Is there a better way to do this? Eventually I am making a program that will have the user specify the speed of the motor, and labview will know by the control number what timed pulse to send to the little motor driver, hence moving the motor at the intended speed. Any ideas or help would be greatly appreciated.
Jody M.
The Procter and Gamble Co.

Currently using LV2018.
0 Kudos
Message 1 of 6
(4,235 Views)

Using a NI PCI 6601 as an example...

You can either set up the channel and task in DAQmx or you can set it up programmatically in your code; lets look at programmatically in the code.

This is a quick and dirty pic to explain what I am saying below. 

Counter timer.JPG

 

Placing something like this in a loop will allow the user to change the duty cycle and frequency of the counter output, thereby changing the speed of the stepper.  You may need to use a signal conditioning device in between the DAQ device and the motor, but you will know better as it is your application.  If you do need to use a signal conditioning device, be careful that it can handle the range of frequencies you may need to output.

CLD | CTD
LabVIEW 2011 SP1 | TestStand 4.5
0 Kudos
Message 2 of 6
(4,229 Views)

I added the above function and I got this error:

 

200459 "No output channels in this task to which data can be written". I used a global daqmx channel. what am I doing wrong? Thanks.

Jody M.
The Procter and Gamble Co.

Currently using LV2018.
0 Kudos
Message 3 of 6
(4,207 Views)

I am not familiar with the product you are using (6216 USB); I assume that the counter/timers on the device are input/output.

If they are not input/output and only input, that would be the problem.

If they are input/output, then the DAQmx channel/task is set as acquire signal when it should be generate signal.

CLD | CTD
LabVIEW 2011 SP1 | TestStand 4.5
0 Kudos
Message 4 of 6
(4,195 Views)

Ok, I was able to semi-solve the problem. All I had to do was create a tax and use the physical counter output as the source. I was then able to control the pulse width with Duty Cycle and Frequency. Now I just need to find the best way to keep the memory from running out on me. I may ditch the counter output and go to a simple digital output. At least  now I know I can create a virtual wave, control it, and physically output it from the DAQ.


Thanks to those for there advice and help.

Jody M.
The Procter and Gamble Co.

Currently using LV2018.
0 Kudos
Message 5 of 6
(4,190 Views)

z2830than,

 

I hope it's not too late for you, but here's a great developer zone that allows you to do pulse width modulation on just DO lines.  You might not need to worry about memory leaks with this code.  I hope it helps.

ColeR
Field Engineer
0 Kudos
Message 6 of 6
(4,160 Views)