User Controlled Pulse Out For Stepper Drive Control


brianw

Recommended Posts

I am not a programmer at all, but for some reason I thought I could kludge together a script that allowed the user to define a frequency of outputs from a LabJack T7 to be sent to a stepper motor control board to control the RPM of the motor.

 

Well, so far I am totally wrong about that.

 

Are there any examples of script that I could use as inspiration?

 

So far the examples I've tried have failed.

 

Thanks

Link to comment
Share on other sites

The motor is a Vexta C6132-9012-C1, it's a 4V 1.2A 2-phase 1.8deg per step 4-wire stepper. I was planning on using a driver board to control the stepper and then send user defined pulses to the board. I don't have the boards or any good documentation about them yet. The motors are salvage and all the info I have is printed on the motor case. The Vexta website wasn't too helpful in providing more info.

 

Right now I am using the WHILE command with an array in DAQFactory to allow the user to modulate pulse frequency. I suspect that I will be limited to a relatively low RPM for the motor because of the small rotation per step (200 steps = 1 rotation). Is there a better way to get fast pulses out?

 

I'll post more info once I get my hands on the docs for the driver boards.

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...
1	//modulate an output
2	global FqA = 0.1
3	while(FqA)
4	   arraystep(outA,{0,1})
5	   delay(FqA)
6	endwhile

I've tried to get the pseudo code generator to work for me but the T7 doesn't respond to the code when I try it through DAQFactory. Where would that code be executed from to get the T7 to respond?

 

I have had some success with the WHILE command through DAQFactory (shown above, where FqA is the user defined value), but the learning curve for someone without any background in this is pretty steep and I'm having a hard time getting the system to work the way I'd like. Hopefully a little practice will help.

 

Thanks for any guidance.

Link to comment
Share on other sites

That sequence can be written a bit simpler:

 

global FqA = 0.1

while(1)

   outA = !outA[0]

   delay(FqA)

endwhile

 

arrayStep() is a deprecated function.

 

Unfortunately not everything can be right out of the box simple, largely because everyone wants to do something slightly different.  The only way to make a program or hardware that can give everyone what they want is to use scripting.  By taking the time to learn some basic scripting you will empower yourself to do many, many different things that you would not be able to do with some sort of canned software that generates square waves.  For example, if you wanted to do a variable pulse chain, 0.1 seconds on, 0.2 seconds off, 0.3 seconds on, 0.4 seconds off, repeat, the script is simply:

 

while(1)

   outA = 1

   wait(0.1)

   outA = 0

   wait(0.2)

   outA = 1

   wait(0.3)

   outA = 0

   wait(0.4)

endwhile

 

BTW: I used wait() here because wait() won't propagate meaning the spacing remains the same even though outA = 0 or outA = 1 takes a finite amount of time.  The loop will run at exactly 1 second no matter what.  With delay() the loop takes slightly longer than one second because each output takes a few milliseconds.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.