Hello Guest it is March 29, 2024, 03:12:24 AM

Author Topic: More questions on calling sub-routines  (Read 3378 times)

0 Members and 1 Guest are viewing this topic.

More questions on calling sub-routines
« 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

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: More questions on calling sub-routines
« Reply #2 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

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: More questions on calling sub-routines
« Reply #3 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
Re: More questions on calling sub-routines
« Reply #4 on: December 02, 2011, 10:07:49 PM »
Thankyou!  That works for me.
-jim
Re: More questions on calling sub-routines
« Reply #5 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
think of the trees-- use both sides of the computer paper

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: More questions on calling sub-routines
« Reply #6 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
« Last Edit: March 10, 2012, 12:39:53 PM by BR549 »