M3 SOURCE CODE

More
19 Nov 2018 19:02 #121016 by COlger81
M3 SOURCE CODE was created by COlger81
Can someone point me to the source code location for the M3 routine?

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

More
20 Nov 2018 14:27 #121059 by andypugh
Replied by andypugh on topic M3 SOURCE CODE
If only it was so simple....

github.com/LinuxCNC/linuxcnc/blob/2.7/sr...erp_convert.cc#L3084

calls

github.com/LinuxCNC/linuxcnc/blob/7fb914...interp_queue.cc#L154

Then this puts the spindle start message onto the motion queue

github.com/LinuxCNC/linuxcnc/blob/349512...sk/emccanon.cc#L1788

Then to here:
github.com/LinuxCNC/linuxcnc/blob/349512...emctaskmain.cc#L1988

And so on, through motion, task, NML into the realtime layers.

The simplest way to find it is probably to look at the multispindle patch, as that makes it fairly clear which files changed:

github.com/LinuxCNC/linuxcnc/commit/e3ca...4d855e13c1771dcc9f85

The final output is where the HAL pins are written here:
github.com/LinuxCNC/linuxcnc/blob/master...tion/control.c#L1860

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

More
20 Nov 2018 16:54 #121072 by COlger81
Replied by COlger81 on topic M3 SOURCE CODE
I realized that was not a path i want to go down. I'm setting up spindle orient and i'm pretty close. I think the missing piece is where to place the Mux2 out. I have attached my configs if you can take a look.

File Attachment:

File Name: my_LinuxCN...1-20.ini
File Size:4 KB

File Attachment:

File Name: my_LinuxCN...1-20.hal
File Size:27 KB
# This config file was created 2017-11-26 08:54:27.459061 by the update_ini script
# The original config files may be found in the /home/fadal/linuxcnc/configs/my_LinuxCNC_machine/my_LinuxCNC_machine.old directory

# Generated by PNCconf at Mon Nov 20 15:07:44 2017
# If you make changes to this file, they will be
# overwritten when you run PNCconf again

[EMC]
# The version string for this INI file.
VERSION = 1.1

MACHINE = my_LinuxCNC_machine
DEBUG = 0

[DISPLAY]
DISPLAY = gmoccapy
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 1.000000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/fadal/linuxcnc/nc_files
INCREMENTS = .01in .001in .0001in
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 0.250000
MAX_LINEAR_VELOCITY = 1.000000
MIN_LINEAR_VELOCITY = 0.016670
DEFAULT_ANGULAR_VELOCITY = 12.000000
MAX_ANGULAR_VELOCITY = 180.000000
MIN_ANGULAR_VELOCITY = 1.666667
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

[RS274NGC]
PARAMETER_FILE = linuxcnc.var
ORIENT_OFFSET = 0
#REMAP=M6 modalgroup=6 ngc=toolchange
[EMCMOT]

EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
SERVO_PERIOD = 1000000


[TASK]
TASK = milltask
CYCLE_TIME = 0.010

[HAL]
HALUI = halui
HALFILE = my_LinuxCNC_machine.hal
POSTGUI_HALFILE = postgui_call_list.hal
SHUTDOWN = shutdown.hal


[HALUI]
MDI_COMMAND = 1

[TRAJ]

AXES = 3
COORDINATES = X Y Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 0.10
MAX_LINEAR_VELOCITY = 8.3333
NO_FORCE_HOMING = 0

[EMCIO]
EMCIO = io
CYCLE_TIME = .10
TOOL_TABLE = tool.tbl
TOOL_CHANGE_QUILL_UP = 1
RANDOM_TOOLCHANGER = 0

#********************
# Axis X
#********************


[KINS]
KINEMATICS = trivkins
#This is a best-guess at the number of joints, it should be checked
JOINTS = 3

[AXIS_X]
HOME = 0.0
MIN_LIMIT = -15.0
MAX_LIMIT = 15.0
MAX_VELOCITY = 8.3333
MAX_ACCELERATION = 40.0


[JOINT_0]

TYPE = LINEAR
HOME = 0.0
FERROR = 1.0
MIN_FERROR = .05
MAX_VELOCITY = 8.3333
MAX_ACCELERATION = 40.0
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.00003
MAX_OUTPUT = 0.0
ENCODER_SCALE = -100000.0
OUTPUT_SCALE = -10.0
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
MIN_LIMIT = -15.0
MAX_LIMIT = 15.0
HOME_OFFSET = 0.1700
HOME_LATCH_VEL = .05
HOME_USE_INDEX = YES
HOME_SEQUENCE = 0
#BACKLASH = 0.0005

#********************
# Axis Y
#********************
[AXIS_Y]
HOME = 0.0
MIN_LIMIT = -8.0
MAX_LIMIT = 8.0
MAX_VELOCITY = 8.3333
MAX_ACCELERATION = 40.0


[JOINT_1]

TYPE = LINEAR
HOME = 0.0
FERROR = 1
MIN_FERROR = 0.05
MAX_VELOCITY = 8.3333
MAX_ACCELERATION = 40.0
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.00003
MAX_OUTPUT = 0.0
ENCODER_SCALE = -100000.0
OUTPUT_SCALE = -10.0
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
MIN_LIMIT = -8.0
MAX_LIMIT = 8.0
HOME_OFFSET = 0.1000
HOME_LATCH_VEL = .05
HOME_USE_INDEX = YES
HOME_SEQUENCE = 0
#BACKLASH = 0.001

