Help understanding HAL dataypes

More
2 years 5 months ago #300594 by SPO
LinuxCNC 2.9.2
Mesa 7i96s

We have a hobby lathe that has an interlock for a guard / shield.
Our initial configuration had an estop button and the guard interlock in an estop latch.
Now we would like to allow the guard to be open when the lathe is not in auto / running a program.
For now we have been using a second key for the guard, I would like to avoid that.
I haven't looked into the pins for running a program yet, but my question is more about hal datatypes.

Code:
loadrt mux_generic config="bb2" addf mux-gen.00 servo-thread loadrt estop_latch count=2 addf estop-latch.0 servo-thread addf estop-latch.1 servo-thread net estop-loopin iocontrol.0.user-enable-out => estop-latch.0.ok-in setp mux-gen.00.in-bit-00 True setp mux-gen.00.in-bit-01 estop-latch.0.ok-out setp mux-gen.00.sel-bit-00 halui.mode.is-auto net estop-door.ok mux-gen.0.out-bit => estop-latch.1.ok-in net estop-loopout estop-latch.1.ok-out => iocontrol.0.emc-enable-in net estop-reset <= iocontrol.0.user-request-enable net estop-reset => estop-latch.0.reset net estop-reset => estop-latch.1.reset net remote-estop0 estop-latch.0.fault-in <= hm2_7i96s.0.inm.00.input-04-not net remote-estop1 estop-latch.1.fault-in <= hm2_7i96s.0.inm.00.input-05-not

The result error messages I get are:
value 'estop-latch.0.ok-out' invalid for bit
setp failed

Replacing 'estop-latch.0.ok-out' with False for testing
value 'halui.mode.is-auto' invalid for bit
setp failed

According to linuxcnc.org/docs/stable/html/gui/halui.html#_mode halui.mode.is-auto is a bit out pin
halcmd show pin halui.mode.is-auto
    10  bit   OUT         FALSE  halui.mode.is-auto

I'm not sure why it doesn't work and the error message isn't great.  In LinuxCNC it looks like the error message is from github.com/LinuxCNC/linuxcnc/blob/dc9a98...cmd_commands.cc#L666
Does FALSE from halcmd ouput not equal FALSE in some way?  Maybe halui isn't loaded at this point?
Any help / insight would be apperciated.  Thanks

Edit: Looking at the error messages again, I realize setp is taking the literal value of the second parameter.  Not the value of the pin with that name.  Now to see if I can figure it out with net / signals.

Please Log in to join the conversation.

More
2 years 5 months ago #300616 by PCW
Replied by PCW on topic Help understanding HAL dataypes
Yes, setp uses literals (and only sets the value once at startup if in a hal file)
net commands link a signal to a pin or pins

Please Log in to join the conversation.

More
2 years 5 months ago #300621 by blazini36
Looks like you figured out that setp isn't to be used on a line where you are connecting a signal, that is net.

Edit: nevermind, I se what you were drying to do, just use net on that line, and put a signal name in front. You don't setp a value of one pin to another, you net them together with a signal so the input pin takes the value of the output pin.

setp is for pins/parameters that you don't need to connect to anything and just want to set a static value to.

Please Log in to join the conversation.

Time to create page: 0.078 seconds
Powered by Kunena Forum