HURCO KMB-1 Control Update
- PCW
-
- Away
- Moderator
-
Less
More
- Posts: 17705
- Thank you received: 5177
18 Feb 2026 22:31 #343181
by PCW
Replied by PCW on topic HURCO KMB-1 Control Update
Ok Peter, so that is resetting my original understanding. But I have been unable to get the index pulse, which is clearly present in halscope to trigger the position reset.
The way index works on LinuxCNC with quadrature encoders is that when LinuxCNC (or some hal component)
wants a encoder reset at the next index occurrence, it sets the index-enable pin. This arms the encoder counter
hardware so at the next index, two things happen, the encoder position is reset to 0, and the index enable pin
is set false, so LinuxCNC or the controlling hal component knows that the index has been detected (and position zeroed)
The way index works on LinuxCNC with quadrature encoders is that when LinuxCNC (or some hal component)
wants a encoder reset at the next index occurrence, it sets the index-enable pin. This arms the encoder counter
hardware so at the next index, two things happen, the encoder position is reset to 0, and the index enable pin
is set false, so LinuxCNC or the controlling hal component knows that the index has been detected (and position zeroed)
The following user(s) said Thank You: NT4Boy
Please Log in or Create an account to join the conversation.
- NT4Boy
- Offline
- Premium Member
-
Less
More
- Posts: 141
- Thank you received: 13
19 Feb 2026 17:22 #343196
by NT4Boy
Replied by NT4Boy on topic HURCO KMB-1 Control Update
I've ended up fighting the hal loader.
#
# M19 ORIENT – single driver / multi‑sink form
#
loadrt orient count=1
addf orient.0 servo-thread
loadrt pid names=pid.o
addf pid.o.do-pid-calcs servo-thread
loadrt mux2 count=1
addf mux2.0 servo-thread
loadrt or2 count=1
addf or2.0 servo-thread
# --- Orient PID tuning ---
setp pid.o.Pgain 0.05
setp pid.o.Igain 0.0005
setp pid.o.Dgain 0.0002
setp pid.o.maxoutput 60
setp pid.o.error-previous-target true
setp orient.0.tolerance 0.05
setp orient.0.angle 0
# --- One signal name, declared once and fanned out ---
net orient-bit spindle.0.orient => orient.0.enable
net orient-bit => or2.0.in1
net orient-bit => mux2.0.sel
# separate signal drives the encoder’s index enable input
net orient-arm-index orient-bit => hm2_7i92.0.encoder.05.index-enable
# --- Run enable OR gate ---
net run-enable or2.0.out => hm2_7i92.0.7i77.0.1.spinena
net spindle-enable => or2.0.in0
# --- Orient angle / feedback wiring ---
net orient-angle spindle.0.orient-angle => orient.0.angle
net spindle-revs hm2_7i92.0.encoder.05.position => orient.0.position
# --- Orient PID loop ---
net orient-cmd orient.0.command => pid.o.command
net orient-fb hm2_7i92.0.encoder.05.velocity-rpm => pid.o.feedback
net orient-out pid.o.output => mux2.0.in1
# --- Normal spindle path and output switch ---
net spindle-output pid.s.output => mux2.0.in0
net spindle-vfd-out mux2.0.out => hm2_7i92.0.7i77.0.1.analogout5
# --- Completion flag back to controller ---
net orient-done orient.0.is-oriented => spindle.0.is-oriented
#Error in file ./spindlecontrol.hal:
# Pin 'orient-bit' does not exist
#Shutting down and cleaning up LinuxCNC…
#
# M19 ORIENT – single driver / multi‑sink form
#
loadrt orient count=1
addf orient.0 servo-thread
loadrt pid names=pid.o
addf pid.o.do-pid-calcs servo-thread
loadrt mux2 count=1
addf mux2.0 servo-thread
loadrt or2 count=1
addf or2.0 servo-thread
# --- Orient PID tuning ---
setp pid.o.Pgain 0.05
setp pid.o.Igain 0.0005
setp pid.o.Dgain 0.0002
setp pid.o.maxoutput 60
setp pid.o.error-previous-target true
setp orient.0.tolerance 0.05
setp orient.0.angle 0
# --- One signal name, declared once and fanned out ---
net orient-bit spindle.0.orient => orient.0.enable
net orient-bit => or2.0.in1
net orient-bit => mux2.0.sel
# separate signal drives the encoder’s index enable input
net orient-arm-index orient-bit => hm2_7i92.0.encoder.05.index-enable
# --- Run enable OR gate ---
net run-enable or2.0.out => hm2_7i92.0.7i77.0.1.spinena
net spindle-enable => or2.0.in0
# --- Orient angle / feedback wiring ---
net orient-angle spindle.0.orient-angle => orient.0.angle
net spindle-revs hm2_7i92.0.encoder.05.position => orient.0.position
# --- Orient PID loop ---
net orient-cmd orient.0.command => pid.o.command
net orient-fb hm2_7i92.0.encoder.05.velocity-rpm => pid.o.feedback
net orient-out pid.o.output => mux2.0.in1
# --- Normal spindle path and output switch ---
net spindle-output pid.s.output => mux2.0.in0
net spindle-vfd-out mux2.0.out => hm2_7i92.0.7i77.0.1.analogout5
# --- Completion flag back to controller ---
net orient-done orient.0.is-oriented => spindle.0.is-oriented
#Error in file ./spindlecontrol.hal:
# Pin 'orient-bit' does not exist
#Shutting down and cleaning up LinuxCNC…
Please Log in or Create an account to join the conversation.
Moderators: piasdom
Time to create page: 0.066 seconds