Pendant HAL Question - Machine Power and Spindle

More
06 Oct 2018 21:36 #118502 by tightmopedman9
I've been customizing my XHC pendant and haven't been able to figure out how to do two things.

I would like to turn on machine power (F2 in AXIS) using the RESET button. I thought it would be a simple net like:
net machine-is-on xhc-hb04.button-reset halui.machine.is-on
Unfortunately, this doesn't generate any output.

I configured the SPINDLE button to toggle the spindle on and off, the problem is that if the spindle is turned on from the pendant it can't be turned off except by hitting the SPINDLE button again. The spindle stop in AXIS doesn't work, nor does toggling machine power. This is the HAL code I wrote:
net spindle-or1 motion.spindle-on or2.0.in0
net spindle-or2 xhc-hb04.button-spindle toggle.1.in
net spindle-or3 toggle.1.out or2.0.in1
net spindle-toggle wj200-vfd.0.run or2.0.out

This code was posted in the XHC thread, but I can't figure out how to link the pendant to it:
net spindleOn halui.spindle.is-on not.0.in and2.1.in1
net spindleXHCButton edge.1.out and2.0.in0 and2.1.in0
net spindleOnB not.0.out and2.0.in1
net spindleTurnOn halui.spindle.start and2.0.out
net spindleTurnOff halui.spindle.stop and2.1.out


Would it be possible to simulate keyboard buttons with the XHC? With emulated button presses I could sidestep HAL and get the functionality I want very quickly.

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

More
08 Oct 2018 12:21 #118537 by andypugh
I don;t think that keyboard emulation is to be favoured over HAL. HAL is realtime and dependable.

I think that you might be trying to turn the machine on with the wrong pin (and, in fact, I suspect that the HAL load might be aborting at that point.

halui.machine.is-on is an _output_ pin, and can not be connected to another output pin (and I think that xhc-hb04.button-reset is an output pin). If you start LinuxCNC from the command line (command "linuxcnc") then you will probably see an error message.

The pin to use is: halui.machine.on
linuxcnc.org/docs/2.7/html/man/man1/halui.1.html
halui.machine.on bit in - pin for setting machine On

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

More
08 Oct 2018 20:29 #118560 by tightmopedman9
I think halui.machine.on is the first halui parameter I tested. I grabbed the most recent iteration of HAL command I had tried, which does in fact generate an error since both 'xhc-hb04.button-reset' and 'halui.machine.is-on' are output pins.

It turns out the issue was caused by having the net in the wrong HAL file. I put it in 'xhc-hb04.hal'. It worked after putting the net in custom_postgui.hal.

I realized what I was missing to make the 'better' spindle control code work. I needed to tie edge.0.in to the xhc-spindle button, duh! Also, needed to specify:
setp edge.0.out-width-ns 40000000
setp edge.0.in-edge FALSE

Without the above command edge won't generate an output. Also, I wanted to trigger edge when the button was pressed, not released.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum