I got OUTPUT_0 = Spindle CW working
and OUTPUT_1 = Spindle CCW working
But OUTPUT_2 = Spindle On is not working
Hal:
Code:
# This file was created with the Mesa Configuration Tool on elo 06 2022 20:18:17
# If you make changes to this file DO NOT run the configuration tool again!
# This file will be replaced with a new file if you do!
# kinematics
loadrt [KINS]KINEMATICS
# motion controller
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
# standard components
loadrt pid num_chan=3
# hostmot2 driver
loadrt hostmot2
loadrt [HM2](DRIVER) board_ip=[HM2](IPADDRESS)
setp hm2_7i96s.0.watchdog.timeout_ns 5000000
# THREADS
addf hm2_7i96s.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.0.do-pid-calcs servo-thread
addf pid.1.do-pid-calcs servo-thread
addf pid.2.do-pid-calcs servo-thread
addf hm2_7i96s.0.write servo-thread
# Joint 0
# PID Setup
setp pid.0.Pgain [JOINT_0]P
setp pid.0.Igain [JOINT_0]I
setp pid.0.Dgain [JOINT_0]D
setp pid.0.bias [JOINT_0]BIAS
setp pid.0.FF0 [JOINT_0]FF0
setp pid.0.FF1 [JOINT_0]FF1
setp pid.0.FF2 [JOINT_0]FF2
setp pid.0.deadband [JOINT_0]DEADBAND
setp pid.0.maxoutput [JOINT_0]MAX_OUTPUT
setp pid.0.maxerror [JOINT_0]MAX_ERROR
setp pid.0.error-previous-target true
# joint enable chain
net joint-0-index-enable <=> pid.0.index-enable
net joint-0-enable <= joint.0.amp-enable-out
net joint-0-enable => pid.0.enable
net joint-0-enable => hm2_7i96s.0.stepgen.00.enable
setp hm2_7i96s.0.stepgen.00.dirsetup [JOINT_0]DIRSETUP
setp hm2_7i96s.0.stepgen.00.dirhold [JOINT_0]DIRHOLD
setp hm2_7i96s.0.stepgen.00.steplen [JOINT_0]STEPLEN
setp hm2_7i96s.0.stepgen.00.stepspace [JOINT_0]STEPSPACE
setp hm2_7i96s.0.stepgen.00.position-scale [JOINT_0]SCALE
setp hm2_7i96s.0.stepgen.00.maxvel [JOINT_0]STEPGEN_MAX_VEL
setp hm2_7i96s.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAX_ACC
setp hm2_7i96s.0.stepgen.00.step_type 0
setp hm2_7i96s.0.stepgen.00.control-type 1
# position command and feedback
net joint-0-pos-cmd <= joint.0.motor-pos-cmd
net joint-0-pos-cmd => pid.0.command
net joint-0-pos-fb <= hm2_7i96s.0.stepgen.00.position-fb
net joint-0-pos-fb => joint.0.motor-pos-fb
net joint-0-pos-fb => pid.0.feedback
net joint.0.output <= pid.0.output
net joint.0.output => hm2_7i96s.0.stepgen.00.velocity-cmd
# Joint 1
# PID Setup
setp pid.1.Pgain [JOINT_1]P
setp pid.1.Igain [JOINT_1]I
setp pid.1.Dgain [JOINT_1]D
setp pid.1.bias [JOINT_1]BIAS
setp pid.1.FF0 [JOINT_1]FF0
setp pid.1.FF1 [JOINT_1]FF1
setp pid.1.FF2 [JOINT_1]FF2
setp pid.1.deadband [JOINT_1]DEADBAND
setp pid.1.maxoutput [JOINT_1]MAX_OUTPUT
setp pid.1.maxerror [JOINT_1]MAX_ERROR
setp pid.1.error-previous-target true
# joint enable chain
net joint-1-index-enable <=> pid.1.index-enable
net joint-1-enable <= joint.1.amp-enable-out
net joint-1-enable => pid.1.enable
net joint-1-enable => hm2_7i96s.0.stepgen.01.enable
setp hm2_7i96s.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP
setp hm2_7i96s.0.stepgen.01.dirhold [JOINT_1]DIRHOLD
setp hm2_7i96s.0.stepgen.01.steplen [JOINT_1]STEPLEN
setp hm2_7i96s.0.stepgen.01.stepspace [JOINT_1]STEPSPACE
setp hm2_7i96s.0.stepgen.01.position-scale [JOINT_1]SCALE
setp hm2_7i96s.0.stepgen.01.maxvel [JOINT_1]STEPGEN_MAX_VEL
setp hm2_7i96s.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAX_ACC
setp hm2_7i96s.0.stepgen.01.step_type 0
setp hm2_7i96s.0.stepgen.01.control-type 1
# position command and feedback
net joint-1-pos-cmd <= joint.1.motor-pos-cmd
net joint-1-pos-cmd => pid.1.command
net joint-1-pos-fb <= hm2_7i96s.0.stepgen.01.position-fb
net joint-1-pos-fb => joint.1.motor-pos-fb
net joint-1-pos-fb => pid.1.feedback
net joint.1.output <= pid.1.output
net joint.1.output => hm2_7i96s.0.stepgen.01.velocity-cmd
# Spindle
# Spindle Velocity Pins
net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
# Spindle Command Pins
net spindle-enable <= spindle.0.on
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable => spindle.0.index-enable
# Set spindle at speed signal
sets spindle-at-speed true
# Spindle Board Connections
net spindle-enable => hm2_7i96s.0.pwmgen.00.enable
net spindle-vel-cmd-rpm hm2_7i96s.0.pwmgen.00.value
setp hm2_7i96s.0.pwmgen.00.scale [SPINDLE]MAX_RPM
setp hm2_7i96s.0.pwmgen.pwm_frequency [SPINDLE]PWM_FREQUENCY
setp hm2_7i96s.0.pwmgen.00.output-type [SPINDLE]SPINDLE_PWM_TYPE
Ini:
Code:
# This file was created with the Mesa Configuration Tool on elo 06 2022 20:18:17
# Changes to most things are ok and will be read by the Configuration Tool
[MESA]
VERSION = 0.7.0
BOARD = 7i96s
FIRMWARE = 7i96s_d.bin
CARD_0 = None
CARD_1 = None
[EMC]
VERSION = 1.1
MACHINE = Emco 50 PC turn mesact
DEBUG = 0x00000000
[HM2]
DRIVER = hm2_eth
IPADDRESS = 10.10.10.10
STEPGENS = False
PWMGENS = False
ENCODERS = False
[DISPLAY]
DISPLAY = gmoccapy
EDITOR = gedit
PROGRAM_PREFIX = /home/samuel/linuxcnc/nc_files
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = COMMANDED
MAX_FEED_OVERRIDE = 1.2
MIN_VELOCITY = 0.0
DEFAULT_LINEAR_VELOCITY = 2.1
MAX_LINEAR_VELOCITY = 5.0
CYCLE_TIME = 0.1
INTRO_GRAPHIC = emc2.gif
INTRO_TIME = 0
OPEN_FILE = ""
LATHE = 1
BACK_TOOL_LATHE = 1
[KINS]
KINEMATICS = trivkins coordinates=ZX
JOINTS = 2
[EMCIO]
EMCIO = iov2
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[RS274NGC]
PARAMETER_FILE = emco_50_pc_turn_mesact.var
SUBROUTINE_PATH = /home/samuel/linuxcnc/subroutines
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[TRAJ]
COORDINATES = ZX
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
MAX_LINEAR_VELOCITY = 5.0
NO_FORCE_HOMING = 1
[HAL]
HALFILE = emco_50_pc_turn_mesact.hal
HALFILE = io.hal
HALFILE = custom.hal
HALUI = halui
[HALUI]
[AXIS_Z]
MIN_LIMIT = -1
MAX_LIMIT = 236
MAX_VELOCITY = 3.15
MAX_ACCELERATION = 350
[AXIS_X]
MIN_LIMIT = -46
MAX_LIMIT = 0
MAX_VELOCITY = 3.15
MAX_ACCELERATION = 350
[JOINT_0]
AXIS = Z
MIN_LIMIT = -1
MAX_LIMIT = 236
MAX_VELOCITY = 3.15
MAX_ACCELERATION = 350
TYPE = LINEAR
SCALE = 8000
DRIVE = Custom
STEP_INVERT = False
DIR_INVERT = False
STEPGEN_MAX_VEL = 3.78
STEPGEN_MAX_ACC = 420.00
DIRSETUP = 20000
DIRHOLD = 20000
STEPLEN = 20000
STEPSPACE = 20000
FERROR = 0.005
MIN_FERROR = 0.0025
DEADBAND = 0
P = 1000
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
MAX_OUTPUT = 0
MAX_ERROR = 0.0127
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -1
HOME_LATCH_VEL = -0.5
HOME_FINAL_VEL = 0.0000
HOME_IGNORE_LIMITS = True
[JOINT_1]
AXIS = X
MIN_LIMIT = -46
MAX_LIMIT = 0
MAX_VELOCITY = 3.15
MAX_ACCELERATION = 350
TYPE = LINEAR
SCALE = 8000
DRIVE = Custom
STEP_INVERT = False
DIR_INVERT = False
STEPGEN_MAX_VEL = 3.78
STEPGEN_MAX_ACC = 420.00
DIRSETUP = 20000
DIRHOLD = 20000
STEPLEN = 20000
STEPSPACE = 20000
FERROR = 0.005
MIN_FERROR = 0.0025
DEADBAND = 0
P = 1000
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
MAX_OUTPUT = 0
MAX_ERROR = 0.0127
[SPINDLE]
SPINDLE_TYPE = analog
SPINDLE_PWM_TYPE = 1
PWM_FREQUENCY = 10000
MAX_RPM = 1600
MIN_RPM = 0
# Everything below this line is only used to
# setup the Configuration Tool when loading the ini.
[INPUTS]
# DO NOT change the inputs they are used by the configuration tool
INPUT_0 = Joint 0 Home
INPUT_INVERT_0 = False
INPUT_SLOW_0 = False
INPUT_1 = Joint 1 Home
INPUT_INVERT_1 = True
INPUT_SLOW_1 = False
INPUT_2 = External E Stop
INPUT_INVERT_2 = True
INPUT_SLOW_2 = False
INPUT_3 = Select
INPUT_INVERT_3 = False
INPUT_SLOW_3 = False
INPUT_4 = Select
INPUT_INVERT_4 = False
INPUT_SLOW_4 = False
INPUT_5 = Select
INPUT_INVERT_5 = False
INPUT_SLOW_5 = False
INPUT_6 = Select
INPUT_INVERT_6 = False
INPUT_SLOW_6 = False
INPUT_7 = Select
INPUT_INVERT_7 = False
INPUT_SLOW_7 = False
INPUT_8 = Select
INPUT_INVERT_8 = False
INPUT_SLOW_8 = False
INPUT_9 = Select
INPUT_INVERT_9 = False
INPUT_SLOW_9 = False
INPUT_10 = Select
INPUT_INVERT_10 = False
INPUT_SLOW_10 = False
INPUT_11 = Select
INPUT_INVERT_11 = False
INPUT_SLOW_11 = False
INPUT_12 = Select
INPUT_INVERT_12 = False
INPUT_SLOW_12 = False
INPUT_13 = Select
INPUT_INVERT_13 = False
INPUT_SLOW_13 = False
INPUT_14 = Select
INPUT_INVERT_14 = False
INPUT_SLOW_14 = False
INPUT_15 = Select
INPUT_INVERT_15 = False
INPUT_SLOW_15 = False
INPUT_16 = Select
INPUT_INVERT_16 = False
INPUT_SLOW_16 = False
INPUT_17 = Select
INPUT_INVERT_17 = False
INPUT_SLOW_17 = False
INPUT_18 = Select
INPUT_INVERT_18 = False
INPUT_SLOW_18 = False
INPUT_19 = Select
INPUT_INVERT_19 = False
INPUT_SLOW_19 = False
INPUT_20 = Select
INPUT_INVERT_20 = False
INPUT_SLOW_20 = False
INPUT_21 = Select
INPUT_INVERT_21 = False
INPUT_SLOW_21 = False
INPUT_22 = Select
INPUT_INVERT_22 = False
INPUT_SLOW_22 = False
INPUT_23 = Select
INPUT_INVERT_23 = False
INPUT_SLOW_23 = False
INPUT_24 = Select
INPUT_INVERT_24 = False
INPUT_SLOW_24 = False
INPUT_25 = Select
INPUT_INVERT_25 = False
INPUT_SLOW_25 = False
INPUT_26 = Select
INPUT_INVERT_26 = False
INPUT_SLOW_26 = False
INPUT_27 = Select
INPUT_INVERT_27 = False
INPUT_SLOW_27 = False
INPUT_28 = Select
INPUT_INVERT_28 = False
INPUT_SLOW_28 = False
INPUT_29 = Select
INPUT_INVERT_29 = False
INPUT_SLOW_29 = False
INPUT_30 = Select
INPUT_INVERT_30 = False
INPUT_SLOW_30 = False
INPUT_31 = Select
INPUT_INVERT_31 = False
INPUT_SLOW_31 = False
[OUTPUTS]
# DO NOT change the outputs they are used by the configuration tool
OUTPUT_0 = Spindle CW
OUTPUT_1 = Spindle CCW
OUTPUT_2 = Spindle On
OUTPUT_3 = Select
OUTPUT_4 = Select
OUTPUT_5 = Select
OUTPUT_6 = Select
OUTPUT_7 = Select
OUTPUT_8 = Select
OUTPUT_9 = Select
OUTPUT_10 = Select
OUTPUT_11 = Select
OUTPUT_12 = Select
OUTPUT_13 = Select
OUTPUT_14 = Select
OUTPUT_15 = Select
[OPTIONS]
# DO NOT change the options they are used by the configuration tool
LOAD_CONFIG = False
INTRO_GRAPHIC = emc2.gif
INTRO_GRAPHIC_TIME = 0
MANUAL_TOOL_CHANGE = False
CUSTOM_HAL = True
POST_GUI_HAL = False
SHUTDOWN_HAL = False
HALUI = False
PYVCP = False
GLADEVCP = False
LADDER = False
BACKUP = False
io.hal
Code:
# This file was created with the 7i92 Wizard on elo 06 2022 20:18:17
# If you make changes to this file DO NOT use the Configuration Tool
net joint-0-home joint.0.home-sw-in <= hm2_7i96s.0.inm.00.input-00
net joint-1-home joint.1.home-sw-in <= hm2_7i96s.0.inm.00.input-01-not
# External E-Stop
loadrt estop_latch
addf estop-latch.0 servo-thread
net estop-loopout iocontrol.0.emc-enable-in <= estop-latch.0.ok-out
net estop-loopin iocontrol.0.user-enable-out => estop-latch.0.ok-in
net estop-reset iocontrol.0.user-request-enable => estop-latch.0.reset
net remote-estop estop-latch.0.fault-in <= hm2_7i96s.0.inm.00.input-02-not
net spindle-cw spindle.0.forward => hm2_7i96s.0.ssr.00.out-00
net spindle-ccw spindle.0.reverse => hm2_7i96s.0.ssr.00.out-01
net spindle-on => hm2_7i96s.0.ssr.00.out-02