#********************
# Axis Z
#********************
[AXIS_Z]
HOME = 0.0
MIN_LIMIT = -16.0
MAX_LIMIT = 4.0
MAX_VELOCITY = 8.3333
MAX_ACCELERATION = 40.0


[JOINT_2]

TYPE = LINEAR
HOME = 0.0
FERROR = 1
MIN_FERROR = 0.05
MAX_VELOCITY = 8.3333
MAX_ACCELERATION = 40.0
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.00003
MAX_OUTPUT = 0.0
ENCODER_SCALE = 100000.0
OUTPUT_SCALE = 10.0
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
MIN_LIMIT = -16.0
MAX_LIMIT = 4.0
HOME_OFFSET = 0.1000
HOME_LATCH_VEL = .05
HOME_USE_INDEX = YES
HOME_SEQUENCE = 0
#BACKLASH = 0.0003

#********************
# Spindle
#********************
[HOSTMOT2]
# **** This is for info only ****
# DRIVER0=hm2_pci
# BOARD0=5i25

#********************
# Spindle
#********************
[SPINDLE_9]
P = 0.0
I = 0.0
D = 0.0
FF0 = 1.0
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 7500.0
ENCODER_SCALE = 4000.0
#OUTPUT_SCALE = -7640
OUTPUT_SCALE = -7500
OUTPUT_MIN_LIMIT = -7500
OUTPUT_MAX_LIMIT = 7500


[SPINDLE_0]
P = 0.0
I = 0.0
D = 0.0
FF0 = 1.0
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 7500.0
ENCODER_SCALE = 4000.0
#OUTPUT_SCALE = -7640
OUTPUT_SCALE = -7500
OUTPUT_MIN_LIMIT = -7500
OUTPUT_MAX_LIMIT = 7500
# Generated by PNCconf at Mon Nov 20 15:07:45 2017
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
#---LINK TO PYTHON FILES-START---

loadusr python lube.py
loadusr python ATC.py
loadusr python axisselector.py
loadusr python pyautoguitest.py
loadusr python programresume.py

#---LINK TO PYTHON FILES-END---

#============================================================
#---CRITICAL-THREAD-COMPONENTS-START---

loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_eth board_ip=10.10.10.10 config=" num_encoders=6 num_pwmgens=0 num_stepgens=0 sserial_port_0=300xxx"
setp   hm2_7i92.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.y,pid.z,pid.s,pid.o
loadrt abs names=abs.spindle
loadrt lowpass names=lowpass.spindle
loadrt scale names=scale.spindle

#---CRITICAL-THREAD-COMPONENTS-END---
#============================================================
#---LOAD-THREAD-COMPONENTS-START---

loadrt matrix_kb config=8x8s
loadrt carousel pockets=21 encoding=index num_sense=1 dir=2
loadrt and2 count=1
loadrt mux4 count=1
loadrt ilowpass
loadrt toggle count=7
loadrt or2 count=2

loadrt gearchoice
loadrt orient
loadrt mux2 count=1

#---LOAD-THREAD-COMPONENTS-END---
#============================================================
#---CRITICAL-FUNCTIONS-START---

addf hm2_7i92.0.read          servo-thread
addf motion-command-handler   servo-thread
addf motion-controller        servo-thread
addf pid.x.do-pid-calcs       servo-thread
addf pid.y.do-pid-calcs       servo-thread
addf pid.z.do-pid-calcs       servo-thread
addf pid.s.do-pid-calcs       servo-thread
addf pid.o.do-pid-calcs       servo-thread
addf scale.spindle            servo-thread
addf abs.spindle              servo-thread
addf lowpass.spindle          servo-thread

#---CRITICAL-FUNCTIONS-END---
#============================================================
#---ADD-FUNCTIONS-START---

addf matrix_kb.0 servo-thread
addf carousel.0               servo-thread
addf and2.0 servo-thread
addf mux4.0 servo-thread
addf ilowpass.0 servo-thread
addf toggle.0 servo-thread
addf toggle.1 servo-thread
addf toggle.2 servo-thread
addf toggle.3 servo-thread
addf toggle.4 servo-thread
addf toggle.5 servo-thread
addf toggle.6 servo-thread
addf or2.0 servo-thread
addf or2.1 servo-thread

addf gearchoice.0 servo-thread
addf orient.0 servo-thread
addf mux2.0 servo-thread

#!!---KEEP-hm2_7i92.0.write-LAST-addf---!!
addf hm2_7i92.0.write         servo-thread
#!!---KEEP-hm2_7i92.0.write-LAST-addf---!!

#---ADD-FUNCTIONS-END---
#============================================================
#---ADD-PARAMETERS-START---

setp matrix_kb.0.negative-logic false
setp matrix_kb.0.key_rollover 2
setp mux4.0.in0 .000001
setp mux4.0.in1 .00001
setp mux4.0.in2 .0001
setp mux4.0.in3 .0
setp ilowpass.0.scale 100
setp ilowpass.0.gain 0.03
setp halui.rapid-override.count-enable true
setp halui.rapid-override.direct-value true
#setp gmoccapy.rapid.rapid-override.analog-enable true
#setp halui.rapid-override.counts 1
#setp halui.rapid-override.increase true
#setp halui.rapid-override.decrease true
#setp halui.rapid-override.scale .01

#---ADD-PARAMETERS-END---
#============================================================
#---START-OF-MESA-PNCCONFIGURATION---

#*******************
#  AXIS X
#*******************

