Can't get lathe to Feed

More
07 Jul 2021 18:16 #213981 by rider-83
Replied by rider-83 on topic Can't get lathe to Feed
Andy, I've got lost in my own threads. This is the project (Boxford) were you recommended a sensor from RS and I wired it to one input pin ( '10' on my 2nd LPT ) . We then combined the two signals (A & Z) to this pin.
If I remember correctly I think you guided me to some script were I could past it into my .HAL

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

More
07 Jul 2021 18:22 #213982 by andypugh
Replied by andypugh on topic Can't get lathe to Feed
Can you attach your current HAL?

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

More
07 Jul 2021 19:11 #213983 by rider-83
Replied by rider-83 on topic Can't get lathe to Feed
###############################################################
# BOXFORD B160TCL WITH ATC #
###############################################################
loadrt [KINS]KINEMATICS
#autoconverted trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS

loadrt stepgen step_type=0,0,0,0
loadrt pwmgen output_type=1
addf stepgen.make-pulses base-thread
addf pwmgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread

####################################
###########PARALLEL PORT############
loadrt hal_parport cfg="0x378 0xdcc8"

setp parport.0.reset-time 200
addf parport.0.read base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

setp parport.1.reset-time 200
addf parport.1.read base-thread
addf parport.1.write base-thread
addf parport.1.reset base-thread
####################################





############################################################
# DEFINE SPINDLE #
############################################################
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 50
setp pwmgen.0.scale 3000
#setp pwmgen.0.offset -0.0220338983051
#setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-at-speed => spindle.0.at-speed
net spindle-cw <= spindle.0.forward
net coolant-flood <= iocontrol.0.coolant-flood

############################################################
# SPINDLE ENCODER SYNCHRONISATION #
############################################################
#Add Encoder detail
loadrt encoder
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread

# set the HAL encoder to 100 pulses per revolution.
setp encoder.3.position-scale 100

#set the HAL encoder count mode
setp encoder.0.counter-mode 1

# connect the HAL encoder outputs to LinuxCNC.
net spindle-position encoder.0.position-interpolated => spindle.0.revs
net spindle-velocity encoder.0.velocity => spindle.0.speed-in
net spindle-index-enable encoder.0.index-enable <=> spindle.0.index-enable

#Connect HAL Encoder to Parallel Port
net pulse-index-combined parport.1.pin-10-in encoder.0.phase-A encoder.0.phase-Z

#SPINDLE AT SPEED DETAIL
# load a near component and attach it to a thread
loadrt near
addf near.0 servo-thread

# connect one input to the commanded spindle speed
net spindle-cmd => near.0.in1

# connect one input to the encoder-measured spindle speed
net spindle-velocity => near.0.in2

# connect the output to the spindle-at-speed input
net spindle-at-speed spindle.0.at-speed <= near.0.out

# set the spindle speed inputs to agree if within 1%
setp near.0.scale 1.01
#############################################################


###########################################
# DEFINE D25 PINS #
###########################################
net coolant-flood => parport.0.pin-01-out
setp parport.0.pin-01-out-invert 1

net xstep => parport.0.pin-02-out
net xdir => parport.0.pin-03-out
setp parport.0.pin-02-out-reset 1

net ystep => parport.0.pin-04-out
net ydir => parport.0.pin-05-out
setp parport.0.pin-04-out-reset 1

net zstep => parport.0.pin-06-out
net zdir => parport.0.pin-07-out
setp parport.0.pin-06-out-reset 1

net astep => parport.0.pin-08-out
net adir => parport.0.pin-09-out
setp parport.0.pin-08-out-reset 1

net spindle-pwm => parport.0.pin-14-out
net spindle-on => parport.0.pin-16-out
net spindle-cw => parport.0.pin-17-out
setp parport.0.pin-16-out-invert 1

############################################################
# EMERGENCY STOP #
############################################################
net estop-ext <= parport.0.pin-10-in-not
net estop-out <= iocontrol.0.user-enable-out
net estop-ext => iocontrol.0.emc-enable-in

###################################################################
# SET UP HOME & LIMITS #
###################################################################
net min-home-x joint.0.neg-lim-sw-in <= parport.0.pin-11-in-not
net min-home-x => joint.0.home-sw-in <= parport.0.pin-11-in-not

net min-home-z joint.2.neg-lim-sw-in <= parport.0.pin-12-in-not
net min-home-z => joint.2.home-sw-in <= parport.0.pin-12-in-not

#SET UP EXTERNAL HOME BUTTON#
net home-all halui.home-all <= parport.0.pin-13-in
###################################################################

###################################################################
# SET UP EXTERNAL CYCLESTART BUTTON #
net cycle-start-btn halui.program.run <= parport.0.pin-15-in
###################################################################


