Macros - tutorials and instructions

  • CADdy
  • CADdy's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
14 Apr 2024 14:59 #298229 by CADdy
Hi all,
I am looking for tutorials and instructions that deal with and explain the topic of macros under LinuxCNC. Are there any good links? I would like to familiarize myself with the topic of "macros" and find my way around.

One of my questions would be, for example: Is it possible to query a button in a running macro to see if it is pressed? The macro should only continue to run after the button has been detected as pressed.

Thanks a lot
Peter
 

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

More
15 Apr 2024 18:11 #298302 by cmorley
Replied by cmorley on topic Macros - tutorials and instructions
I am assuming 'macros' means a GUI button that runs some gcode command.

There is no builtin/direct way for the motion controller to know anything about the GUI.
There are ways to work around this to some degree.
You can read HAL pins from gcode, read params from gcode or 'drip' gcode from the GUI.

A simple macro will just call an MDI command when the button is pushed.
A more involved one might have the GUI call some commands then wait for then to complete, check for errors (or check for a button press) then call another.
This is all GUI dependent.

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

  • CADdy
  • CADdy's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
16 Apr 2024 10:44 #298353 by CADdy
Replied by CADdy on topic Macros - tutorials and instructions
Hi Chris,

I am familiar with calling an MDI command via the GUI. I am particularly interested in the second method you described for creating more complicated macros. I don't have a current problem that I want to solve. I am interested in the topic in general. Would you have any links to descriptions or manuals?

Peter

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

More
16 Apr 2024 11:24 #298354 by meister
Replied by meister on topic Macros - tutorials and instructions
you can use something like this to read digital IO's:

o<clamp_toggle> sub

o110 if [#<_spindle_on> EQ 0]
o111 if [#<_hal[motion-digital-out-00]> EQ 1]
M65 P0
o111 else
M64 P0
o111 endif
o110 endif

o<clamp_toggle> endsub

M2
The following user(s) said Thank You: CADdy

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

  • CADdy
  • CADdy's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
16 Apr 2024 20:19 #298400 by CADdy
Replied by CADdy on topic Macros - tutorials and instructions
I've found a similar M-command to query a digital input: M66
linuxcnc.org/docs/2.5/html/gcode/m-code....ec:M66-Input-Control

The manual is a good starting point.

Peter

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

Time to create page: 0.052 seconds
Powered by Kunena Forum