setp   pid.x.Pgain     [JOINT_0]P
setp   pid.x.Igain     [JOINT_0]I
setp   pid.x.Dgain     [JOINT_0]D
setp   pid.x.bias      [JOINT_0]BIAS
setp   pid.x.FF0       [JOINT_0]FF0
setp   pid.x.FF1       [JOINT_0]FF1
setp   pid.x.FF2       [JOINT_0]FF2
setp   pid.x.deadband  [JOINT_0]DEADBAND
setp   pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp   pid.x.error-previous-target true

net x-index-enable  <=> pid.x.index-enable
net x-enable        =>  pid.x.enable
net x-pos-cmd       =>  pid.x.command
#net x-vel-cmd       =>  pid.x.command-deriv
net x-pos-fb        =>  pid.x.feedback
net x-output        =>  pid.x.output

# ---PWM Generator signals/setup---

setp   hm2_7i92.0.7i77.0.1.analogout0-scalemax  [JOINT_0]OUTPUT_SCALE
setp   hm2_7i92.0.7i77.0.1.analogout0-minlim    [JOINT_0]OUTPUT_MIN_LIMIT
setp   hm2_7i92.0.7i77.0.1.analogout0-maxlim    [JOINT_0]OUTPUT_MAX_LIMIT

net x-output                             => hm2_7i92.0.7i77.0.1.analogout0
net x-pos-cmd    joint.0.motor-pos-cmd
net x-enable     joint.0.amp-enable-out
# enable _all_ sserial pwmgens
net x-enable   hm2_7i92.0.7i77.0.1.analogena
# ---Encoder feedback signals/setup---

setp    hm2_7i92.0.encoder.00.counter-mode 0
setp    hm2_7i92.0.encoder.00.filter 1
setp    hm2_7i92.0.encoder.00.index-invert 0
setp    hm2_7i92.0.encoder.00.index-mask 0
setp    hm2_7i92.0.encoder.00.index-mask-invert 0
setp    hm2_7i92.0.encoder.00.scale  [JOINT_0]ENCODER_SCALE

net x-pos-fb               <=  hm2_7i92.0.encoder.00.position
net x-vel-fb               <=  hm2_7i92.0.encoder.00.velocity
net x-pos-fb               =>  joint.0.motor-pos-fb
net x-index-enable    joint.0.index-enable  <=>  hm2_7i92.0.encoder.00.index-enable
net x-pos-rawcounts        <=  hm2_7i92.0.encoder.00.rawcounts

# ---setup home / limit switch signals---

net x-home-sw     =>  joint.0.home-sw-in
net x-neg-limit     =>  joint.0.neg-lim-sw-in
net x-pos-limit     =>  joint.0.pos-lim-sw-in

#*******************
#  AXIS Y
#*******************

setp   pid.y.Pgain     [JOINT_1]P
setp   pid.y.Igain     [JOINT_1]I
setp   pid.y.Dgain     [JOINT_1]D
setp   pid.y.bias      [JOINT_1]BIAS
setp   pid.y.FF0       [JOINT_1]FF0
setp   pid.y.FF1       [JOINT_1]FF1
setp   pid.y.FF2       [JOINT_1]FF2
setp   pid.y.deadband  [JOINT_1]DEADBAND
setp   pid.y.maxoutput [JOINT_1]MAX_OUTPUT
setp   pid.y.error-previous-target true

net y-index-enable  <=> pid.y.index-enable
net y-enable        =>  pid.y.enable
net y-pos-cmd       =>  pid.y.command
#net y-vel-cmd       =>  pid.y.command-deriv
net y-pos-fb        =>  pid.y.feedback
net y-output        =>  pid.y.output

# ---PWM Generator signals/setup---

setp   hm2_7i92.0.7i77.0.1.analogout1-scalemax  [JOINT_1]OUTPUT_SCALE
setp   hm2_7i92.0.7i77.0.1.analogout1-minlim    [JOINT_1]OUTPUT_MIN_LIMIT
setp   hm2_7i92.0.7i77.0.1.analogout1-maxlim    [JOINT_1]OUTPUT_MAX_LIMIT

net y-output                             => hm2_7i92.0.7i77.0.1.analogout1
net y-pos-cmd    joint.1.motor-pos-cmd
net y-enable     joint.1.amp-enable-out

# ---Encoder feedback signals/setup---

setp    hm2_7i92.0.encoder.01.counter-mode 0
setp    hm2_7i92.0.encoder.01.filter 1
setp    hm2_7i92.0.encoder.01.index-invert 0
setp    hm2_7i92.0.encoder.01.index-mask 0
setp    hm2_7i92.0.encoder.01.index-mask-invert 0
setp    hm2_7i92.0.encoder.01.scale  [JOINT_1]ENCODER_SCALE

net y-pos-fb               <=  hm2_7i92.0.encoder.01.position
net y-vel-fb               <=  hm2_7i92.0.encoder.01.velocity
net y-pos-fb               =>  joint.1.motor-pos-fb
net y-index-enable    joint.1.index-enable  <=>  hm2_7i92.0.encoder.01.index-enable
net y-pos-rawcounts        <=  hm2_7i92.0.encoder.01.rawcounts

# ---setup home / limit switch signals---

net y-home-sw     =>  joint.1.home-sw-in
net y-neg-limit     =>  joint.1.neg-lim-sw-in
net y-pos-limit     =>  joint.1.pos-lim-sw-in

#*******************
#  AXIS Z
#*******************

