Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: widpyro on November 27, 2011, 09:00:15 PM

Title: More questions on calling sub-routines
Post by: widpyro on November 27, 2011, 09:00:15 PM
Can someone post sample code for calling a subroutine?  I would also want to quantify the number of times it repeats.  Is it just a matter of typing m98 and then following it with my subroutine, and then adding L ##  for the number of times it repeats, and then ending it with M99?

Thanks,

-jim
Title: Re: More questions on calling sub-routines
Post by: BR549 on November 27, 2011, 09:52:27 PM
http://www.machsupport.com/forum/index.php/topic,20119.0.html



(;-) TP
Title: Re: More questions on calling sub-routines
Post by: widpyro on December 02, 2011, 08:53:29 PM
I cannot get a subroutine to run. I want to have the subroutine within the code. Please write me a complete example of a code with a subroutine. I need to know the order that everything should be in the code.

thanks,
-jim
Title: Re: More questions on calling sub-routines
Post by: BR549 on December 02, 2011, 09:25:10 PM
Here you go

G80 G90 G55 G20
#1=3
F1
G0 X0Y0Z0
M98 P1 L5
M30

o01
G01 X#1 F50
Y#1
X0
Y0
#1=[#1+2]
M99
%


(;-) TP
Title: Re: More questions on calling sub-routines
Post by: widpyro on December 02, 2011, 10:07:49 PM
Thankyou!  That works for me.
-jim
Title: Re: More questions on calling sub-routines
Post by: Fred_evans on March 10, 2012, 01:49:16 AM

In general programming ( I use dbase 4 ver 2) it is possible to create a loop
which will stop when a variable reaches a certaim value.
It looks like this

x-1

do while x < 10
   (do something)
   x = x+1
enddo

(it will go through the loop until x= 10 and then jump out to the line
following the "enddo"
 
Is something like this available in Mach3 gcode??

where can i find something about it

many thanks

fred evans from south africa
Title: Re: More questions on calling sub-routines
Post by: BR549 on March 10, 2012, 12:31:37 PM
NOT with MACH3 it does NOT do conditional Gcode.

What you would need to do with MACH3 is do the DEPTH value/ step depth then round UP to the next whole number. NOW this does mean you will have to start eh process HIGH to account for the roundup.

IE:  Depth of  10.5mm / 1mm =  10.5 steps RU to 11.  NOW figure 11x1mm = 11mm  ,  11mm-10.5 = .5   So you would start the process .5mm high to get to the proper depth with 11 steps.

Then just apply that to the Gcode  M98 P?? L11

Hope that helps, (;-) TP



(;-) TP