toggle2nist.is-on - what exactly does it do?

More
27 Apr 2013 14:13 #33269 by Skippy1
Hi all,

I've been fiddling around with HAL to see how it works, and pinched someone else's code and dropped it in custom.hal to see how it works, (see below). I had a minor hiccup, and had to comment out the line "net machine-is-on halui.machine.is-on" in the main hal file, but otherwise it works a treat

#power on/off
net power-btn and2.0.in0 <= (my input)
net power-ok and2.0.in1 not.3.out
net power-not not.0.in <= halui.estop.is-activated
net power-request toggle.0.in <= and2.0.out
net power-toggle toggle2nist.0.in <= toggle.0.out
net power-is-on toggle2nist.0.is-on <= halui.machine.is-on
net power-on halui.machine.on <= toggle2nist.0.on
net power-off halui.machine.off <= toggle2nist.0.off

I sketched out the logic on a bit of paper, and I'm starting to understand some of the hal commands and signals etc. However, I don't quite understand the toggle2nist.is-on bit. It appears that it needs an input or signal - I did use another button input to trigger it for fun. But when used with the input 'halui.machine.is-on', is it acting like some sort of latch, or a sort of logic safety thing?

Cheers,

Steve

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

More
27 Apr 2013 20:15 #33278 by BigJohnT
The code for toggle2nist is here

git.linuxcnc.org/gitweb?p=linuxcnc.git;a...fs/heads/v2.5_branch

There are a couple of examples of toggle2nist on the forum.

Basically when toggle2nist is toggled if it is on turn it off, if it is off turn it on.

John

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

More
28 Apr 2013 06:47 #33307 by Skippy1
Ta John,

So from that link can I safely assume that toggle2nist needs to 'know' the state of the halui device it is controlling via the is-on input if it is to toggle it on/off, and so there is always a requirement for the halui device being toggled to have a bit-out status pin connected to toggle2nist to make it work properly?

cheers,

Steve

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

More
29 Apr 2013 06:28 #33355 by andypugh

I don't quite understand the toggle2nist.is-on bit.


A bit of background might help.

LinuxCNC used to be called EMC2, and EMC was developed by NIST (a US government institution).
Part of the work they did was to decide how to set the state of software "things" that might be controllable from multiple sources.
They appear to have settled on having two inputs, one that is toggled to turn things on, and one that is toggled to turn them off. If the "on" input goes high then it turns on. If the "off" input goes from low to high, then it turns off. (it is edge triggered). I think that toggling "off" will turn it off even if "on" is still high. This is "NIST logic", designed for things to be operated by two momentary pushbuttons (or software signals).

Wiring this kind of input up to a single momentary button is possible, but annoying, needing many HAL components. The Toggle2NIST component does the conversion in a single module.

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

More
29 Apr 2013 20:20 #33391 by BigJohnT

Ta John,

So from that link can I safely assume that toggle2nist needs to 'know' the state of the halui device it is controlling via the is-on input if it is to toggle it on/off, and so there is always a requirement for the halui device being toggled to have a bit-out status pin connected to toggle2nist to make it work properly?

cheers,

Steve


Yep

John

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

More
30 Apr 2013 16:55 #33430 by Skippy1
Thanks guys,

Now staring to make a strange sort of sense. Certainly scope for more fun with this stuff!

Cheers,

Steve

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

Time to create page: 0.141 seconds
Powered by Kunena Forum