setp   pid.z.Pgain     [JOINT_2]P
setp   pid.z.Igain     [JOINT_2]I
setp   pid.z.Dgain     [JOINT_2]D
setp   pid.z.bias      [JOINT_2]BIAS
setp   pid.z.FF0       [JOINT_2]FF0
setp   pid.z.FF1       [JOINT_2]FF1
setp   pid.z.FF2       [JOINT_2]FF2
setp   pid.z.deadband  [JOINT_2]DEADBAND
setp   pid.z.maxoutput [JOINT_2]MAX_OUTPUT
setp   pid.z.error-previous-target true

net z-index-enable  <=> pid.z.index-enable
net z-enable        =>  pid.z.enable
net z-pos-cmd       =>  pid.z.command
#net z-vel-cmd       =>  pid.z.command-deriv
net z-pos-fb        =>  pid.z.feedback
net z-output        =>  pid.z.output

# ---PWM Generator signals/setup---

setp   hm2_7i92.0.7i77.0.1.analogout2-scalemax  [JOINT_2]OUTPUT_SCALE
setp   hm2_7i92.0.7i77.0.1.analogout2-minlim    [JOINT_2]OUTPUT_MIN_LIMIT
setp   hm2_7i92.0.7i77.0.1.analogout2-maxlim    [JOINT_2]OUTPUT_MAX_LIMIT

net z-output                             => hm2_7i92.0.7i77.0.1.analogout2
net z-pos-cmd    joint.2.motor-pos-cmd
net z-enable     joint.2.amp-enable-out

# ---Encoder feedback signals/setup---

setp    hm2_7i92.0.encoder.02.counter-mode 0
setp    hm2_7i92.0.encoder.02.filter 1
setp    hm2_7i92.0.encoder.02.index-invert 0
setp    hm2_7i92.0.encoder.02.index-mask 0
setp    hm2_7i92.0.encoder.02.index-mask-invert 0
setp    hm2_7i92.0.encoder.02.scale  [JOINT_2]ENCODER_SCALE

net z-pos-fb               <=  hm2_7i92.0.encoder.02.position
net z-vel-fb               <=  hm2_7i92.0.encoder.02.velocity
net z-pos-fb               =>  joint.2.motor-pos-fb
net z-index-enable    joint.2.index-enable  <=>  hm2_7i92.0.encoder.02.index-enable
net z-pos-rawcounts        <=  hm2_7i92.0.encoder.02.rawcounts

# ---setup home / limit switch signals---

net z-home-sw     =>  joint.2.home-sw-in
net z-neg-limit     =>  joint.2.neg-lim-sw-in
net z-pos-limit     =>  joint.2.pos-lim-sw-in

#*******************
#  SPINDLE S
#*******************

setp   pid.s.Pgain     [SPINDLE_9]P
setp   pid.s.Igain     [SPINDLE_9]I
setp   pid.s.Dgain     [SPINDLE_9]D
setp   pid.s.bias      [SPINDLE_9]BIAS
setp   pid.s.FF0       [SPINDLE_9]FF0
setp   pid.s.FF1       [SPINDLE_9]FF1
setp   pid.s.FF2       [SPINDLE_9]FF2
setp   pid.s.deadband  [SPINDLE_9]DEADBAND
setp   pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp   pid.s.error-previous-target true

net spindle-index-enable  <=> pid.s.index-enable
net spindle-enable        =>  pid.s.enable
net spindle-vel-cmd-rpm   => pid.s.command
net spindle-vel-fb-rpm     => pid.s.feedback
net spindle-output        <=  pid.s.output mux2.0.in0

#======orient-pid---start

setp   pid.o.Pgain     [SPINDLE_0]P
setp   pid.o.Igain     [SPINDLE_0]I
setp   pid.o.Dgain     [SPINDLE_0]D
setp   pid.o.bias      [SPINDLE_0]BIAS
setp   pid.o.FF0       [SPINDLE_0]FF0
setp   pid.o.FF1       [SPINDLE_0]FF1
setp   pid.o.FF2       [SPINDLE_0]FF2
setp   pid.o.deadband  [SPINDLE_0]DEADBAND
setp   pid.o.maxoutput [SPINDLE_0]MAX_OUTPUT
setp   pid.o.error-previous-target true
net spindle-index-enable       <=> pid.o.index-enable

net orient-angle spindle.0.orient-angle orient.0.angle
net orient-mode spindle.0.orient-mode   orient.0.mode
net spindle-orient spindle.0.orient  orient.0.enable pid.o.enable mux2.0.sel
net spindle-in-pos orient.0.is-oriented spindle.0.is-oriented
net spindle-revs orient.0.position pid.o.feedback
net orient-command orient.0.command pid.o.command
net spindle-output2 pid.o.output mux2.0.in1



#======orient-pid---end


# ---PWM Generator signals/setup---

setp   hm2_7i92.0.7i77.0.1.analogout4-scalemax  [SPINDLE_9]OUTPUT_SCALE
setp   hm2_7i92.0.7i77.0.1.analogout4-minlim    [SPINDLE_9]OUTPUT_MIN_LIMIT
setp   hm2_7i92.0.7i77.0.1.analogout4-maxlim    [SPINDLE_9]OUTPUT_MAX_LIMIT

net spindle-output      => hm2_7i92.0.7i77.0.1.analogout4
#net spindle-enable      => hm2_7i92.0.7i77.0.1.spinena

# ---setup spindle control signals---

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 gearchoice.0.speed-command   <=  spindle.0.speed-out
net spindle-vel-cmd-rpm-abs    <=  spindle.0.speed-out-abs
net spindle-enable      gearchoice.0.spindle-on  <=  spindle.0.on
net spindle-cw                 <=  spindle.0.forward
net spindle-ccw                <=  spindle.0.reverse
net spindle-brake       gearchoice.0.brake-enable   <=  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

