Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

trying to use a subprgram call


Rick46
 Share

Recommended Posts

Im trying to run multiple programs on my machine using a subprogram that was shipped with it in the memory.

 

to call the program out you specify a M198 P1000 for example..

 

well I want to run M198 P1000

M198 P1001 and so on that are stored in my data server.. well it keeps giving me a error if I set it up like that and stops on the % command at end of subprogram that for some reason I cannot delete.. I can delete any other part of program except that line. here is the program .. Hell I cant even copy this program to my pc hard drive I had to type it in a editor manually so I could copy and paste it in here...lol.. wierd stuff... thanks for any help guys...

 

 

(MASTER PROGRAM)

G00 G40 G49 G80;

G91 G28 Z0. ;

G91 G28 X0. Y0. ;

(PROGRAM TO CALL SUBPROGRAM)

M198 P1000

G91 G28 Z0. ;

G91 G28 X0. Y0. ;

M30 ;

%

Link to comment
Share on other sites

You aren't showing the subprogram, so I am guessing it can't find the sub, and therefore goes to M30 and "%", which is end of program.

 

To get rid of the % I think you would have to delete the prg.

 

Does the sub have M99 at the end?

Link to comment
Share on other sites

By the looks of it you are running a Fanuc controller that has a data server,

so M98 calls the sub from the control memory

M198 calls the program from the data server

M298 calls the program from the Host

 

Does the sub program have M99 at the end?

Does the sub program have a file extension? it is not allowed to

Does the sub program have a % at the start?

Link to comment
Share on other sites

well if I was to run say one program called P1000 it would run ok but if I want to run any more then it ends with a error having something to do with the % sign.. as far as the sub program p1000 it has no M98 at the end of it.. I removed the M30 code and that was it line before it is a g91 g28 z0 y0 .. am I needing to add a m99 in place of the M30 possibly to get this to work ?? thanks...

 

 

p.s. yes its a fanuc controller too..

Link to comment
Share on other sites

Ok this is how we do Fanuc and sub calls.

 

 

%

O2000(MAIN PROGRAM)

M98P2001

M98P2002

M98P2003

M30

 

O2001(SUB 1)

(MOVE MACHINE .5 IN POSTIVE DIRECTION)

G00 G91 X.5

M99

 

O2002(SUB 2)

(MOVE MACHINE .5 IN NEGATIVE DIRECTION)

G00 G91 X-.5

M99

 

O2003(SUB 3)

(MOVE MACHINE X 10. IN POSTIVE DIRECTION)

G00 G91 X10.

(MOVE MACHINE X 10. IN NEGATIVE DIRECTION)

G00 G91 X-10.

(MOVE MACHINE Y 10. IN POSTIVE DIRECTION)

G00 G91 Y10.

(MOVE MACHINE Y 10. IN NEGATIVE DIRECTION)

G00 G91 Y-10.

(THIS CONCLUDES OUR DIMESTRATION)

G50 Z0

G50 X0 Y0

M99

%

 

 

Now you look at this program and can see it call 3 sub programs now if we wanted ot get fancy we can add and L like so and get them to repeat.

 

 

%

O2000(MAIN PROGRAM)

M98P2001L40

M98P2002L40

M98P2003L2

M30

 

So if we did this we would make the X axis move 20 inches in a postive direction. Then it would move 20 inches in a negative direction. Then it would move 10 inches in X and Y go back 10 inches in X and Y send it self home and do it again then it would be done. The reason I show you this is that you could modify this program just a little bit and get a warm-up program for your machine like so.

 

 

%

O2000(WARM UP MAIN)

S500M3

M98P2001L20

S5000M3

M98P2001L20

S10000M3

M98P2001L20

M30

 

O2001(WARM UP SUB)

G01 G91 X10.Y10.Z-10.F200.

G01 G91 X-10.Y-10.

G01 G91 Y10.Z10.

G01 G91 X10.Y-10.

G01 G91 X-10. Y10. Z-10.

G50 Z0

G50 X0 Y0

M99

%

 

 

Now this assuems you have a home X axis travel of 10 a Y axis travel of 10 and a Z axis travel of 10. If you have things different you adjust accorindly. Now if you would like ot see this as a macro be glad to show that as well.

 

HTH

Link to comment
Share on other sites

well I tried the m99 at end of program and it worked except one problem It dosent change tools.. I wants to use the existing to in the spindle to run on the next program being called out by the main program...I also had to take out the safe start at the begining of the second program to be ran cause it caused a end of record error to come up.. so Im still working with it..

Link to comment
Share on other sites

I ended up using this as a main program and it worked... I think all the other stuff in the original main program was conflicting with the g codes and m codes at the start of my sub programs..

 

 

O8000

(MAIN PROGRAM)

M198P1000

M198P1001

M198P1002

M30

 

this is working and all I need to do is add M99 at end of each sub program..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...