Attached is a Function Block Diagram (FBD) and netlisting for toggling halui machine on/off. Since we are using FBD, signal names are insignificant in this case. n.1 means net 1 ... etc. Hope this helps
#
# Load realtime Components and their counts
loadrt and2 count= 4
loadrt not count= 4
loadrt or2 count= 2
loadrt toggle count= 1
#
# Add functions to threads
addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf not.0 servo-thread
addf not.1 servo-thread
addf not.2 servo-thread
addf not.3 servo-thread
addf or2.0 servo-thread
addf or2.1 servo-thread
addf toggle.0 servo-thread
#
# Set parameters
setp toggle.0.debounce 5
#
# Connect hal signals to hal component Pins
net gui.pb or2.1.in1
net halui.mc.is-on halui.machine.is-on not.2.in
net halui.mc.off and2.3.out halui.machine.off
net halui.mc.on and2.1.out halui.machine.on
net mc.pnl.pb or2.0.in0
net n.1 or2.0.out or2.1.in0
net n.2 toggle.0.in and2.0.in0 and2.3.in1 or2.1.out
net n.4 toggle.0.out not.0.in
net n.5 and2.2.in0 not.1.in not.0.out
net n.6 not.3.in not.2.out and2.1.in1
net n.7 and2.0.in1 not.1.out
net n.8 not.3.out and2.2.in1
net n.9 and2.0.out and2.1.in0
net n.10 and2.2.out and2.3.in0
net pendant.pb or2.0.in1