#net spindle-input-index  hm2_7i92.0.encoder.03.input-index
#net spindle-revs spindle.0.revs orient.0.position

# ---Setup spindle at speed signals---

sets spindle-at-speed true

#SPINDLE RPM TEST
setp     scale.spindle.gain 58.84
setp     lowpass.spindle.gain 1.00000
net spindle-vel-fb-rps     =>     scale.spindle.in 
net spindle-fb-rpm               scale.spindle.out   =>   abs.spindle.in  
#net spindle-fb-rpm               mux2.0.out   =>   abs.spindle.in
net spindle-fb-rpm-abs           abs.spindle.out         =>   lowpass.spindle.in
net spindle-fb-rpm-abs-filtered  lowpass.spindle.out
#SPINDLE RPM TEST


net spindle-enable spindle.0.on => hm2_7i92.0.7i72.0.2.output-22 hm2_7i92.0.7i72.0.2.output-23
#net spindle-ccw spindle.0.reverse => hm2_7i92.0.7i72.0.2.output-23 hm2_7i92.0.7i72.0.2.output-22

#ENCODER INFO

setp    hm2_7i92.0.encoder.03.counter-mode 0
setp    hm2_7i92.0.encoder.03.filter 1
setp    hm2_7i92.0.encoder.03.index-invert 1
setp    hm2_7i92.0.encoder.03.index-mask 0
setp    hm2_7i92.0.encoder.03.index-mask-invert 0
setp    hm2_7i92.0.encoder.03.scale  [SPINDLE_9]ENCODER_SCALE

net spindle-revs             <=   hm2_7i92.0.encoder.03.position
net spindle-vel-fb-rps       <=   hm2_7i92.0.encoder.03.velocity
net spindle-index-enable    <=>  hm2_7i92.0.encoder.03.index-enable
#net spindle-index-enable    <=>  hm2_7i92.0.7i77.0.0.input-31

#---END-OF-MESA-PNCCONFIGURATION---
#============================================================
#---HALUI-SIGNALS-START---

net joint-select-a        halui.axis.x.select
net x-is-homed            halui.joint.0.is-homed
net jog-x-pos             halui.axis.x.plus
net jog-x-neg             halui.axis.x.minus
net jog-x-analog          halui.axis.x.analog
net joint-select-b        halui.axis.y.select
net y-is-homed            halui.joint.1.is-homed
net jog-y-pos             halui.axis.y.plus
net jog-y-neg             halui.axis.y.minus
net jog-y-analog          halui.axis.y.analog
net joint-select-c        halui.axis.z.select
net z-is-homed            halui.joint.2.is-homed
net jog-z-pos             halui.axis.z.plus
net jog-z-neg             halui.axis.z.minus
net jog-z-analog          halui.axis.z.analog
net jog-selected-pos      halui.axis.selected.plus
net jog-selected-neg      halui.axis.selected.minus
net spindle-manual-cw     halui.spindle.0.forward
net spindle-manual-ccw    halui.spindle.0.reverse
net spindle-manual-stop   halui.spindle.0.stop
net machine-is-on         halui.machine.is-on
net jog-speed             halui.axis.jog-speed
net MDI-mode              halui.mode.is-mdi

#---HALUI-SIGNALS-END---
#============================================================
#---COOLANT-CONTROL---START---

net coolant-mist      <=  iocontrol.0.coolant-mist
net coolant-flood     <=  iocontrol.0.coolant-flood

# --- COOLANT-FLOOD ---
net coolant-flood hm2_7i92.0.7i72.0.2.output-01

# --- COOLANT-MIST ---
net coolant-mist hm2_7i92.0.7i72.0.2.output-02

#net coolant-flood <= matrix_kb.0.key.r3c6
#net coolant-mist <= matrix_kb.0.key.r3c5

#---COOLANT-CONTROL---END---
#============================================================
#---OUTPUT-SIGNALS-START---

# --- POWER-DRAWBAR ---
net power-drawbar hm2_7i92.0.7i72.0.2.output-03

# --- SPINDLE AIR BLAST ---
net spindle-air-blast   hm2_7i92.0.7i72.0.2.output-11

#---OUTPUT-SIGNALS-END---
#============================================================
#---MISCELLANEOUS-START---

#  ---motion control signals---

net in-position   lube.motion-lube  <=  motion.in-position => motion.atc-position
net machine-is-enabled   <=  motion.motion-enabled

net tool-out-from-gcode  motion.digital-out-00 =>  ATC.from-gcode

net power-drawbar <= matrix_kb.0.key.r3c1

#---BEACON---NEEDS BULB!!
#net beacon-light hm2_7i92.0.7i72.0.2.output-21

#---MISCELLANEOUS-END---
#============================================================
#---MODE-SELECT-KEYBOARD-START---

net mode-jog matrix_kb.0.key.r6c3 => halui.mode.manual
net mode-auto matrix_kb.0.key.r6c6 => halui.mode.auto
net mode-manual matrix_kb.0.key.r6c5 => halui.mode.mdi

#---MODE-SELECT-KEYBOARD-END---
#============================================================
#---CAROUSEL-ATC-COMPONENT-PINS-START---

