Hello Guest it is March 29, 2024, 04:40:40 AM

Author Topic: Subroutine problem  (Read 6128 times)

0 Members and 1 Guest are viewing this topic.

Subroutine problem
« on: February 11, 2007, 10:43:05 PM »
Ok, so I feel like a dummy here but.......I seem to be unable to get a subroutine program to run. it just runs through the main program and thats it.
What am I missing?

Main program

1004
M98 P9999 L2
M30


Then the sub program is

O9999
G20 G90
G0 X1.5
G0 Z-.500
G1 Z-.650 F100
G0 Z0
X1.0
M99

Both progs are saved as the same name as the first line in ea.
So what am I missing? I am using Mach2 Version 6.11i   (Licensed )

Scott

Hood

*
Re: Subroutine problem
« Reply #1 on: February 12, 2007, 02:34:45 AM »
Make sure you have pressed return after the M99, what I do is put in the % as it shows you that you have pressed the return after the last line.
Hood

Offline Chip

*
  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: Subroutine problem
« Reply #2 on: February 12, 2007, 12:00:29 PM »
Hi, Scott

"Both progs are saved as the same name as the first line in ea." Should be saved as one.

Try this.

;Main program

;1004
M98 P9999 L2
M30

;Then the sub program is

O9999
G20 G90
G0 X1.5
G0 Z-.500
G1 Z-.650 F100
G0 Z0
X1.0
M99
%

Hope this Helps, Chip
Re: Subroutine problem
« Reply #3 on: February 12, 2007, 07:51:04 PM »
Do you mean the sub should be included in the main prog ? So you only save one prog ?

I thought as long as I had the main prog and the sub both saved in the same file folder, it would find it.

OR
Am I just in a brain fade ?

And I understand the % at the end of the file but why the ; at the beginning of the file ? or is it just a diff way to quote "  "   ?

Re: Subroutine problem
« Reply #4 on: February 12, 2007, 08:05:37 PM »
There isnt anything foolish in Mach 2 like someplace to check "on" to make it allowable to run subroutine progs is there?

Tried the above and it still will not go to the sub prog...........

Hmmmmmm
Re: Subroutine problem
« Reply #5 on: February 12, 2007, 09:05:39 PM »
Got it

Ok, you are correct or I finally understand. I do have to include the sub prog "within" the main prog. Doing that, it works.

I am not used to including it within the main. Does not make sub progs as usefull as I used to be familiar with.
I learned on Fanuc back in the 80's and I could call up sub progs such as single point threading on cnc swiss screw machines and run em
on any part or family of parts.

See, I want to make cribbage board patterns so I figured what a great way of using sub progs to repeat the 10 hole block.

Is there any way of calling up an external prog, looping it a bunch of times and returning back to the main prog ?

Offline Chip

*
  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: Subroutine problem
« Reply #6 on: February 13, 2007, 01:10:59 AM »
Hi, Scott

Been tied-up today, If you Ref. the Mach3 manual sec 10.8.7, it states that if you use M98 (filename.txt) it will import and run that file I haven't been able to get it to work though. so your not off on this at all.

Read up on this see if you can get it to work.

Thanks, Chip
Re: Subroutine problem
« Reply #7 on: February 13, 2007, 07:24:23 PM »
Don't forget, I am using Mach 2 allthough I think it should work in this version too.

Thank you for your efforts. I really do appreciate it.

Offline Chip

*
  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: Subroutine problem
« Reply #8 on: February 13, 2007, 08:36:09 PM »
Hi, Scott

Didn't see the ref. in Mach2 manual, just thought you mite want to look at it.

Thanks Chip
Re: Subroutine problem
« Reply #9 on: February 13, 2007, 09:42:49 PM »
Ya, well it doesn't say I can't use a file not embedded in the main file..........and it doesn't say I must use a file embedded within the main file either.