HURCO KMB-1 Control Update

More
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 following user(s) said Thank You: NT4Boy

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

More
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…

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

More
20 Feb 2026 13:52 - 20 Feb 2026 13:53 #343224 by NT4Boy
Replied by NT4Boy on topic HURCO KMB-1 Control Update

If it's open loop, the question becomes what is changing the analog out command?

(bottom trace second plot)
 
Fixed the varying speed.. The source was the analog speed override pots, which are 5volt, being scaled to 3.3 and lastly 8 bit converted. 
I inserted a low pass filter with gain at 0.01 after the  analogin pin, and its magically stable.
You suggested this some time back, and as ever it was a good call. Thanks

Last edit: 20 Feb 2026 13:53 by NT4Boy.

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

More
23 Feb 2026 19:49 - 23 Feb 2026 19:51 #343359 by NT4Boy
Replied by NT4Boy on topic HURCO KMB-1 Control Update
I fought the non existent pin in my spindle control hal until I found out that 
hm2_7i92.0.encoder.N.index‑enable isn’t just a plain input pin. Not realy sure what I mean by that, but I cannot use 'normal' signal and pin logic, but I can set it with a setp halcmd which for now is a start.
The top trace shows the index enable being set, then encountering the index pulse, which unsets it, meanwhile the orient.0.poserr also gets reset and increases until the next manual reset, but the poserr values are not making much sense to me. The bottom of the sawtooth is -5398 and as time passes this figure increases towards zero and in fact eventually into positive, Can anyone explain these values please?  [attachment=74653]poserr.png[/attachment]
Attachments:
Last edit: 23 Feb 2026 19:51 by NT4Boy.

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

More
23 Feb 2026 19:53 #343361 by NT4Boy
Replied by NT4Boy on topic HURCO KMB-1 Control Update
Missing file
Attachments:

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

Moderators: piasdom
Time to create page: 0.127 seconds
Powered by Kunena Forum