net tool-prepare-loopback   iocontrol.0.tool-prepare   =>  iocontrol.0.tool-prepared
#net tool-prepare-loopback   ATC.tool-prepare   =>  iocontrol.0.tool-prepared
net tool-prep-number        iocontrol.0.tool-prep-number => carousel.0.pocket-number
net tool-change             iocontrol.0.tool-change     =>    carousel.0.enable
net atc-tool-change-out     iocontrol.0.tool-changed <=     carousel.0.ready
net turret-sensor-pocket      hm2_7i92.0.7i77.0.0.input-29  => carousel.0.sense-0 carousel.0.sense-1
net tool-number             iocontrol.0.tool-number  =>      carousel.0.init-position
net turret-motor-forpin     hm2_7i92.0.7i72.0.2.output-09   ATC.turret-forward-out
net turret-motor-revpin     hm2_7i92.0.7i72.0.2.output-10   ATC.turret-reverse-out
net turret-motor-fwd        carousel.0.motor-fwd            ATC.turret-forward-in
net turret-motor-rev        carousel.0.motor-rev            ATC.turret-reverse-in
net turret-active           carousel.0.active               ATC.turret-active
net carousel-homing-toggle  motion.digital-out-03
net carousel-jog-fwd               matrix_kb.0.key.r3c2  =>      carousel.0.jog-fwd
net carousel-jog-rev               matrix_kb.0.key.r3c3  =>      carousel.0.jog-rev
#net tool-out-from-gcode  motion.digital-out-00 =>  ATC.from-gcode

#---CAROUSEL-ATC-COMPONENT-PINS-END---
#============================================================
#---TURRET-SLIDE-PINS-START---

net turret-slide-in SO.atc-turslide-in => hm2_7i92.0.7i72.0.2.output-08
net turret-slide-out SO.atc-turslide-out => hm2_7i92.0.7i72.0.2.output-07

#---TURRET-SLIDE-PINS-END---
#============================================================
#----PINS---ORIENT SENSOR AND LOCK---START

#net orient-sensor SO.so-sen =>  hm2_7i92.0.7i77.0.0.input-31
#net orient-lock SO.so-or-lock => hm2_7i92.0.7i72.0.2.output-06
net orient-lock motion.digital-out-01 => hm2_7i92.0.7i72.0.2.output-06

#----PINS---ORIENT SENSOR AND LOCK---END
#============================================================
#----PINS---ESTOP---START

net estop-in iocontrol.0.emc-enable-in <= and2.0.out
net internal-estop and2.0.in1 <= iocontrol.0.user-enable-out
net remote-estop and2.0.in0 halui.estop.activate => hm2_7i92.0.7i77.0.0.input-20-not
net estop-in <= hm2_7i92.0.7i72.0.2.output-00

#net estop-in halui.machine.on

#----PINS---ESTOP---END
#============================================================
#----PINS---JOG PENDANT---START

net x-jog-select axis.x.jog-enable <= axisselect.x
net y-jog-select axis.y.jog-enable <= axisselect.y
net z-jog-select axis.z.jog-enable <= axisselect.z
#net a-jog-select axis.a.jog-enable <= hm2_7i92.0.7i77.0.0.input-03
net axis-sel-0 axisselect.one <=  hm2_7i92.0.7i77.0.0.input-00
net axis-sel-1 axisselect.two <=  hm2_7i92.0.7i77.0.0.input-01
net x100 hm2_7i92.0.7i77.0.0.input-03 => mux4.0.sel1
net x10 hm2_7i92.0.7i77.0.0.input-04 => mux4.0.sel0
net jogscale mux4.0.out => joint.0.jog-scale axis.x.jog-scale
net jogscale => joint.1.jog-scale axis.y.jog-scale
net jogscale => joint.2.jog-scale axis.z.jog-scale
#net jogscale =>joint.3.jog-scale axis.a.jog-scale
net mpg-out hm2_7i92.0.7i77.0.0.enc0.rawcounts => ilowpass.0.in
net jogcounts ilowpass.0.out => joint.0.jog-counts axis.x.jog-counts
net jogcounts => joint.1.jog-counts axis.y.jog-counts
net jogcounts => joint.2.jog-counts axis.z.jog-counts
#net jogcounts => joint.3.jog-counts axis.a.jog-counts

#----PINS---JOG PENDANT---END
#============================================================
#----PHYSICAL-MESA-PINS---MATRIX KEYBOARD---START---

net key_01 matrix_kb.0.row-00-out <= hm2_7i92.0.7i77.0.0.output-07
net key_02 matrix_kb.0.row-01-out <= hm2_7i92.0.7i77.0.0.output-00
net key_03 matrix_kb.0.row-02-out <= hm2_7i92.0.7i77.0.0.output-01
net key_04 matrix_kb.0.row-03-out <= hm2_7i92.0.7i77.0.0.output-02
net key_05 matrix_kb.0.row-04-out <= hm2_7i92.0.7i77.0.0.output-03
net key_06 matrix_kb.0.row-05-out <= hm2_7i92.0.7i77.0.0.output-04
net key_07 matrix_kb.0.row-06-out <= hm2_7i92.0.7i77.0.0.output-05
net key_08 matrix_kb.0.row-07-out <= hm2_7i92.0.7i77.0.0.output-06
net key_09 matrix_kb.0.col-00-in <= hm2_7i92.0.7i77.0.0.input-08
net key_10 matrix_kb.0.col-01-in <= hm2_7i92.0.7i77.0.0.input-09
net key_11 matrix_kb.0.col-02-in <= hm2_7i92.0.7i77.0.0.input-10
net key_12 matrix_kb.0.col-03-in <= hm2_7i92.0.7i77.0.0.input-11
net key_13 matrix_kb.0.col-04-in <= hm2_7i92.0.7i77.0.0.input-12
net key_14 matrix_kb.0.col-05-in <= hm2_7i92.0.7i77.0.0.input-13
net key_15 matrix_kb.0.col-06-in <= hm2_7i92.0.7i77.0.0.input-14
net key_16 matrix_kb.0.col-07-in <= hm2_7i92.0.7i77.0.0.input-15

