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:

M98 "jump" to line number!!


CNCGUY
 Share

Recommended Posts

Is it possible to "jump" to a specific line when going to a sub program?

 

O1000 (MAIN)

N1 M98 P9000 (GOTO LINE 100)

M30

N2 M98 P9000 (GOTO LINE 200)

M30

 

O9000 (SUB)

N100

(MACHINE CODE #1)

M99

 

N200

(MACHINE CODE #2)

M99

 

This is a HAAS machine. Any suggestions if this wont work?

Link to comment
Share on other sites

You could try this simple custom macro.

B is the address which is variable #2.

 

Dont know the HASS machine/control but Fanuc control there is no N on the GOTO line.

 

 

O1000 (MAIN)

N1 G65 P9000 B100.(GOTO LINE 100)

M30

N2 G65 P9000 B200.(GOTO LINE 200)

M30

 

O9000 (SUB)

(could put some checks in here)

GOTO#2

M30

 

 

N100

(MACHINE CODE #1)

M99

 

N200

(MACHINE CODE #2)

M99

Link to comment
Share on other sites

From the HAAS Manual

 

quote:

M97, This code is used to call a sub-routine referenced by an N number within the program. The Pnnnn code is required and MUST match the a line number within the same program. This is useful for simple subroutines within a program and does not require the complication of a separate program. The subroutine must still be ended with an M99. An L count on the M97 block will repeat the subroutine call that number of times

hth

Link to comment
Share on other sites

On a Haas I like to organize the local subs into the program so that the code is just below the local sub call, this makes it a lot easier for the set up guys to see what the tool will be doing. Here is an example.

 

N1

(preparatory lines here)

 

M97P100(Call local sub)

M99P1000(This will serve as a skip command)

 

N100

Toolpath here

M99(end local sub)

N1000

G0G28G91Z0.

M1

 

N2(NEXT TOOL)

 

 

This functions exactly the same as the regular way of stacking the local subs at the end of the program but is a lot easier to read.

Link to comment
Share on other sites

OK, here is what I ended up doing. Comment/Critique

 

quote:

%

O01000 (MAIN PROGRAM)

 

(NEXT SCHEDULED PALLET)

#100= 1

M98 P9000

M30

 

(CURRENT PALLET)

#100= 2

M98 P9000

M30

%

quote:

%

O09000 (PALLET CODE)

 

N10

IF [ #100 EQ 0 ] GOTO9999

IF [ #100 EQ 1 ] GOTO100

IF [ #100 EQ 2 ] GOTO200

M99 P10

 

N100 (NEXT SCHEDULED PALLET)

G103 P2

#100= 0

M46 Q2 P101 (PALLET 1 CLAMP CHECK - PRE INDEX)

M46 Q1 P102 (PALLET 2 CLAMP CHECK - PRE INDEX)

M99 P100

 

N200 (CURRENT PALLET)

G103 P2

#100= 0

M46 Q1 P201 (PALLET 1 CLAMP CHECK - POST INDEX)

M46 Q2 P202 (PALLET 2 CLAMP CHECK - POST INDEX)

M99 P200

 

N101

/ IF [ #1118 EQ 1 ] GOTO111 (0 FOR TEST)

/ IF [ #1118 EQ 0 ] GOTO10110

/ GOTO101

N111

/ IF [ #1038 EQ 0 ] GOTO301

/ IF [ #1038 EQ 1 ] GOTO10010

/ GOTO10101

GOTO301

 

N102

/ IF [ #1118 EQ 1 ] GOTO112 (0 FOR TEST)

/ IF [ #1118 EQ 0 ] GOTO10110

/ GOTO102

N112

/ IF [ #1039 EQ 0 ] GOTO302

/ IF [ #1039 EQ 1 ] GOTO10010

/ GOTO10102

GOTO302

 

N201

/ IF [ #1038 EQ 0 ] GOTO1001

/ IF [ #1038 EQ 1 ] GOTO10000

/ GOTO10111

GOTO302

 

N202

/ IF [ #1039 EQ 0 ] GOTO1002

/ IF [ #1039 EQ 1 ] GOTO10000

/ GOTO10112

GOTO301

 

N301

/ M50 (ADD P1 FOR TEST)

/ GOTO201

M50 P1

M99

M30

 

N302

/ M50 (ADD P2 FOR TEST)

/ GOTO202

M50 P2

M99

M30

 

N1001

M46 Q2 P10100

G103

M98 P1001

M99 P100

 

N1002

M46 Q1 P10100

G103

M98 P1002

M99 P100

 

N9999

M00

(START WITH MAIN PROGRAM !!!!)

M99 P200

 

N10000

M00

(CURRENT PALLET UN-CLAMPED !!!!)

M99 P200

 

N10010

M00

(SCHEDULED PALLET UN-CLAMPED !!!!)

M99 P100

 

N10100

M00

(WRONG PALLET LOADED !!!!)

M99 P200

 

N10110

M00

(PALLET BUTTON NOT READY !!!!)

M99 P100

 

N10101

M00

(PALLET 1 PRE INDEX CLAMP CHECK FAILED !!!!)

M99 P10101

 

N10102

M00

(PALLET 2 PRE INDEX CLAMP CHECK FAILED !!!!)

M99 P10102

 

N10111

M00

(PALLET 1 POST INDEX CLAMP CHECK FAILED !!!!)

M99 P10111

 

N10112

M00

(PALLET 2 POST INDEX CLAMP CHECK FAILED !!!!)

M99 P10112

%

quote:

%

O01001 (MACHINE CODE PALLET 1)

/

/

/

M99

%

quote:

%

O01002 (MACHINE CODE PALLET 2)

/

/

/

M99

%

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...