Generating set amount of steps?

More
17 Jun 2016 01:39 #76193 by chevydan6
Is there software in LinuxCNC that allows me to generate a set amount of steps? Like enter 350 steps and the motors moves just that amount?

Please Log in or Create an account to join the conversation.

More
17 Jun 2016 09:53 #76201 by BigJohnT
Take a look at my stepper winder example.
gnipsel.com/linuxcnc/examples/winder.zip

JT

Please Log in or Create an account to join the conversation.

More
17 Jun 2016 10:58 - 17 Jun 2016 10:58 #76203 by andypugh
One way is this. You can do it from a simple HAL session at the terminal
halrun
loadrt stepgen
loadrt threads name1=base-thread period1=100000 name2=servo-thread period2=1000000

addf stepgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf stepgen.update-freq servo-thread
setp stepgen.0.scale 1
setp stepgen.0.maxvel 100
setp stepgen.0.maxaccel 1000
start

You can probably paste this into a terminal window then carry on, or save it as a file9(somename.hal) and then use
halrun
source somename.hal

You can now use commands like
setp stepgen.0.position-cmd 200
setp stepgen.0.position-cmd 0
to move the motor. And because the scale is set as 1 then the units are actual steps.
Last edit: 17 Jun 2016 10:58 by andypugh.
The following user(s) said Thank You: Clive S

Please Log in or Create an account to join the conversation.

More
17 Jun 2016 18:01 #76232 by chevydan6
so to reverse direction, do I just use -200?

Please Log in or Create an account to join the conversation.

More
17 Jun 2016 19:18 #76233 by andypugh

so to reverse direction, do I just use -200?


Yes. Or setp scale to -1 if you want.

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum