Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How to output custom TTL pulses for stepper velocity control

Hi,

I need to control the velocity of a stepper motor by using ttl pulses. 

 

I have cDAQ9174 and NI 9401 connected to labview in my windows PC

 

I need to create upto 1000 ttl pulses per second and repeat it in a loop.

I would create an array of ones and zeroes which are to be translated into +5v and 0v respectively.  I need a code to translate this array to ttl pulses.

 

I am new to labview so I have no idea where to start. If you have any solutions or suggestions, I'd be extremely thankful. Also, please direct me to the helpful resources.

 

Thanks

0 Kudos
Message 1 of 5
(5,457 Views)

Hi rmechoo,

 

There are a lot of great built-in examples that ship with LabVIEW. To access these from your LabVIEW window, select Help >> Find Examples. I recommend that you take a look at the “Counter – Finite Output” example which can be found in ‘Hardware Input and Output’ >> ‘DAQmx’ >> ‘Counter Output’.  

 

This code uses a counter to generate a series of pulses. The user can specify the frequency, duty cycle, and number of pulses to output.

Libby B.
Applications Engineering Specialist - RF Wireless
National Instruments
Message 2 of 5
(5,435 Views)

One thing to consider is that you cannot run a stepper motor with constant speed right from the start. 

 

Due to inertia of the motor, it has to start slowly (i.e. with low puls rate) and the puls rate must be increased continously. The rate of acceleration must be determined experimentally. Applying the full puls rate right from the start might lead to erratic operation of the motor. 

 

BTW motion controllers such as the FlexMotion boards have routines for ramping, but such a board will be overrated for simple instruments. 

Message 3 of 5
(5,424 Views)

Thanks Libbin_la_vida…,

 

I looked at the various examples. I need to have a large buffer of pulses which should be output continuously in cycles. Looks like the example "Counter (Buffered) - Continuous Output.vi" does a similar job. But in the example, there are just 4 output values, I need closer to 1000 so that I can make a cycle with 1000 values per second. This helps me have better velocity control. 

 

NI doubt.PNG

I believe the part marked above is where the output values goes into the signal. Is there any way to change that source to an array of values so that I can control the signal without the front panel, with a larger buffer?

 

I am including a picture of the velocity pattern I am trying to achieve so that you get a better idea.

velocity.png

 

Thanks

 

0 Kudos
Message 4 of 5
(5,416 Views)

Thanks for the input, Buechsenschuetz

 

I have a stepper motor driver that should take care of the starting velocity. Anyways, my required velocity incereases gradually. I am trying to figure out a way to have variable frequency pulses or to create pulses only when required according to the velocity. I want this change to be made though code so that I dont need to change it manually, which will disrupt the continuity of my cycles. It would be very helpful if you have any solutions for that.

 

Thanks

0 Kudos
Message 5 of 5
(5,415 Views)