LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a cDAQ to control a stepper motor

Hi,

I am relatively new to LabView. I am designing a program to control a stepper motor. I have attached a copy of my VI below. Basically I am trying to send a set of pulses from the DAQ to the stepper motor driver (L298n) and then get the driver to move the stepper motor.

The pulses that I am trying to send are.

1000

0010

0100

0001

I have tried this with an Arduino and it works just fine, however the stepper seems to jam when i try it on the DAQ.

Any help would be greatly appreciated.

0 Kudos
Message 1 of 7
(3,303 Views)

Please attach a VI Snippet/image of your code, not everyone has LV 18 yet.

0 Kudos
Message 2 of 7
(3,300 Views)

Hi BertMcMahan,

I have attached a picture of the VI and a corresponding block diagram. It works for longet time delays but the moment I start to reduce the delays everything starts to go wrong.

Download All
0 Kudos
Message 3 of 7
(3,260 Views)

What is the point of the multiple loops? 

 

You are writing to all four DAQ assistant outputs randomly, with no synchronization between the two loops. Just use one loop - use dataflow to enforce the DAQ write timing. 

0 Kudos
Message 4 of 7
(3,257 Views)

Okay, will try that and see how it goes.

Thanks

0 Kudos
Message 5 of 7
(3,253 Views)

I'd *strongly* recommend not using DAQ assistants and coding it directly. If you MUST use DAQ assistants, just use one, not four, as they can become desynchronized easily.

Message 6 of 7
(3,222 Views)

Thinking about it again... I bet your four assistants are the problem. With no way to enforce which one fires first, your step/direction pulse pattern won't generate properly. Use only one assistant and it'll probably work fine.

0 Kudos
Message 7 of 7
(3,200 Views)