- Posts: 310
- Thank you received: 0
Preventing gcode execution under certain conditions
For example, I don't want the spindle motor to be able to start if the draw bar is in the open position or there's insufficient air pressure (both of which are inputs to my Mesa card).
Another example: I don't want to allow a program or the manual button to unlock the power draw bar.
I have a lot of rules that I'm implementing in classic ladder. I know I can assert joint alarms, but are there other alarms I can assert?
Is there a signal for "program is running?"
Please Log in to join the conversation.
blocking by halui.spindle.stop bit in
a rising edge on this pin stops the spindle
so your in puts also sets the halui.spindle.stop bit
the power draw bar. is for safty always at the user execute
interfearing that will cause you in some trouble
Please Log in to join the conversation.
- tommylight
-
- Away
- Administrator
-
- Posts: 22012
- Thank you received: 4
Am on the phone , so have a look at "and" "or" "xor" etc so you get a better idea on how to implement those imterlocks.
Please Log in to join the conversation.
JetForMe wrote: Is there a signal for "program is running?"
Yes. halui.program.is-running
linuxcnc.org/docs/2.7/html/man/man1/halui.1.html
Please Log in to join the conversation.
JetForMe wrote: For example, I don't want the spindle motor to be able to start if the draw bar is in the open position or there's insufficient air pressure (both of which are inputs to my Mesa card).
This could be easilly done in hal using components without the overhead of classic ladder with two and2 components.
Simply connect your two mesa pins to the first and2 inputs. So the output of the and2 will only be true when both conditions are met.
Then connect the output of this and the motion.M.on to the inputs of another and2. Then connect the output of this second component to the relay or whatever turns your spindle relay on. So now, the spindle cannot start until everything is safe.
If you go to the main HTML documentation page for your version, down the bottom, there is a button that says "Expand Man Pages". Make sure its selected and the docs for a whole smorgasboard of hal components will be displayed. These are the logic components others have referred to.
If you can't find ones that do what you want, then its easy to use halcompile to create your own. This would actually be a good simple example to write as a starter. You could make an and3 component that had 3 inputs and one output that went true when all inputs were true. You could resolve this to a single line of c code.
You can find the source code for the existing default components here
github.com/LinuxCNC/linuxcnc/tree/master/src/hal/components
The and2 souce is here:
github.com/LinuxCNC/linuxcnc/blob/master...components/and2.comp
You can see how trivial the code would be to add an extra in2 pin and change line 18 to && the third pin. Then its just a matter of using halcompile to install it
I know you can Code in C from some of your earlier comments, but this is LinuxCNC's best kept secret. The ability to extend the system with your own custom components which become no different to any of the system components once installed.
I've never bothered to learn how to use classic ladder. I think I'd use a custom component if ever I really needed to.
Please Log in to join the conversation.
rodw wrote: If you can't find ones that do what you want, then its easy to use halcompile to create your own. This would actually be a good simple example to write as a starter. You could make an and3 component that had 3 inputs and one output that went true when all inputs were true.
There is no need to write an "and3" component as the "logic" component already offers And for as many inputs as you configure it with.
I use LUT5 for this sort of thing, though, as it allows you to configure 1 output for every possible state of 5 inputs.
It becomes especially useful when one of the inputs is connected to the output as then it can be a very configurable sort of latch.
But, here is the component I use to interlock the tool release on my milling machine. It both prevents the tool from being released if the spindle is moving, and prevents the spindle from starting if the tool is released.
spindle_interlock.comp
Please Log in to join the conversation.
and the plasma will just firer if no airpresure nothing else nothing to material or plasma itself
it just gives a silent ping
and the arc-ok will stop the motion
most plasmas got a safty cycle so it will shut down system at 2-4sec no flame generated
Please Log in to join the conversation.
pl7i92 wrote: as you see yu can have it multiple way
and the plasma will just firer if no airpresure nothing else nothing to material or plasma itself
it just gives a silent ping
and the arc-ok will stop the motion
most plasmas got a safty cycle so it will shut down system at 2-4sec no flame generated
Except he's building a router. Plasmas's don't have drawbars
Please Log in to join the conversation.
Please Log in to join the conversation.
motion.feed-inhibit
motion.spindle-inhibit
might be useful to you too.
Chris M
Please Log in to join the conversation.