############################################################
# DEFINE AXIS #
############################################################

##########
# X-AXIS #
##########
setp stepgen.0.position-scale [JOINT_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 34000
setp stepgen.0.dirsetup 34000
setp stepgen.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL
net xpos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => joint.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable joint.0.amp-enable-out => stepgen.0.enable

##########
# Y-AXIS #
##########
setp stepgen.1.position-scale [JOINT_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 34000
setp stepgen.1.dirsetup 34000
setp stepgen.1.maxaccel [JOINT_0]STEPGEN_MAXACCEL
net ypos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => joint.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable joint.1.amp-enable-out => stepgen.1.enable

##########
# Z-AXIS #
##########
setp stepgen.2.position-scale [JOINT_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 34000
setp stepgen.2.dirsetup 34000
setp stepgen.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL
net zpos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => joint.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable joint.2.amp-enable-out => stepgen.2.enable

##########
# A-AXIS #
##########
setp stepgen.3.position-scale [JOINT_3]SCALE
setp stepgen.3.steplen 1
setp stepgen.3.stepspace 0
setp stepgen.3.dirhold 34000
setp stepgen.3.dirsetup 34000
setp stepgen.3.maxaccel [JOINT_3]STEPGEN_MAXACCEL
net apos-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd
net apos-fb stepgen.3.position-fb => joint.3.motor-pos-fb
net astep <= stepgen.3.step
net adir <= stepgen.3.dir
net aenable joint.3.amp-enable-out => stepgen.3.enable

#################################################################################
# TOOL CHANGE SECTION #
#################################################################################


#MY ADAPTATION OF ATC
#net tool-number <= iocontrol.0.tool-prep-number
#net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
#net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed

#################################################################################



#################################################################################
#MANUAL CHANGE
#loadusr -W hal_manualtoolchange
#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
#################################################################################

#################################################################################
#AUTOMATIC
#loadrt toolchanger
#addf toolchanger servo-thread
#net tool-change iocontrol.0.tool-change => toolchanger.toolchange
#net tool-changed iocontrol.0.tool-changed <= toolchanger.toolchanged
#net tool-number iocontrol.0.tool-prep-number => toolchanger.toolnumber
#net tool-oldnumber iocontrol.0.tool-number => toolchanger.currenttoolnumber
#net apos-cmd toolchanger.position-cmd => stepgen.3.position-cmd
#net ahomed joint.3.homed => toolchanger.ishomed
#net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
##################################################################################

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

More
07 Jul 2021 19:26 #213985 by andypugh
Replied by andypugh on topic Can't get lathe to Feed
I think that you just need to change:
# set the HAL encoder to 100 pulses per revolution.
setp encoder.3.position-scale 100
to
# set the HAL encoder to 100 pulses per revolution.
setp encoder.0.position-scale 100

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

More
07 Jul 2021 19:34 #213987 by rider-83
Replied by rider-83 on topic Can't get lathe to Feed
Andy,

That seemed to work, but this has appeared:
custom_postgui.hal:4: signal 'spindle-at-speed' already has writer(s)

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

More
07 Jul 2021 20:16 #213990 by andypugh
Replied by andypugh on topic Can't get lathe to Feed
Hmm, so what is in the custom_postgui file? (That's an unusual place to define spindle-at-speed)

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

More
08 Jul 2021 17:52 #214040 by rider-83
Replied by rider-83 on topic Can't get lathe to Feed
I've had a look inside custom_postgui file and found something naughty in there.
The system now comes up. I'm going to do some stuff to test things out.

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

More
08 Jul 2021 18:17 - 08 Jul 2021 18:17 #214043 by rider-83
Replied by rider-83 on topic Can't get lathe to Feed
So I've run a few simple tests.

Command      Actual
S100             103RPM
S500             445 RPM
S1000           1062RPM
S2000           2270RPM
S3000           2920RPM

Also, no feed movements (G1) in G95 (Feed per Rev)
Last edit: 08 Jul 2021 18:17 by rider-83.

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

More
09 Jul 2021 12:01 #214084 by andypugh
Replied by andypugh on topic Can't get lathe to Feed
You need spindle,0,revs and spindle.0.speed-in connected to the spindle encoder.

linuxcnc.org/docs/2.8/html/man/man9/moti....html#SPINDLE%20PINS

I thought that there was a specific section on spindle synched motion, but I confess that I can not find it.

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

More
06 Aug 2021 17:22 #217064 by rider-83
Replied by rider-83 on topic Can't get lathe to Feed
I'm loosing the will to live here. I'm trying to find out what it is I'm supposed to do with those two commands you have stated, but I can't find any useful help.
Where do I need to look on how to set this up ?

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

Time to create page: 0.175 seconds
Powered by Kunena Forum