Custom Hal Code - Estop latch - Push Buttons - Lights

More
07 Dec 2019 12:31 #152240 by thefabricator03
Hi Guys,

Just looking for a bit of help getting my custom hal code sorted.

First I want to latch two e-stops together, reading RodW thread on that subject I get this code,
loadrt estop_latch count=2
addf estop-latch.0            servo-thread
addf estop-latch.1            servo-thread


# --- ESTOP CHAIN STARTS ---
net latch-reset iocontrol.0.user-request-enable 
net latch0-ok-in iocontrol.0.user-enable-out 

net latch0-ok-in => estop-latch.0.ok-in
net latch0-out <= estop-latch.0.ok-out 
net latch0-out => estop-latch.1.ok-in
net latch1-out <= estop-latch.1.ok-out 


net latch-reset => estop-latch.0.reset
net latch-reset => estop-latch.1.reset
net latch-out iocontrol.0.emc-enable-in <= estop-latch.1.ok-out
net estop-out estop-latch.1.fault-out

# --- EXTERNAL ESTOP SWITCH ---
net external-estop <= hm2_7i76e.0.7i76.0.0.input-13
net external-estop => estop-latch.0.fault-in

net external-estop <= hm2_7i76e.0.7i76.0.0.input-14
net external-estop => estop-latch.1.fault-in

# --- ESTOP CHAIN ENDS ---

The next thing I need to add is enables for Linuxcnc to my motor drives.

I got this from the motion manual,
       joint.N.amp-enable-out OUT BIT
              TRUE if the amplifier for this joint should be enabled

Do I put this somewhere in my hal?
joint.0.amp-enable-out <= hm2_7i76e.0.7i76.0.0.output-08
joint.1.amp-enable-out <= hm2_7i76e.0.7i76.0.0.output-09
joint.2.amp-enable-out <= hm2_7i76e.0.7i76.0.0.output-10
joint.3.amp-enable-out <= hm2_7i76e.0.7i76.0.0.output-11

Next I need to set up two push buttons to toggle machine power on and off in Axis.

I have read that I need tie it to axis.N.amp-enable-out. How will that look? Should I somehow tie that to the enable code?

Then I need to set up fault detection,
       joint.N.amp-fault-in IN BIT
              Should be driven TRUE if an external fault is detected with  the
              amplifier for this joint
Same as above, do I just put this somewhere in the hal?
joint.0.amp-fault-in  <= hm2_7i76e.0.7i76.0.0.input-20
joint.1.amp-fault-in  <= hm2_7i76e.0.7i76.0.0.input-21
joint.2.amp-fault-in  <= hm2_7i76e.0.7i76.0.0.input-22
joint.3.amp-fault-in  <= hm2_7i76e.0.7i76.0.0.input-23

Last I need to tie a red and green light to the state of machine power in Axis. Again do I tie that to the enable circuit?

Sorry for the long post. I have been trying to get my head around this for a while now with no luck.
Any help would be greatly appreciated.

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

More
07 Dec 2019 13:01 #152241 by thefabricator03
Sorry I posted this in the wrong forum,

Could I get it moved to the HAL forum if possible.

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

More
10 Dec 2019 12:27 - 10 Dec 2019 13:23 #152431 by bevins
e-stop latch can be done in 4 lines.
loadrt estop_latch
addf estop-latch.0 servo-thread

net estop-loopout iocontrol.0.emc-enable-in <= estop-latch.0.ok-out
net estop-loopin iocontrol.0.user-enable-out => estop-latch.0.ok-in
net estop-reset iocontrol.0.user-request-enable => estop-latch.0.reset
net remote-estop estop-latch.0.fault-in <=  hm2_5i25.0.7i77.0.0.input-07-not

For drive enables, I energize relays when the machine is turned on and enable the drives with one relay dpdt.
The second relay you can use to lite a green lite that will follow machine-is-on.
net machine-is-on hm2_5i25.0.7i71.1.1.output-25 hm2_5i25.0.7i71.1.1.output-26


To turn machine on with button use halui.machine.on like so:
net but-pwr toggle.0.in <= hm2_5i25.0.7i77.0.0.input-08
net tog-but toggle2nist.0.in <= toggle.0.out
net tog-on toggle2nist.0.is-on <=  halui.machine.is-on
net pwr-on halui.machine.on <= toggle2nist.0.on
net pwr-off halui.machine.off <= toggle2nist.0.off

I havent tested this, but it should work.

just my 2 cents.

/EDIT I just reread your thread. You are trying to latch two estop circuits. Mine is for one estop circuit. You could just put the two estop loops in serial and use just one loop.
Last edit: 10 Dec 2019 13:23 by bevins.
The following user(s) said Thank You: thefabricator03

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

More
11 Dec 2019 08:53 #152474 by rodw
I think what is not covered in the docs anywhere is that estop-latch lets you chain estop circuits together in HAL.
Its not always possible to physically wire all estops into one circuit.

eg. One of my estop buttons is on a wireless pendant....

How do you handle a plasma torch breakaway. Is that a pause condition or an estop condition? That ones a bit academic now as its never let go while using Plasmac!

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

More
11 Dec 2019 12:21 #152478 by bevins

I think what is not covered in the docs anywhere is that estop-latch lets you chain estop circuits together in HAL.
Its not always possible to physically wire all estops into one circuit.

eg. One of my estop buttons is on a wireless pendant....

How do you handle a plasma torch breakaway. Is that a pause condition or an estop condition? That ones a bit academic now as its never let go while using Plasmac!


I hear what your saying but, you have to wire them into the same board anyway at the same location. So my thoughts are why complicate things. I would never create two estop loops. Thats just me. Your wireless pendant, you need to put a receiver somewhere, so why not put it in the control and wire it in series with the one estop loop. I am not following why you would need two loops.

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

More
12 Dec 2019 00:33 #152508 by rodw
Because my machine grew over time it was much easier to do it in HAL. You got bigger problems than estops if HAL goes down... The original estop dropped some mains circuits which is not practical/safe to route around the table

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

More
12 Dec 2019 01:04 #152509 by thefabricator03
My reasoning is the same, well I was merging from another system that I had wired the two table e-stops and the console e-stops separately.

Really though the worst thing is that if the software froze and the machine kept going it should really end up at the hard stops for the axis. Then in theory the drives would fault or you would burn the motors out. That is unless someone is on the machine( Work place safety NO NO) when it is operating.

But really how idiot proof do you need to make things.

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

More
12 Dec 2019 02:12 #152512 by tommylight

But really how idiot proof do you need to make things.

Someone on the cnczone.com forum had a signature saying:
Nothing is foolproof to a talented fool !
:)
The following user(s) said Thank You: rodw, thefabricator03

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

More
12 Dec 2019 11:06 #152524 by bevins
I am beginning to see how this could be useful.
My router has a external loop that I need to push a button and that loop I put in series with estop. Could use that for second estop latch. Hmmmmm ....

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

Time to create page: 0.076 seconds
Powered by Kunena Forum