Help understanding HAL dataypes

14 May 2024 19:25 - 14 May 2024 20:28 #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.

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 True
setp estop-latch.0.ok-out
setp mux-gen.00.sel-bit-00
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 '' invalid for bit
setp failed

According to is a bit out pin
halcmd show pin
    10  bit   OUT         FALSE

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
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.
Last edit: 14 May 2024 20:28 by SPO.

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

14 May 2024 21:37 #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 or Create an account to join the conversation.

14 May 2024 22:01 - 14 May 2024 22:08 #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.
Last edit: 14 May 2024 22:08 by blazini36.

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

Time to create page: 0.979 seconds
Powered by Kunena Forum