Lathe Question

More
13 Apr 2011 18:00 #8849 by Scout
Lathe Question was created by Scout
I built a lathe type machine with a stepper driving the spindle (rotating the workpiece). I would like to keep it turning at a constant speed while the tool completes several motions then turn off when the tool completes its motions. As a newbie to g-code I don't see how to accomplish this. Could somebody help get me started by suggesting if there is a g-code to use to turn on a constant rotational speed.

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

More
13 Apr 2011 18:26 #8852 by BigJohnT
Replied by BigJohnT on topic Re:Lathe Question
Is your spindle configured as a spindle or a rotating axis?

John

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

More
13 Apr 2011 18:38 #8855 by Scout
Replied by Scout on topic Re:Lathe Question
It will be a rotating axis.

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

More
13 Apr 2011 18:59 #8864 by BigJohnT
Replied by BigJohnT on topic Re:Lathe Question
I don't think this is possible... but I might be wrong. Normally commands that move axis when combined with a rotary all want to end up at the end point at the same time AFAIK.

John

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

More
13 Apr 2011 23:20 #8885 by Scout
Replied by Scout on topic Re:Lathe Question
Thanks. That was my reading of the g-codes but I thought maybe I was missing something. I have a work-around but it seemed rather crude.

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

More
14 Apr 2011 10:02 #8893 by Rick G
Replied by Rick G on topic Re:Lathe Question

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

More
16 Apr 2011 16:21 #8984 by Scout
Replied by Scout on topic Re:Lathe Question
Thanks again. Very interesting but I don't see how I can use it in my situation because I need it configured as a steppr later in the program. I think I've found a simple solution --- I'll just keep adding 360 degrees till I get the rough in done. Should work fine. Not up and running yet so won't know for awhile. You guys are a great resource.
:)

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

More
16 Apr 2011 17:01 - 16 Apr 2011 17:06 #8985 by andypugh
Replied by andypugh on topic Re:Lathe Question
It is possible to have both a velocity-mode and position mode stepgen running in HAL, and to swap which one is connected to the parallel port (or other IO card)
This HAL file does it by using a set of "and" "not" and "or" functions to swap the connected stepgen under the control of motion.spindle.is-on.
unconventional parts in green

loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt hal_parport cfg="0x378 out "
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0,0,0 ctrl_type=p,p,v,p
loadrt pwmgen output_type=0
loadrt scale
loadrt and2 count=5
loadrt or2 count=2
loadrt not count=1
loadrt comp count=1
loadrt conv_s32_float count=1


addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf and2.0 base-thread
addf and2.1 base-thread
addf and2.2 base-thread
addf and2.3 base-thread
addf and2.4 servo-thread
addf or2.0 base-thread
addf or2.1 base-thread
addf not.0 servo-thread
addf comp.0 servo-thread
addf conv-s32-float.0 servo-thread


addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread

#net remstart halui.mode.auto halui.program.pause <= parport.0.pin-12-in

#net estop-out => parport.0.pin-01-out
net xstep => parport.0.pin-03-out
setp parport.0.pin-03-out-reset 1
net xdir => parport.0.pin-04-out
net zstep => parport.0.pin-05-out
setp parport.0.pin-05-out-reset 1
net zdir => parport.0.pin-06-out
net astep => parport.0.pin-01-out
setp parport.0.pin-01-out-reset 0
net adir => parport.0.pin-02-out
net lower-mill-spindle => parport.0.pin-07-out

setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 35000
setp stepgen.0.dirsetup 35000
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable

setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 35000
setp stepgen.1.dirsetup 35000
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.1.position-cmd
net zpos-fb stepgen.1.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.1.step
net zdir <= stepgen.1.dir
net zenable axis.2.amp-enable-out => stepgen.1.enable

#####Spindle stepgen, velocity mode#######
setp stepgen.2.position-scale [AXIS_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 35000
setp stepgen.2.dirsetup 35000
setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net avel-cmd motion.spindle-speed-out => stepgen.2.velocity-cmd
net vstep <= stepgen.2.step
net vdir <= motion.spindle-reverse
net aenable axis.3.amp-enable-out => stepgen.2.enable

setp stepgen.3.position-scale [AXIS_3]SCALE
setp stepgen.3.steplen 1
setp stepgen.3.stepspace 0
setp stepgen.3.dirhold 35000
setp stepgen.3.dirsetup 35000
setp stepgen.3.maxaccel [AXIS_3]STEPGEN_MAXACCEL
net apos-cmd axis.3.motor-pos-cmd => stepgen.3.position-cmd
net apos-fb stepgen.3.position-fb => axis.3.motor-pos-fb
net pstep <= stepgen.3.step
net pdir <= stepgen.3.dir
net aenable axis.3.amp-enable-out => stepgen.3.enable


net vmode motion.spindle-on => not.0.in and2.1.in1 and2.3.in1
net pmode not.0.out => and2.0.in1 and2.2.in1
net pstep => and2.0.in0
net vstep => and2.1.in0
net pdir => and2.2.in0
net vdir => and2.3.in0
net pstep-sw and2.0.out => or2.0.in0
net vstep-sw and2.1.out => or2.0.in1
net pdir-sw and2.2.out => or2.1.in0
net vdir-sw and2.3.out => or2.1.in1

net astep <= or2.0.out
net adir <= or2.1.out

net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in

loadusr -W hal_manualtoolchange
setp comp.0.in0 1.5
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
net tool-installed-s32 iocontrol.0.tool-number => conv-s32-float.0.in
net tool-installed-float conv-s32-float.0.out => comp.0.in1
net lower-mill-spindle <= comp.0.out
Last edit: 16 Apr 2011 17:06 by andypugh. Reason: colour highlight

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

More
16 Apr 2011 17:32 - 16 Apr 2011 17:36 #8986 by BigJohnT
Replied by BigJohnT on topic Re:Lathe Question
Andy,

That is pretty neat... took me a bit to grasp it all at first.

I assume that if you have a rotary and spindle g code together the spindle takes charge?

John
Last edit: 16 Apr 2011 17:36 by BigJohnT.

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

More
17 Apr 2011 15:17 #9002 by Rick G
Replied by Rick G on topic Re:Lathe Question
Hello Andy,

Now that is creative. It makes me want to put together a small lathe to use.

Rick G

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

Time to create page: 0.108 seconds
Powered by Kunena Forum