LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ramp Function for Driving Motor

Hey, all. 

I'm completely new to LabVIEW and trying to learn as I go. I'm currently trying to develope a code that ramps up the voltage to a stepper motor, holds for some time, and then ramps back down to 0.  Does anyone have a straight forward technique for doing this or is there a built in function?

Also, attached is a code I found online to Drive the motor.  As of now, I have been trying to modify this code to include a ramp up and down.

 

Here is a list of the hardware I'm working with: 

NI PXIe - 1078

NI SCB - 68 M series pinout 

Big Easy Driver (2A/phase at 16 microsteps)

Wantai Stepper Motor  2A, 1.8 deg/step  (Model: 57BYGH420)

 

Any tips or advice is appreciated.  Thanks.

0 Kudos
Message 1 of 3
(3,115 Views)

The first problem that jumps out at me is that you are creating and destroying your channels in every loop iteration.  This is a common beginner mistake.  You should create and configure your channels prior to the loop, do your reading and writing inside the loop, and then destroy your task outside of the loop.  You can search for example under help\find examples\hardware Input output\daqmx.



-Matt
0 Kudos
Message 2 of 3
(3,111 Views)

Start here.  Think about what you want to do, what kind of input you want (i.e. a voltage, a number).  You also need to think about "living in a digital world", where there is no such thing as a "smooth ramp", but rather a series of "tiny little steps" that approximate a ramp.  With that in mind, think about the timing -- how often do you want to generate a new step, how many steps, how will you time it, etc.

 

There are functions that will return ramps of, say, N points, but there's still the timing issue to consider.  If you have a loop running at a certain speed (say 100 Hz, or 0.01" per loop) and want to go from 0 to 1 in 5 seconds, a bit of "back-of-the-envelope" calculation says if you run your loop for 500 steps and increment a value starting at 0 by 0.002 per step, the value will go from 0 to 1 in 5 seconds.

 

Bob Schor

0 Kudos
Message 3 of 3
(3,067 Views)