Lathe with servo drive STEP/DIR and encoder
21 Nov 2010 12:22 #5487
by aike
Lathe with servo drive STEP/DIR and encoder was created by aike
Hi!
I finished one of lathe, the servo 6Nm, spindle 10KWt, precession near 20mk.
HAL and INI file may attach
See the video
I finished one of lathe, the servo 6Nm, spindle 10KWt, precession near 20mk.
HAL and INI file may attach
See the video
The following user(s) said Thank You: tjtr33
Please Log in or Create an account to join the conversation.
21 Nov 2010 12:26 #5488
by aike
Replied by aike on topic Re:Lathe with servo drive STEP/DIR and encoder
HAL file
loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hostmot2
loadrt hm2_pci config="firmware=hm2/5i20/SVST8_4.BIT num_encoders=3 num_pwmgens=1 num_stepgens=2"
setp hm2_5i20.0.pwmgen.pwm_frequency 100000
setp hm2_5i20.0.pwmgen.pdm_frequency 100000
setp hm2_5i20.0.watchdog.timeout_ns 10000000
loadrt not count=5
loadrt abs names=abs.spindle
loadrt pid num_chan=2
loadrt and2 count=5
loadrt or2 count=1
loadrt oneshot count=1
loadrt timedelay count=1
addf hm2_5i20.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf hm2_5i20.0.write servo-thread
addf hm2_5i20.0.pet_watchdog servo-thread
addf not.0 servo-thread
addf not.1 servo-thread
addf not.2 servo-thread
addf not.3 servo-thread
addf not.4 servo-thread
addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf and2.4 servo-thread
addf or2.0 servo-thread
addf oneshot.0 servo-thread
addf timedelay.0 servo-thread
addf abs.spindle servo-thread
addf pid.0.do-pid-calcs servo-thread
addf pid.1.do-pid-calcs servo-thread
# general signals
net strob-man <= halui.mode.is-manual
net strob-auto <= halui.mode.is-auto
net strob-mdi <= halui.mode.is-mdi
net power-on => halui.machine.is-on
net lube-is-on => halui.lube.is-on
net timer-elapsed => timedelay.0.elapsed
# external output signals
# --- ESTOP-OUT ---
net estop-out => not.0.in
net estop-out-not => not.0.out => hm2_5i20.0.gpio.040.out
setp hm2_5i20.0.gpio.040.is_output true
# similar
net estop-out-not => hm2_5i20.0.gpio.042.out
setp hm2_5i20.0.gpio.042.is_output true
# --- ENABLE ---
net enable => not.1.in
net enable-not => not.1.out => hm2_5i20.0.gpio.041.out
setp hm2_5i20.0.gpio.041.is_output true
# external input signals
# --- MIN-X ---
net X.min <= hm2_5i20.0.gpio.024.in
# --- MAX-X ---
net X.max <= hm2_5i20.0.gpio.025.in
# --- HOME-X ---
net X.home <= hm2_5i20.0.gpio.026.in
# --- MIN-Z ---
net Z.min <= hm2_5i20.0.gpio.027.in
# --- MAX-Z ---
net Z.max <= hm2_5i20.0.gpio.028.in
# --- HOME-Z ---
net Z.home <= hm2_5i20.0.gpio.029.in
#LUBE, LUBE-BED ON/OFF
#set 5 sec delay impulse for first switch-on bed lube
setp oneshot.0.width 5
#switch on bed-lube with machine start
net power-on oneshot.0.in
net delay oneshot.0.out => or2.0.in0
net timer-delay => or2.0.in1
net bed-lube => or2.0.out
net bed-lube => hm2_5i20.0.gpio.044.out
#setp hm2_5i20.0.gpio.044.is_output true
#setp hm2_5i20.0.gpio.044.invert_output true
#create timer for bed-lube
#the impulse will be 5 sec
#the delay between impulse will be 30min = 30*60=1800 sec
setp timedelay.0.on-delay 60
setp timedelay.0.off-delay 5
net lube-is-on => and2.4.in0
net timer-in => and2.4.in1
net timer-in-1 => and2.4.out
net timer-in-1 => timedelay.0.in
net timer-delay => timedelay.0.out
net timer-delay => not.4.in
net timer-in <= not.4.out
#FLOOD ON/OFF EXTERNAL BUTTON
net flood-on => halui.flood.on => hm2_5i20.0.gpio.035.in_not
net flood-off => halui.flood.off => hm2_5i20.0.gpio.036.in_not
#out from CNC
net coolant-flood halui.flood.is-on => hm2_5i20.0.gpio.043.out
setp hm2_5i20.0.gpio.043.is_output true
setp hm2_5i20.0.gpio.043.invert_output true
#HOME ALL EXTERNAL BUTTON
net home-on => and2.1.in0 <= hm2_5i20.0.gpio.039.in_not
net strob-man => and2.1.in1
net home-strob <= and2.1.out => halui.home-all
#SPINDLE ON/OFF EXTERNAL BUTTON
#START SPINDLE
net spindle-on => and2.2.in0 <= hm2_5i20.0.gpio.038.in_not
net strob-man => and2.2.in1
net spindle-on-strob <= and2.2.out => halui.spindle.start
#STOP SPINDLE
net spindle-off => and2.3.in0 <= hm2_5i20.0.gpio.037.in_not
net strob-man => and2.3.in1
net spindle-off-strob <= and2.3.out => halui.spindle.stop
# --- SPINDLE-AT-SPEED ---
###net spindle-at-speed <= hm2_5i20.0.gpio.033.in
#*******************
# AXIS X
#*******************
### start add by hand 2010-11-16
setp pid.0.Pgain [AXIS_0]P
setp pid.0.Igain [AXIS_0]I
setp pid.0.Dgain [AXIS_0]D
setp pid.0.bias [AXIS_0]BIAS
setp pid.0.FF0 [AXIS_0]FF0
setp pid.0.FF1 [AXIS_0]FF1
setp pid.0.FF2 [AXIS_0]FF2
setp pid.0.deadband [AXIS_0]DEADBAND
setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT
### end add by hand 2010-11-16
# Step Gen signals/setup
setp hm2_5i20.0.stepgen.00.dirsetup [AXIS_0]DIRSETUP
setp hm2_5i20.0.stepgen.00.dirhold [AXIS_0]DIRHOLD
setp hm2_5i20.0.stepgen.00.steplen [AXIS_0]STEPLEN
setp hm2_5i20.0.stepgen.00.stepspace [AXIS_0]STEPSPACE
setp hm2_5i20.0.stepgen.00.position-scale [AXIS_0]SCALE
setp hm2_5i20.0.stepgen.00.maxaccel 0
setp hm2_5i20.0.stepgen.00.maxvel 0
setp hm2_5i20.0.stepgen.00.step_type 0
setp hm2_5i20.0.stepgen.00.control-type 1
# ---Encoder feedback signals/setup---
setp hm2_5i20.0.encoder.00.counter-mode 0
setp hm2_5i20.0.encoder.00.filter 1
setp hm2_5i20.0.encoder.00.index-invert 0
setp hm2_5i20.0.encoder.00.index-mask 0
setp hm2_5i20.0.encoder.00.index-mask-invert 0
setp hm2_5i20.0.encoder.00.scale [AXIS_0]INPUT_SCALE
net X.pos-fb axis.0.motor-pos-fb <= hm2_5i20.0.encoder.00.position => pid.0.feedback
net X.pos-cmd axis.0.motor-pos-cmd => pid.0.command
net X.enable axis.0.amp-enable-out => hm2_5i20.0.stepgen.00.enable => pid.0.enable
net X.pos-out pid.0.output => hm2_5i20.0.stepgen.00.velocity-cmd
net X.index => hm2_5i20.0.encoder.00.index-enable <= axis.0.index-enable
# ---setup home / limit switch signals---
net X.home => axis.0.home-sw-in
net X.min => axis.0.neg-lim-sw-in
net X.max => axis.0.pos-lim-sw-in
net X.ferror => axis.0.f-error
#*******************
# AXIS Z
#*******************
### start add by hand 2010-11-16
setp pid.1.Pgain [AXIS_0]P
setp pid.1.Igain [AXIS_0]I
setp pid.1.Dgain [AXIS_0]D
setp pid.1.bias [AXIS_0]BIAS
setp pid.1.FF0 [AXIS_0]FF0
setp pid.1.FF1 [AXIS_0]FF1
setp pid.1.FF2 [AXIS_0]FF2
setp pid.1.deadband [AXIS_0]DEADBAND
setp pid.1.maxoutput [AXIS_0]MAX_OUTPUT
### end add by hand 2010-11-16
# Step Gen signals/setup
setp hm2_5i20.0.stepgen.01.dirsetup [AXIS_2]DIRSETUP
setp hm2_5i20.0.stepgen.01.dirhold [AXIS_2]DIRHOLD
setp hm2_5i20.0.stepgen.01.steplen [AXIS_2]STEPLEN
setp hm2_5i20.0.stepgen.01.stepspace [AXIS_2]STEPSPACE
setp hm2_5i20.0.stepgen.01.position-scale [AXIS_2]SCALE
setp hm2_5i20.0.stepgen.01.maxaccel 0
setp hm2_5i20.0.stepgen.01.maxvel 0
setp hm2_5i20.0.stepgen.01.step_type 0
setp hm2_5i20.0.stepgen.01.control-type 1
# ---Encoder feedback signals/setup---
setp hm2_5i20.0.encoder.01.counter-mode 0
setp hm2_5i20.0.encoder.01.filter 1
setp hm2_5i20.0.encoder.01.index-invert 0
setp hm2_5i20.0.encoder.01.index-mask 0
setp hm2_5i20.0.encoder.01.index-mask-invert 0
setp hm2_5i20.0.encoder.01.scale [AXIS_2]INPUT_SCALE
net Z.pos-fb axis.2.motor-pos-fb <= hm2_5i20.0.encoder.01.position => pid.1.feedback
net Z.pos-cmd axis.2.motor-pos-cmd => pid.1.command
net Z.enable axis.2.amp-enable-out => hm2_5i20.0.stepgen.01.enable => pid.1.enable
net Z.pos-out pid.1.output => hm2_5i20.0.stepgen.01.velocity-cmd
net Z.index => hm2_5i20.0.encoder.01.index-enable <= axis.2.index-enable
# ---setup home / limit switch signals---
net Z.home => axis.2.home-sw-in
net Z.min => axis.2.neg-lim-sw-in
net Z.max => axis.2.pos-lim-sw-in
net Z.ferror => axis.2.f-error
#*******************
# SPINDLE S
#*******************
# ---PWM Generator signals/setup---
setp hm2_5i20.0.pwmgen.00.output-type 1
setp hm2_5i20.0.pwmgen.00.scale [SPINDLE_9]OUTPUT_SCALE
net spindle-enable => hm2_5i20.0.pwmgen.00.enable
net spindle-vel-cmd => abs.spindle.in
net absolute-spindle-vel abs.spindle.out => hm2_5i20.0.pwmgen.00.value
net spindle-ccw => not.2.in
net spindle-enable => not.3.in
net spindle-cw-n => not.2.out => hm2_5i20.0.gpio.045.out
setp hm2_5i20.0.gpio.045.is_output true
net spindle-enable-n => not.3.out => hm2_5i20.0.gpio.047.out
setp hm2_5i20.0.gpio.047.is_output true
# ---Encoder feedback signals/setup---
setp hm2_5i20.0.encoder.02.counter-mode 0
setp hm2_5i20.0.encoder.02.filter 1
setp hm2_5i20.0.encoder.02.index-invert 0
setp hm2_5i20.0.encoder.02.index-mask 0
setp hm2_5i20.0.encoder.02.index-mask-invert 0
setp hm2_5i20.0.encoder.02.scale [SPINDLE_9]INPUT_SCALE
net spindle-revs <= hm2_5i20.0.encoder.02.position
net spindle-vel-fb <= hm2_5i20.0.encoder.02.velocity
net spindle-index-enable <=> hm2_5i20.0.encoder.02.index-enable
# ---setup spindle control signals---
net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps
net spindle-vel-cmd <= motion.spindle-speed-out
net spindle-enable <= motion.spindle-on
net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse
net spindle-brake <= motion.spindle-brake
net spindle-revs => motion.spindle-revs
net spindle-at-speed => motion.spindle-at-speed
net spindle-vel-fb => motion.spindle-speed-in
net spindle-index-enable <=> motion.spindle-index-enable
sets spindle-at-speed false
#******************************
# connect miscellaneous signals
#******************************
# ---probe signal---
net probe-in => motion.probe-input
# ---estop signals---
#logical AND
net estop-in1 and2.0.in0 <= iocontrol.0.user-enable-out
#if button pressed, then "0" everething
net estop-in2 and2.0.in1 <= hm2_5i20.0.gpio.034.in_not
net estop-out and2.0.out => iocontrol.0.emc-enable-in
net enable => motion.motion-enabled
# ---toolchange signals for custom tool changer---
net tool-number <= iocontrol.0.tool-prep-number
net tool-change-request <= iocontrol.0.tool-change
net tool-change-confirmed => iocontrol.0.tool-changed
net tool-prepare-request <= iocontrol.0.tool-prepare
net tool-prepare-confirmed => iocontrol.0.tool-prepared
loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hostmot2
loadrt hm2_pci config="firmware=hm2/5i20/SVST8_4.BIT num_encoders=3 num_pwmgens=1 num_stepgens=2"
setp hm2_5i20.0.pwmgen.pwm_frequency 100000
setp hm2_5i20.0.pwmgen.pdm_frequency 100000
setp hm2_5i20.0.watchdog.timeout_ns 10000000
loadrt not count=5
loadrt abs names=abs.spindle
loadrt pid num_chan=2
loadrt and2 count=5
loadrt or2 count=1
loadrt oneshot count=1
loadrt timedelay count=1
addf hm2_5i20.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf hm2_5i20.0.write servo-thread
addf hm2_5i20.0.pet_watchdog servo-thread
addf not.0 servo-thread
addf not.1 servo-thread
addf not.2 servo-thread
addf not.3 servo-thread
addf not.4 servo-thread
addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf and2.4 servo-thread
addf or2.0 servo-thread
addf oneshot.0 servo-thread
addf timedelay.0 servo-thread
addf abs.spindle servo-thread
addf pid.0.do-pid-calcs servo-thread
addf pid.1.do-pid-calcs servo-thread
# general signals
net strob-man <= halui.mode.is-manual
net strob-auto <= halui.mode.is-auto
net strob-mdi <= halui.mode.is-mdi
net power-on => halui.machine.is-on
net lube-is-on => halui.lube.is-on
net timer-elapsed => timedelay.0.elapsed
# external output signals
# --- ESTOP-OUT ---
net estop-out => not.0.in
net estop-out-not => not.0.out => hm2_5i20.0.gpio.040.out
setp hm2_5i20.0.gpio.040.is_output true
# similar
net estop-out-not => hm2_5i20.0.gpio.042.out
setp hm2_5i20.0.gpio.042.is_output true
# --- ENABLE ---
net enable => not.1.in
net enable-not => not.1.out => hm2_5i20.0.gpio.041.out
setp hm2_5i20.0.gpio.041.is_output true
# external input signals
# --- MIN-X ---
net X.min <= hm2_5i20.0.gpio.024.in
# --- MAX-X ---
net X.max <= hm2_5i20.0.gpio.025.in
# --- HOME-X ---
net X.home <= hm2_5i20.0.gpio.026.in
# --- MIN-Z ---
net Z.min <= hm2_5i20.0.gpio.027.in
# --- MAX-Z ---
net Z.max <= hm2_5i20.0.gpio.028.in
# --- HOME-Z ---
net Z.home <= hm2_5i20.0.gpio.029.in
#LUBE, LUBE-BED ON/OFF
#set 5 sec delay impulse for first switch-on bed lube
setp oneshot.0.width 5
#switch on bed-lube with machine start
net power-on oneshot.0.in
net delay oneshot.0.out => or2.0.in0
net timer-delay => or2.0.in1
net bed-lube => or2.0.out
net bed-lube => hm2_5i20.0.gpio.044.out
#setp hm2_5i20.0.gpio.044.is_output true
#setp hm2_5i20.0.gpio.044.invert_output true
#create timer for bed-lube
#the impulse will be 5 sec
#the delay between impulse will be 30min = 30*60=1800 sec
setp timedelay.0.on-delay 60
setp timedelay.0.off-delay 5
net lube-is-on => and2.4.in0
net timer-in => and2.4.in1
net timer-in-1 => and2.4.out
net timer-in-1 => timedelay.0.in
net timer-delay => timedelay.0.out
net timer-delay => not.4.in
net timer-in <= not.4.out
#FLOOD ON/OFF EXTERNAL BUTTON
net flood-on => halui.flood.on => hm2_5i20.0.gpio.035.in_not
net flood-off => halui.flood.off => hm2_5i20.0.gpio.036.in_not
#out from CNC
net coolant-flood halui.flood.is-on => hm2_5i20.0.gpio.043.out
setp hm2_5i20.0.gpio.043.is_output true
setp hm2_5i20.0.gpio.043.invert_output true
#HOME ALL EXTERNAL BUTTON
net home-on => and2.1.in0 <= hm2_5i20.0.gpio.039.in_not
net strob-man => and2.1.in1
net home-strob <= and2.1.out => halui.home-all
#SPINDLE ON/OFF EXTERNAL BUTTON
#START SPINDLE
net spindle-on => and2.2.in0 <= hm2_5i20.0.gpio.038.in_not
net strob-man => and2.2.in1
net spindle-on-strob <= and2.2.out => halui.spindle.start
#STOP SPINDLE
net spindle-off => and2.3.in0 <= hm2_5i20.0.gpio.037.in_not
net strob-man => and2.3.in1
net spindle-off-strob <= and2.3.out => halui.spindle.stop
# --- SPINDLE-AT-SPEED ---
###net spindle-at-speed <= hm2_5i20.0.gpio.033.in
#*******************
# AXIS X
#*******************
### start add by hand 2010-11-16
setp pid.0.Pgain [AXIS_0]P
setp pid.0.Igain [AXIS_0]I
setp pid.0.Dgain [AXIS_0]D
setp pid.0.bias [AXIS_0]BIAS
setp pid.0.FF0 [AXIS_0]FF0
setp pid.0.FF1 [AXIS_0]FF1
setp pid.0.FF2 [AXIS_0]FF2
setp pid.0.deadband [AXIS_0]DEADBAND
setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT
### end add by hand 2010-11-16
# Step Gen signals/setup
setp hm2_5i20.0.stepgen.00.dirsetup [AXIS_0]DIRSETUP
setp hm2_5i20.0.stepgen.00.dirhold [AXIS_0]DIRHOLD
setp hm2_5i20.0.stepgen.00.steplen [AXIS_0]STEPLEN
setp hm2_5i20.0.stepgen.00.stepspace [AXIS_0]STEPSPACE
setp hm2_5i20.0.stepgen.00.position-scale [AXIS_0]SCALE
setp hm2_5i20.0.stepgen.00.maxaccel 0
setp hm2_5i20.0.stepgen.00.maxvel 0
setp hm2_5i20.0.stepgen.00.step_type 0
setp hm2_5i20.0.stepgen.00.control-type 1
# ---Encoder feedback signals/setup---
setp hm2_5i20.0.encoder.00.counter-mode 0
setp hm2_5i20.0.encoder.00.filter 1
setp hm2_5i20.0.encoder.00.index-invert 0
setp hm2_5i20.0.encoder.00.index-mask 0
setp hm2_5i20.0.encoder.00.index-mask-invert 0
setp hm2_5i20.0.encoder.00.scale [AXIS_0]INPUT_SCALE
net X.pos-fb axis.0.motor-pos-fb <= hm2_5i20.0.encoder.00.position => pid.0.feedback
net X.pos-cmd axis.0.motor-pos-cmd => pid.0.command
net X.enable axis.0.amp-enable-out => hm2_5i20.0.stepgen.00.enable => pid.0.enable
net X.pos-out pid.0.output => hm2_5i20.0.stepgen.00.velocity-cmd
net X.index => hm2_5i20.0.encoder.00.index-enable <= axis.0.index-enable
# ---setup home / limit switch signals---
net X.home => axis.0.home-sw-in
net X.min => axis.0.neg-lim-sw-in
net X.max => axis.0.pos-lim-sw-in
net X.ferror => axis.0.f-error
#*******************
# AXIS Z
#*******************
### start add by hand 2010-11-16
setp pid.1.Pgain [AXIS_0]P
setp pid.1.Igain [AXIS_0]I
setp pid.1.Dgain [AXIS_0]D
setp pid.1.bias [AXIS_0]BIAS
setp pid.1.FF0 [AXIS_0]FF0
setp pid.1.FF1 [AXIS_0]FF1
setp pid.1.FF2 [AXIS_0]FF2
setp pid.1.deadband [AXIS_0]DEADBAND
setp pid.1.maxoutput [AXIS_0]MAX_OUTPUT
### end add by hand 2010-11-16
# Step Gen signals/setup
setp hm2_5i20.0.stepgen.01.dirsetup [AXIS_2]DIRSETUP
setp hm2_5i20.0.stepgen.01.dirhold [AXIS_2]DIRHOLD
setp hm2_5i20.0.stepgen.01.steplen [AXIS_2]STEPLEN
setp hm2_5i20.0.stepgen.01.stepspace [AXIS_2]STEPSPACE
setp hm2_5i20.0.stepgen.01.position-scale [AXIS_2]SCALE
setp hm2_5i20.0.stepgen.01.maxaccel 0
setp hm2_5i20.0.stepgen.01.maxvel 0
setp hm2_5i20.0.stepgen.01.step_type 0
setp hm2_5i20.0.stepgen.01.control-type 1
# ---Encoder feedback signals/setup---
setp hm2_5i20.0.encoder.01.counter-mode 0
setp hm2_5i20.0.encoder.01.filter 1
setp hm2_5i20.0.encoder.01.index-invert 0
setp hm2_5i20.0.encoder.01.index-mask 0
setp hm2_5i20.0.encoder.01.index-mask-invert 0
setp hm2_5i20.0.encoder.01.scale [AXIS_2]INPUT_SCALE
net Z.pos-fb axis.2.motor-pos-fb <= hm2_5i20.0.encoder.01.position => pid.1.feedback
net Z.pos-cmd axis.2.motor-pos-cmd => pid.1.command
net Z.enable axis.2.amp-enable-out => hm2_5i20.0.stepgen.01.enable => pid.1.enable
net Z.pos-out pid.1.output => hm2_5i20.0.stepgen.01.velocity-cmd
net Z.index => hm2_5i20.0.encoder.01.index-enable <= axis.2.index-enable
# ---setup home / limit switch signals---
net Z.home => axis.2.home-sw-in
net Z.min => axis.2.neg-lim-sw-in
net Z.max => axis.2.pos-lim-sw-in
net Z.ferror => axis.2.f-error
#*******************
# SPINDLE S
#*******************
# ---PWM Generator signals/setup---
setp hm2_5i20.0.pwmgen.00.output-type 1
setp hm2_5i20.0.pwmgen.00.scale [SPINDLE_9]OUTPUT_SCALE
net spindle-enable => hm2_5i20.0.pwmgen.00.enable
net spindle-vel-cmd => abs.spindle.in
net absolute-spindle-vel abs.spindle.out => hm2_5i20.0.pwmgen.00.value
net spindle-ccw => not.2.in
net spindle-enable => not.3.in
net spindle-cw-n => not.2.out => hm2_5i20.0.gpio.045.out
setp hm2_5i20.0.gpio.045.is_output true
net spindle-enable-n => not.3.out => hm2_5i20.0.gpio.047.out
setp hm2_5i20.0.gpio.047.is_output true
# ---Encoder feedback signals/setup---
setp hm2_5i20.0.encoder.02.counter-mode 0
setp hm2_5i20.0.encoder.02.filter 1
setp hm2_5i20.0.encoder.02.index-invert 0
setp hm2_5i20.0.encoder.02.index-mask 0
setp hm2_5i20.0.encoder.02.index-mask-invert 0
setp hm2_5i20.0.encoder.02.scale [SPINDLE_9]INPUT_SCALE
net spindle-revs <= hm2_5i20.0.encoder.02.position
net spindle-vel-fb <= hm2_5i20.0.encoder.02.velocity
net spindle-index-enable <=> hm2_5i20.0.encoder.02.index-enable
# ---setup spindle control signals---
net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps
net spindle-vel-cmd <= motion.spindle-speed-out
net spindle-enable <= motion.spindle-on
net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse
net spindle-brake <= motion.spindle-brake
net spindle-revs => motion.spindle-revs
net spindle-at-speed => motion.spindle-at-speed
net spindle-vel-fb => motion.spindle-speed-in
net spindle-index-enable <=> motion.spindle-index-enable
sets spindle-at-speed false
#******************************
# connect miscellaneous signals
#******************************
# ---probe signal---
net probe-in => motion.probe-input
# ---estop signals---
#logical AND
net estop-in1 and2.0.in0 <= iocontrol.0.user-enable-out
#if button pressed, then "0" everething
net estop-in2 and2.0.in1 <= hm2_5i20.0.gpio.034.in_not
net estop-out and2.0.out => iocontrol.0.emc-enable-in
net enable => motion.motion-enabled
# ---toolchange signals for custom tool changer---
net tool-number <= iocontrol.0.tool-prep-number
net tool-change-request <= iocontrol.0.tool-change
net tool-change-confirmed => iocontrol.0.tool-changed
net tool-prepare-request <= iocontrol.0.tool-prepare
net tool-prepare-confirmed => iocontrol.0.tool-prepared
The following user(s) said Thank You: tjtr33
Please Log in or Create an account to join the conversation.
21 Nov 2010 12:27 #5489
by aike
Replied by aike on topic Re:Lathe with servo drive STEP/DIR and encoder
INI file
[EMC]
MACHINE = IT42-AIKE
DEBUG = 0
[DISPLAY]
DISPLAY = axis
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 1.000000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = emc2.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/operator/emc2/nc_files
PYVCP = custompanel.xml
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
LATHE = 1
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 10.0000
MAX_LINEAR_VELOCITY = 60.000000
MIN_LINEAR_VELOCITY = 1.0000
DEFAULT_ANGULAR_VELOCITY = 0.250000
MAX_ANGULAR_VELOCITY = 1.000000
MIN_ANGULAR_VELOCITY = 0.010000
EDITOR = gedit
GEOMETRY = xyz
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = emc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
SERVO_PERIOD = 1000000
# [HOSTMOT2]
# This is for info only
# DRIVER0=hm2_pci
# BOARD0=5i20
# CONFIG0="firmware=hm2/5i20/SVST8_4.BIT num_encoders=3 num_pwmgens=1 num_stepgens=2"
[HAL]
HALUI = halui
HALFILE = IT42-AIKE.hal
POSTGUI_HALFILE = custom_postgui.hal
SHUTDOWN = shutdown.hal
[HALUI]
[TRAJ]
AXES = 3
COORDINATES = X Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 10.0
MAX_LINEAR_VELOCITY = 120.0
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
#********************
# Axis X
#********************
[AXIS_0]
TYPE = LINEAR
HOME = 0.0
FERROR =0.5
MIN_FERROR = 0.5
MAX_VELOCITY = 60.0
MAX_ACCELERATION =60.0
#Added by hand 2010-11-16
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.001
OUTPUT_SCALE = 500.0
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 140.0
INPUT_SCALE =-5000.0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 1000
STEPSPACE = 1000
SCALE = 5000.0
MIN_LIMIT = -160.0
MAX_LIMIT = 2.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -10.500000
HOME_LATCH_VEL = -0.50000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = YES
HOME_SEQUENCE = 0
#********************
# Axis Z
#********************
[AXIS_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.5
MAX_VELOCITY = 140.0
MAX_ACCELERATION = 140.0
#Added by hand 2010-11-16
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.001
OUTPUT_SCALE = 250.0
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 140.0
#change sign 2010-11-16
INPUT_SCALE =2500.0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 1000
STEPSPACE = 1000
SCALE = 2500.0
MIN_LIMIT = -300.0
MAX_LIMIT = 2.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -20.500000
HOME_LATCH_VEL = -1.50000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = YES
#HOME_USE_INDEX = NO
HOME_SEQUENCE = 0
#********************
# Spindle
#********************
[SPINDLE_9]
MAX_VELOCITY = 16.6666666667
MAX_ACCELERATION = 20.0
OUTPUT_SCALE = -4000.0
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 10.0
INPUT_SCALE = 4000.0
[EMC]
MACHINE = IT42-AIKE
DEBUG = 0
[DISPLAY]
DISPLAY = axis
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 1.000000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = emc2.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/operator/emc2/nc_files
PYVCP = custompanel.xml
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
LATHE = 1
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 10.0000
MAX_LINEAR_VELOCITY = 60.000000
MIN_LINEAR_VELOCITY = 1.0000
DEFAULT_ANGULAR_VELOCITY = 0.250000
MAX_ANGULAR_VELOCITY = 1.000000
MIN_ANGULAR_VELOCITY = 0.010000
EDITOR = gedit
GEOMETRY = xyz
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = emc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
SERVO_PERIOD = 1000000
# [HOSTMOT2]
# This is for info only
# DRIVER0=hm2_pci
# BOARD0=5i20
# CONFIG0="firmware=hm2/5i20/SVST8_4.BIT num_encoders=3 num_pwmgens=1 num_stepgens=2"
[HAL]
HALUI = halui
HALFILE = IT42-AIKE.hal
POSTGUI_HALFILE = custom_postgui.hal
SHUTDOWN = shutdown.hal
[HALUI]
[TRAJ]
AXES = 3
COORDINATES = X Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 10.0
MAX_LINEAR_VELOCITY = 120.0
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
#********************
# Axis X
#********************
[AXIS_0]
TYPE = LINEAR
HOME = 0.0
FERROR =0.5
MIN_FERROR = 0.5
MAX_VELOCITY = 60.0
MAX_ACCELERATION =60.0
#Added by hand 2010-11-16
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.001
OUTPUT_SCALE = 500.0
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 140.0
INPUT_SCALE =-5000.0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 1000
STEPSPACE = 1000
SCALE = 5000.0
MIN_LIMIT = -160.0
MAX_LIMIT = 2.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -10.500000
HOME_LATCH_VEL = -0.50000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = YES
HOME_SEQUENCE = 0
#********************
# Axis Z
#********************
[AXIS_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.5
MAX_VELOCITY = 140.0
MAX_ACCELERATION = 140.0
#Added by hand 2010-11-16
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.001
OUTPUT_SCALE = 250.0
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 140.0
#change sign 2010-11-16
INPUT_SCALE =2500.0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 1000
STEPSPACE = 1000
SCALE = 2500.0
MIN_LIMIT = -300.0
MAX_LIMIT = 2.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -20.500000
HOME_LATCH_VEL = -1.50000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = YES
#HOME_USE_INDEX = NO
HOME_SEQUENCE = 0
#********************
# Spindle
#********************
[SPINDLE_9]
MAX_VELOCITY = 16.6666666667
MAX_ACCELERATION = 20.0
OUTPUT_SCALE = -4000.0
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 10.0
INPUT_SCALE = 4000.0
The following user(s) said Thank You: tjtr33
Please Log in or Create an account to join the conversation.
Moderators: cncbasher
Time to create page: 0.168 seconds