Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 09:28:07 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  speed of execution of macro
Pages: « 1 2   Go Down
Print
Author Topic: speed of execution of macro  (Read 845 times)
0 Members and 3 Guests are viewing this topic.
moorea21
Active Member

Offline Offline

Posts: 88


View Profile
« 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
Logged
BR549
Active Member

Offline Offline

Posts: 2,555


View Profile
« 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
Logged
moorea21
Active Member

Offline Offline

Posts: 88


View Profile
« 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
Logged
BR549
Active Member

Offline Offline

Posts: 2,555


View Profile
« 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 » Logged
moorea21
Active Member

Offline Offline

Posts: 88


View Profile
« 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...
Logged
BR549
Active Member

Offline Offline

Posts: 2,555


View Profile
« 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
Logged
Pages: « 1 2   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!