LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change speed of stepper motor

Hi,

 

I'm a student and for a part of my thesis I need to control a stepper motor. For this I'm using a leadshine M542 driver and I control the driver with a NI9472 module. Moving from one point to another works. But when I start the motor needs to gradually speed up. Could someone help me to implement that code (I tried, see VI but it doesn't work)?

 

Thanks

0 Kudos
Message 1 of 9
(4,477 Views)

If you want the motor to constantly run, you should set the "Sample Mode" input of the DAQmx Timing VI to be Continuous.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(4,471 Views)

Hi,

 

But I need to do a certain distance. So I need to tell how much steps it has to do, isn't it?

0 Kudos
Message 3 of 9
(4,462 Views)

1. You would want to set your DO direction bit one time, outside the main loop, and be sure it's written before you start the Counter output task that issues step pulses.

 

2. According to the spec sheet, your 9472 doesn't *have* any counters, so, uh, there's *that*.

 

3. What's the larger context for this stepper motor motion?   Clearly you're looking for precise positioning.  How important are top speeds, motion times and motion smoothness?   The more you care about those things, the more important it will be to generate a friendly trajectory.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 9
(4,436 Views)

As Kevin said the 9472 doesn't have any counter so your method can't work.

 

An alternate (and more tricky way) is to use an oversampled digital waveform to create the pulse train with acceleration. To create the acceleration pattern you can use the Chirp Pattern.vi. You complete the number of pulses generated with a square wave pattern of the final frequency. I used the Boolean Crossing PtByPt.vi to create the final comb like waveform and then converted the result to a digital waveform.

 

Use Sampling Freq and #samples outputs to the rate and samples per channel inputs of the DAQmx Timing.vi and feed the digital waveform output to the data input of the DAQmx Write.vi (set to Digital Output 1 Channel N samples mode).

 

You can eventually reverse the acceleration pattern to create a decceleration pattern.

 

Ben64

0 Kudos
Message 5 of 9
(4,403 Views)
0 Kudos
Message 6 of 9
(4,388 Views)

@JefVanGorp wrote:

Hi,

 

I realy have 4 counters (http://zone.ni.com/reference/en-XX/help/370466W-01/device_pinouts/9472cdaqpinout/).

 

Jef


No, this is not what it says. The 9472 datasheet specifies that that the 9472 is compactDAQ counter compatible, meaning that some pins (PFI programmable function input) can be programmed to be used as counter input. The 9472 doesn't have any counter (see the specification tab http://sine.ni.com/nips/cds/view/p/lang/en/nid/208822), you need the 9472 to be installed in a chassis slot that have a counter. What chassis are you using it with?

 

Ben64

0 Kudos
Message 7 of 9
(4,373 Views)

Oh sorry, I'm using NI cDAQ-9174 chassis.

0 Kudos
Message 8 of 9
(4,355 Views)

The counters you have available don't support hardware-timed variable frequency output.  That feature came in with the DAQ-STC3 chip a few years ago for X-series and some other boards.  I don't know if any other cDAQ modules / chassis might support that feature.  I'd recommend checking into it because if available, it'd be a much better approach than a regular hardware-timed DO task.

 

Problem 2: your 9472 module only supports a 10kHz rate on its digital outputs.  That translates to a max 5 kHz pulse rate, which may be pretty slow for microstepping.  This kind of coarse time resolution also wreaks some havoc with frequency quantization.  You'd only be able to produce integer divisors of 10 kHz -- 5 kHz, 3.333 kHz, 2.5 kHz..., nothing in between.

 

Honestly, the hardware you have isn't a good match for this task.  Maybe you should look into an off-the-shelf stepper controller / indexer (distinct from the power drive you already have)?

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 9 of 9
(4,330 Views)