Hello Guest it is April 18, 2024, 05:22:52 AM

Author Topic: speed of execution of macro  (Read 7413 times)

0 Members and 1 Guest are viewing this topic.

Re: speed of execution of macro
« Reply #10 on: December 24, 2010, 04:55:00 PM »
Erm...
not heard of gcode sub program. Can you direct me to any documentation on that? The documentation doesn't have a search facility. Thanks

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: speed of execution of macro
« Reply #11 on: December 24, 2010, 05:48:00 PM »
I am not sure there is a good example or explaination in the manual.

But basically it is a process that allows you to call a subset of Gcode from inside a running Gcode program from somewhere else in the program OR from an outside source stored away as a reference.

IF you could post your Gcode needed in the order it is needed maybe someone here can help you sort out what you may need. There are people here that are very good at that sort of thing


(;-) TP
Re: speed of execution of macro
« Reply #12 on: December 24, 2010, 07:43:40 PM »
okay, thanks. And merry christmas to you! I'm following another thread on the same subject, I'll cut n paste the code suggested by someone there, for anyone following this thread to see:-

Sub run101()
While IsMoving()
  Sleep 10
Wend

   Code “G1 A2.5”
   Code “G1 A0”
   Code “G1 A1.7”
end sub

G01 X2 Y0 run101
G01 X9 run101
G01 X14 run101
G01 X15 Y5 run101
G01 X0  Y4 run101
G01 X1 run101

Thanks 5ms for that.

Does this look right? Syntax wise?

Thanks,

Rich

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: speed of execution of macro
« Reply #13 on: December 24, 2010, 08:11:22 PM »
   I am not sure what you have going with teh code you posted But I get the general idea of what you are trying to do. You application is really simple and really you won't save time either way. The straight Gcode would be the best approach .

Straight Gcode Example:

F20
G01 X2 Y0
 A2.5
 A0
 A1.7
G01 X9
 A2.5
 A0
 A1.7
G01 X14
A2.5
A0
A1.7
G01 X15 Y5
A2.5
A0
A1.7
G01 X0  Y4
A2.5
A0
A1.7
G01 X1
A2.5
A0
A1.7
M30
%


SUB program approach:  THe M98 calls the sub by the o word and name o100 the L paramter tells how many times to run the sub. At the end of the sub the M99 returns to the call line then advances to the next line. At teh end of the program the M30 ends the program
 
F20
G01 X2 Y0   M98 P100 L1
G01 X9        M98 P100 L1
G01 X14      M98 P100 L1
G01 X15 Y5 M98 P100 L1
G01 X0  Y4  M98 P100 L1
G01 X1        M98 P100 L1
M30

o100
   G1 A2.5
   G1 A0
   G1 A1.7
M99
%


Hope that helps, (;-) TP
« Last Edit: December 24, 2010, 08:15:28 PM by BR549 »
Re: speed of execution of macro
« Reply #14 on: December 25, 2010, 07:03:38 AM »
Thanks, yes, that helps a bit. Part of the reasoning of the subroutine was because it makes the whole file size smaller than putting 2 extra lines into the gcode all the time. My maximum gcode file size ( I forget what it was) caused Mach to crash. I'll try the subroutine when the festivities are over, and post the results...

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: speed of execution of macro
« Reply #15 on: December 25, 2010, 10:49:16 AM »
You can also do it one more way to save a little more space. It is the remote call method. You store your sub in the sub directory then call it with the M98.

Save the sub as a program file:

(Sub 100.tap)
o100
   G1 A2.5
   G1 A0
   G1 A1.7
M99
%

Then you  Gcode file would look like this:

F20
G01 X2 Y0   M98 C:\mach3\sub\ProgramName.tap
G01 X9        M98 C:\mach3\sub\ProgramName.tap
G01 X14      M98 C:\mach3\sub\ProgramName.tap
G01 X15 Y5 M98 C:\mach3\sub\ProgramName.tap
G01 X0  Y4  M98 C:\mach3\sub\ProgramName.tap
G01 X1        M98 C:\mach3\sub\ProgramName.tap
M30


(;-) TP