Hello Guest it is April 20, 2024, 10:38:21 AM

Author Topic: subroutines?  (Read 4080 times)

0 Members and 1 Guest are viewing this topic.

subroutines?
« on: June 13, 2017, 11:22:52 AM »
anyone know where the subroutine files go?
like what folder? i found one in:
C:\Mach4Hobby\Subroutines\O0001

but when I call the command from the MDI it says it cant find it.

is this only supported in mach4 industrial?

i can do a subRoutine if i build it into the same gcode file. But not by saving it in the subroutines folder like  the manual says.

thanks.
Re: subroutines?
« Reply #1 on: June 13, 2017, 02:48:52 PM »
Hi,
I thought a subroutine O********* was actually part of the running Gcode program. If Mach had to go 'find' it wouldn't
you have to provide a path and filename?

Those Gcode jobs I have that do use subroutines  are included/part of the Gcode file and they run fine.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: subroutines?
« Reply #2 on: June 13, 2017, 03:05:07 PM »
clcik on this link and look at page 61.
it says there :

"
There are limitations to this method; mainly the subprogram must be pasted into every program that it
is to be called from. Mach also allows a subprogram to be called from an external file. This way,
multiple programs can call the same subprogram, without having the program in the main file. If a
change needs to be made to the subprogram it only needs to be done in one file, not every file in which
the sub is called. If the control does not find the program number in the current file it will then search
for it in the Mach4\Subroutines directory. This time it will be searching filenames. The files in this
directory should be named with the program number as follows:
"
Re: subroutines?
« Reply #3 on: June 13, 2017, 03:05:42 PM »

Offline smurph

*
  • *
  •  1,546 1,546
  • "That there... that's an RV."
    • View Profile
Re: subroutines?
« Reply #4 on: June 13, 2017, 06:05:07 PM »
The files in the subroutine folder can contain only one subroutine each.  And the subroutine must have a a proper O line at the top that matches the base file name.  There is no limit to the number of subroutines that you can put in this folder as long as they are unique subroutine numbers. 

Steve
Re: subroutines?
« Reply #5 on: June 13, 2017, 07:11:43 PM »
yes so I have 1 file called O0001
it only has one subroutine.

but when i call this in the MDI:
M98 P0001

it tells me it cant find the file.

my file is saved here.
C:\Mach4Hobby\Subroutines\O0001

without the .txt extension.

but mach tells me it cant find the file.

the contents of O0001 are very simple:

%
O0001
(test)
G91 X1
M99
%

I wonder what could be going wrong.

Offline smurph

*
  • *
  •  1,546 1,546
  • "That there... that's an RV."
    • View Profile
Re: subroutines?
« Reply #6 on: June 13, 2017, 07:43:50 PM »
Because the P word of the M98 call converts 0001 to the numeric value of 1.  So don't use leading zeros in the sub name (and file name) and it will all be good.  e.g. It will find O1 in a filed called O1 in the Subroutines directory.

Steve
Re: subroutines?
« Reply #7 on: June 13, 2017, 07:53:36 PM »
omg..
that just makes sense. lmao
I will try that tonight. Thank you so much!
Re: subroutines?
« Reply #8 on: July 15, 2017, 09:41:14 AM »
Hi,
i work with the subroutines since mach3 on the begining on mach4 too but since i have installed the new develop version for test it´s gone!

i allways get the error : File "C:\Mach4Hobby\Subroutines\Sub program test\subtest.tap", Line 28: Feature not licensed !!!

Is it now an feature in the industrial version so we have to pay extra?  :o :(

I have tryed out: uninstall mach4 and install mach4 new ( the official version ion the downloadpage) . I figured out, on the license that the PC ID has changed. But i haven´t changed the computer or  anything esle on my machine!

I can do what i want but the funktionality of M98 M99 is gone!

What´s happend? any ideas?
thanks for your help!
Re: subroutines?
« Reply #9 on: July 15, 2017, 09:50:09 AM »
are you using arguments in your subroutines?
you can only run subroutines without arguments in mach4 Hobby.