Hello Guest it is April 19, 2024, 09:29:55 PM

Author Topic: construct & call subroutines  (Read 3165 times)

0 Members and 1 Guest are viewing this topic.

construct & call subroutines
« on: December 05, 2009, 06:01:44 AM »
Hi.
     I'm still trying to find the correct way to construct and call a subroutine.    I was advised my the moderator to scroll through the forum to find the answers.     All I've managed to come up with is:   the routine is designated with the prefix letter P followed by 0001 or what ever number is used.  What symbol is used to close the routine, or is it just left open?    The routine appears to be called with M98 and after the cycle has run for the desired amount of times, is closed with M99    The routine is placed at the end of the command programme, rather than at the start (which I was always used to back in the day) Am I correct thus far?
Regards

Offline Sam

*
  • *
  •  987 987
    • View Profile
    • hillbillyhilton.com
Re: construct & call subroutines
« Reply #1 on: December 05, 2009, 10:53:58 AM »
Here's a quick example.

G90 G01 X0.0 Y0.0 F1000(absolute, line move, feedrate)
M98 P1 (M98=call sub, P=sub# to call)
M98 P2
M98 P3
M98 P4
M30 (program rewind)
O1 (sub#)
X0.0 Y0.0
X1.0 Y1.0
X0.0 Y0.0
M99 (sub end)
O2
X0.0 Y0.0
X-1.0 Y-1.0
X0.0 Y0.0
M99
O3
X0.0 Y0.0
X1.0 Y1.0
X0.0 Y0.0
M99
O4
X0.0 Y0.0
X-1.0 Y-1.0
X0.0 Y0.0
M99
%

The manual goes into pretty good detail about subs, and with a bit of practice code, the methods become clear. Here is a link for the manual
http://www.machsupport.com/docs/Mach3Mill_1.84.pdf
I would keep it handy, it is well written, and covers tons of stuff.

Sections you might find relating to subs are...
10.5.2
10.8.7
10.8.8
I'm sure there's more, but that's just from a quick scan.
Enjoy  :)
"CONFIDENCE: it's the feeling you experience before you fully understand the situation."
Re: construct & call subroutines
« Reply #2 on: December 06, 2009, 06:03:02 AM »
Hi. Sam.
             Thanks for that, seems straight foreward.     It didn't help that the manual supplied with the my machine stopped at 9.11 !
I've now printed off all the missing pages and yes they look very helpful.
Regards.
                    Mick