Hello Guest it is March 29, 2024, 12:55:54 AM

Author Topic: How can I use subprograms in the subroutines folder?  (Read 24658 times)

0 Members and 1 Guest are viewing this topic.

Offline birdbrain

*
  •  41 41
  • Stupidity, beyond belief!
    • View Profile
How can I use subprograms in the subroutines folder?
« on: July 26, 2008, 04:23:30 AM »
In the Mach3 directory tree there is a folder called "subroutines".
If I store subroutine files in this folder how can I use the subprograms that they contain in my other programs???
This would be very useful to know as I have a number of standard subroutines that I use in various program files.

Offline jimpinder

*
  •  1,232 1,232
  • Wakefield, West Yorks, UK
    • View Profile
Re: How can I use subprograms in the subroutines folder?
« Reply #1 on: July 26, 2008, 03:05:37 PM »
M98 (nameofsubroutine.tap) - where the subroutine is in the folder.
Not me driving the engine - I'm better looking.
Re: How can I use subprograms in the subroutines folder?
« Reply #2 on: May 18, 2009, 10:09:12 AM »

Posts: 1


View Profile Email Personal Message (Online)
   
   
Re: Plugin to use with cnc4pc modio pcb
« Reply #2 on: May 18, 2009, 09:07:44 AM »
   Reply with quote Modify message Remove message
I am working with a Mach 3-controlled machine, trying to get subroutines to work. Am familiar with the usual Fanuc or
Haas formats, but cannot get a main program to pick up the subroutine. Sub is in the "subroutine" folder under Mach 3
folder, as specified. Have tried tried renaming the sub with or without an "O" in its name (It has an "O1000" in its 1st line)
and "%" by itself on first and last line. Any suggestions?

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: How can I use subprograms in the subroutines folder?
« Reply #3 on: May 18, 2009, 11:36:04 AM »
Page 10.8.7 of the UsingMachMill manual details how to use Subs, is that not working for you?
Hood
Re: How can I use subprograms in the subroutines folder?
« Reply #4 on: May 18, 2009, 04:53:14 PM »
No, the methods given in the manual ,10.8.7, were not working. I got in touch with "Chip," who had posted and actually is located in
Gainesville, FL, USA, where I am. He said to place the subs at the end o the main program, in the same file, after the M30 and separated by a % on a line by itself. That does work, and is fine with me, but don't know why the manual does not refer to this.
I am quite familiar with the Haas VF controls (work with one every day), and they do this, too, as one way of using subs. They refer to
it as a "local" subprogram and call it from the main program with M97. Very convenient, but wouldn't know Mach 3 does this without the forum contacts. Now, I couold really use something like a GOTO command as used in Fanuc controls. Thanks.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: How can I use subprograms in the subroutines folder?
« Reply #5 on: May 18, 2009, 05:49:44 PM »
Pg 5.5.4 shows that method if I am not misunderstanding, there are also a few other examples in the manual, however the M98(yourfilename.tap) should also work as well, certainly seems to here although I very rarely, if ever use subs.

What does the GoTo command you want actually do?
Hood

Offline Chip

*
  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: How can I use subprograms in the subroutines folder?
« Reply #6 on: May 18, 2009, 06:46:01 PM »
Hi, Brian

The reference "Hood" posted will work just fine, Give this a try.

; M98 import test 3.txt

G90
M98 (Gcode test.tap) ; File must be in C:\Mach3\Subroutines folder
M30
%

; This File must be in C:\Mach3\Subroutines folder.
; Gcode test.tap

G00 z-.5
G01X1
Y1
X0
Y0
Z0
M99
%

Chip

vmax549

*
Re: How can I use subprograms in the subroutines folder?
« Reply #7 on: May 18, 2009, 06:57:08 PM »
GUYS in certain versions the M89 call to the sub folder is broken. I just tried it again here(V.020) and it does not work.

AS is IF the m98 sees the m99 in the sub file, mach errors (and does NOT show the error) with looping with no sub in effect.

AND IF you take out the M99 it will run the sub BUT it will NOT return to the M98 call(;-)

Catch 22(;-)

HANS Mach DOES NOT have provisions for conditional OR redirection in Gcode.

(;-) TP
Re: How can I use subprograms in the subroutines folder?
« Reply #8 on: May 18, 2009, 09:39:03 PM »
I use IF, THEN, WHILE & GOTO by putting then in VB in a macro.

Offline Chip

*
  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: How can I use subprograms in the subroutines folder?
« Reply #9 on: May 19, 2009, 02:31:47 AM »
Hi, Terry

I checked ver's 3.042.020 to 3.042.027 and the only issue with the code above was I needed an extra M30 at the bottom of code to get code to rewind in Mach sometimes. 3.043.000 seemed just fine with one M30.

Chip
« Last Edit: May 19, 2009, 02:34:23 AM by Chip »