#----PHYSICAL-MESA-PINS---MATRIX KEYBOARD---END---
#============================================================
#----KEYBOARD-LAYOUT-PYAUTOGUI---MATRIX KEYBOARD---START---

net keyboard-enter  matrix_kb.0.key.r5c2  => pyautopins.enter
net keyboard-m  matrix_kb.0.key.r0c2  => pyautopins.m
net keyboard-6  matrix_kb.0.key.r0c5  => pyautopins.6
net keyboard-t  matrix_kb.0.key.r1c5  => pyautopins.t
net keyboard-1  matrix_kb.0.key.r4c4  => pyautopins.1
net keyboard-2  matrix_kb.0.key.r4c7  => pyautopins.2
net keyboard-3  matrix_kb.0.key.r4c6  => pyautopins.3
net keyboard-4  matrix_kb.0.key.r4c5  => pyautopins.4
net keyboard-5  matrix_kb.0.key.r0c6  => pyautopins.5
net keyboard-7  matrix_kb.0.key.r0c1  => pyautopins.7
net keyboard-8  matrix_kb.0.key.r4c1  => pyautopins.8
net keyboard-9  matrix_kb.0.key.r4c3  => pyautopins.9
net keyboard-0  matrix_kb.0.key.r4c0  => pyautopins.0
net keyboard-backspace  matrix_kb.0.key.r5c4  => pyautopins.backspace
net keyboard-q  matrix_kb.0.key.r5c7  => pyautopins.q
net keyboard-w  matrix_kb.0.key.r5c6  => pyautopins.w
net keyboard-e  matrix_kb.0.key.r5c5  => pyautopins.e
net keyboard-r  matrix_kb.0.key.r1c6  => pyautopins.r
net keyboard-y  matrix_kb.0.key.r1c1  => pyautopins.y
net keyboard-u  matrix_kb.0.key.r1c3  => pyautopins.u
net keyboard-i  matrix_kb.0.key.r5c1  => pyautopins.i
net keyboard-o  matrix_kb.0.key.r5c3  => pyautopins.o
net keyboard-p  matrix_kb.0.key.r5c0  => pyautopins.p
net keyboard-delete  matrix_kb.0.key.r7c4  => pyautopins.delete
net keyboard-a  matrix_kb.0.key.r7c7  => pyautopins.a
net keyboard-s  matrix_kb.0.key.r7c6  => pyautopins.s
net keyboard-d  matrix_kb.0.key.r7c5  => pyautopins.d
net keyboard-f  matrix_kb.0.key.r1c4  => pyautopins.f
net keyboard-g  matrix_kb.0.key.r1c7  => pyautopins.g
net keyboard-h  matrix_kb.0.key.r1c0  => pyautopins.h
net keyboard-j  matrix_kb.0.key.r1c2  => pyautopins.j
net keyboard-k  matrix_kb.0.key.r7c1  => pyautopins.k
net keyboard-l  matrix_kb.0.key.r7c3  => pyautopins.l
net keyboard-semicolon  matrix_kb.0.key.r7c0  => pyautopins.semicolon
net keyboard-plus  matrix_kb.0.key.r7c2  => pyautopins.plus
net keyboard-shiftleft  matrix_kb.0.key.r2c4  => pyautopins.shiftleft
net keyboard-shiftright  matrix_kb.0.key.r2c2  => pyautopins.shiftright
net keyboard-z  matrix_kb.0.key.r2c7  => pyautopins.z
net keyboard-x  matrix_kb.0.key.r2c6  => pyautopins.x
net keyboard-c  matrix_kb.0.key.r2c5  => pyautopins.c
net keyboard-v  matrix_kb.0.key.r0c4  => pyautopins.v
net keyboard-b  matrix_kb.0.key.r0c7  => pyautopins.b
net keyboard-n  matrix_kb.0.key.r0c0  => pyautopins.n
net keyboard-comma  matrix_kb.0.key.r2c1  => pyautopins.comma
net keyboard-period  matrix_kb.0.key.r2c3  => pyautopins.period
net keyboard-forwardslash  matrix_kb.0.key.r2c0  => pyautopins.forwardslash
net keyboard-space  matrix_kb.0.key.r0c3  => pyautopins.space
net keyboard-minus  matrix_kb.0.key.r4c2  => pyautopins.minus

#----KEYBOARD-LAYOUT-PYAUTOGUI---MATRIX KEYBOARD---END---
#============================================================
#----PINS---TOGGLE COMPONENTS---START

# Flood Coolant control with one button
#net flood-toggle toggle.0.in <= matrix_kb.0.key.r3c6
#net flood-control toggle.0.out => hm2_7i92.0.7i72.0.2.output-01

# THRU SPINDLE COOLANT with one button
#net thru-spindle-toggle toggle.1.in <= matrix_kb.0.key.r3c5
#net thru-spindle-control toggle.1.out => hm2_7i92.0.7i72.0.2.output-02

# SPINDLE HIGH RANGE!! control with one button
#net spindle-high-toggle toggle.2.in <= matrix_kb.0.key.r1c0
#net spindle-high-control toggle.2.out => hm2_7i92.0.7i72.0.2.output-05

# KEYBOARD SLIDE HOLD!! control with one button
#net slide-hold-toggle toggle.6.in <= matrix_kb.0.key.r3c4
#net slide-hold-control toggle.6.out => motion.feed-hold

# SPINDLE ORIENTATION!! control with one button
#net spindle-orient-toggle toggle.3.in <= matrix_kb.0.key.r5c3
#net spindle-orient-control toggle.3.out => hm2_7i92.0.7i72.0.2.output-06

# SLIDE MOTOR!! control with one button
#net slide-motor-toggle toggle.4.in <= matrix_kb.0.key.r0c2
#net slide-motor-control toggle.4.out => hm2_7i92.0.7i72.0.2.output-07

# SLIDE IN!! control with one button
#net slide-in-toggle toggle.5.in <= matrix_kb.0.key.r0c0
#net slide-in-control toggle.5.out => hm2_7i92.0.7i72.0.2.output-08

# TURRET MOTOR ON!!---KEYBOARD KEY = TURRET CW---control with one button
#net turret-motor-toggle ATC.turret-toggle toggle.6.in <= matrix_kb.0.key.r3c2
#net turret-motor-control toggle.6.out => ATC.turret-status
#net turret-on            ATC.turret-on => hm2_7i92.0.7i72.0.2.output-09

#----PINS---TOGGLE COMPONENTS---END
#============================================================
#---PROGRAM-RUN, OPTIONAL-STOP, BLOCK-DELETE, SINGLE-STEP, AND-PAUSE---START---

net program-run1 or2.0.in0 hm2_7i92.0.7i77.0.0.input-19
net program-run2 or2.0.in1  matrix_kb.0.key.r6c4
net program-runout or2.0.out  halui.program.run

net program-pause1 or2.1.in0 hm2_7i92.0.7i77.0.0.input-18 progres.panbutton
net program-pause2 or2.1.in1  matrix_kb.0.key.r3c4        progres.matrixbutton
net program-pauseout or2.1.out  halui.program.pause

net program-is-paused   halui.program.is-paused    progres.pausestatus

net program-resume progres.resume  =>  halui.program.resume

net optional-stop-on hm2_7i92.0.7i77.0.0.input-06-not => halui.program.optional-stop.on
net optional-stop-off hm2_7i92.0.7i77.0.0.input-06 => halui.program.optional-stop.off
net block-delete-on hm2_7i92.0.7i77.0.0.input-07-not => halui.program.block-delete.on
net block-delete-off hm2_7i92.0.7i77.0.0.input-07 => halui.program.block-delete.off

net single-step matrix_kb.0.key.r6c1 => halui.program.step

#---PROGRAM-RUN,OPTIONAL-STOP,AND-PAUSE---END---
#============================================================
#---RAPID-OVERRIDE-SELECTOR-SWITCH---START---

net override-scale halui.rapid-override.scale rapidselect.scale-output
net override-value halui.rapid-override.value rapidselect.value

net rapid-sel-0 rapidselect.one <=  hm2_7i92.0.7i77.0.0.input-21
net rapid-sel-1 rapidselect.two <=  hm2_7i92.0.7i77.0.0.input-22
net rapid-sel-2 rapidselect.three <= hm2_7i92.0.7i77.0.0.input-23

net rapid-sel-inc rapidselect.increase halui.rapid-override.increase
net rapid-sel-dec rapidselect.decrease halui.rapid-override.decrease

#---RAPID-OVERRIDE-SELECTOR-SWITCH---START---
#============================================================
#---SPINDLE-GEAR-CHOICE---START---

net high-gear gearchoice.0.high-gear  hm2_7i92.0.7i72.0.2.output-05

#---SPINDLE-GEAR-CHOICE---END---
#==========================================
Attachments:

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

More
21 Nov 2018 12:57 #121118 by andypugh
Replied by andypugh on topic M3 SOURCE CODE
At the momement mux2.0.out does not go anywhere, as that line is commented out.
Which means that neither speed nor orient commands will go to the spindle motor.

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

More
21 Nov 2018 13:10 #121119 by COlger81
Replied by COlger81 on topic M3 SOURCE CODE
Yes, i commented it out while trying to figure out what it's suppose to be tied to.

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

More
21 Nov 2018 13:14 #121120 by COlger81
Replied by COlger81 on topic M3 SOURCE CODE
With Mux2 out active, it was not moving the spindle on M19r0 command.

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

More
21 Nov 2018 14:24 #121124 by andypugh
Replied by andypugh on topic M3 SOURCE CODE
You need to replace this line:
net spindle-vel-cmd-rpm gearchoice.0.speed-command   <=  spindle.0.speed-out
With
net spindle-final mux2.0.out gearchoice.0.speed-command

But I don't see where gearchoice.0.out goes to. (Maybe you are not using gearchoice to modify the drive duty cycle according to high/low gear?)

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

More
21 Nov 2018 15:07 #121128 by COlger81
Replied by COlger81 on topic M3 SOURCE CODE
It's at the bottom of the hal file.

#============================================================
#---SPINDLE-GEAR-CHOICE---START---

net high-gear gearchoice.0.high-gear hm2_7i92.0.7i72.0.2.output-05

#---SPINDLE-GEAR-CHOICE---END---
#==========================================

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

More
21 Nov 2018 15:13 #121129 by COlger81
Replied by COlger81 on topic M3 SOURCE CODE
It's a WYE/DELTA internal motor gear.

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

More
21 Nov 2018 15:20 #121130 by andypugh
Replied by andypugh on topic M3 SOURCE CODE
That just selects a gear, what sets the spindle speed within the range?

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

Time to create page: 0.100 seconds
Powered by Kunena Forum