M98 P/Q?


Results 1 to 19 of 19

Thread: M98 P/Q?

  1. #1
    Registered
    Join Date
    Apr 2011
    Location
    bunga country
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default M98 P/Q?

    Hi all,
    I have a 0i-MC where I can use the Q argument to address a line number in the current program. No need to make an external program for subprogram. Example:

    O1;
    M98 Q1000;
    M30;
    ;
    N1000;
    (...)
    M99;

    Actually this isn't explained in the FANUC manual, only the P argument is. I don't know how this was set up. But now I have a 18i where this "trick" doesn't work. Anyone knows something about this subject? I didn't find anything on the net. Some parameter to change?
    Also it would be AWESOME to be able to do it with G65/G66 as well (but this does NOT work even on my 0i-MC)

    Please don't tell me to use M99Nxx or some other spaghetti code workaroud



  2. #2
    Registered
    Join Date
    Sep 2009
    Location
    USA
    Posts
    84
    Downloads
    0
    Uploads
    0

    Default

    oi-mc should use the GOTO command which will just jump to a line number

    m98 pxxxx loads a sub program


    your post doesnt make sense to me, what are you trying to do that your not able to.



  3. #3
    Registered
    Join Date
    Apr 2011
    Location
    bunga country
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default

    I didn't ask whether my method was good or not. I'm not trying to do something impossible.

    Believe it or not, it DOES work on the 0i. I just need to make it work on the 18i.

    Maybe the example code I posted wasn't very indicative of its purpose, but the purpose is irrelevant. The fact that the code works is relevant. I'll make a better example anyway:

    O1000;
    X0 Y0 M98 Q1100;
    X100 Y0 M98 Q1100;
    M30;
    ;
    N1100;
    (...)
    M99;

    The point is that I can just put subprogrs in the main prog instead of making lots of additional files. Potentially tens of them for each main program. I use a lot of subs and macros (even modal ones) for most of my programs, so M98 Qxx was a godsend. I wish it was possible to use this trick also with G65-66 but I've achieved something very close with my own subprogram-calling macros. Just for the record, it looks something like this:

    O9000(M985 CALL LOCAL MACRO);
    (Q=SEQUENCE NUMBER);
    (R=PROGRAM NUMBER)(MODAL);
    (A,B,C,ETC=MACRO ARGUMENTS);
    IF[#18 NE #0] THEN #500=#18 (REMEMBER PROGRAM NUMBER);
    M98 P#500 Q#17;
    M99;

    Yes it's possible to specify P and Q. And the arguments used when calling M985 are mantained when the control passes to the subprogram, bacause it's called with a M98 not a G65, which means the level of local variables doesn't change. Example:

    O1000
    M985 R1000 Q4 A1100
    M985 Q4 A1200
    M985 Q4 A1300
    M30

    N4
    G52 X0 Y0 M98 Q#1
    G52 X100 Y0 M98 Q#1
    G52 X100 Y100 M98 Q#1
    G52 X0 Y100 M98 Q#1
    M99

    N1100
    (...)
    M99

    N1200
    (...)
    M99

    N1300
    (...)
    M99

    The question is, how do I enable this Q trick on the 18i? And possibly not only for M98 but also for G65?



  4. #4
    Registered beege's Avatar
    Join Date
    Feb 2008
    Location
    USA
    Posts
    586
    Downloads
    0
    Uploads
    0

    Default

    I've never seen the Q word used with the M98, but I HAVE used the P word with M99 in the main program.

    M99P1100 jumps to N1100, and M99 by itself jumps to the beginning of the program.

    Hmmm. Q, huh?



  5. #5
    Member
    Join Date
    Feb 2006
    Location
    india
    Posts
    1792
    Downloads
    0
    Uploads
    0

    Default

    Q might be working, but it is as good as a simple GOTO only. If the sub can be repeated a number of times using Q, then it has some utility. Check and let us know.

    Incidently M985 has nothing to do with M98.



  6. #6
    Registered
    Join Date
    Apr 2011
    Location
    bunga country
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default

    M98 Q works just as M98 P. The difference is the subprogram in part of the current program instead of an additional external program. It can also be repeated with L. I'ts also possible to use P and Q in the same call. GOTO has nothing to do with it.
    The "M985" I posted is a custom macro made by me.
    All code examples I posted work perfectly, I'm not making up random stuff.

    It seems this subject is rather obscure. Thanks for the help so far anyway. Next week I'll look for differences in the parameters 6000s between the 0i and 18i and maybe I'll find out what enables it.



  7. #7
    Member
    Join Date
    Feb 2006
    Location
    india
    Posts
    1792
    Downloads
    0
    Uploads
    0

    Default

    P and Q in the same call?
    How is it interpreted?



  8. #8
    Registered
    Join Date
    Apr 2011
    Location
    bunga country
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default

    It looks for sequence number Q in program number P. Probably not very useful in everyday programming (but my "local macro call" custom needs it).
    I got a look at the parameter manuals for both models. In the 0i, it says:
    6005: bit 0 (SQC) Calling a subprogram with its sequence number by the subprogram function is: 0=disabled 1=enabled
    The 18i manual doesn't mention those parameters but IIRC the parameter screen DID show all the same that are on the 0i... next week we'll see.



  9. #9
    Member
    Join Date
    Feb 2006
    Location
    india
    Posts
    1792
    Downloads
    0
    Uploads
    0

    Default

    This issue needs investigation.
    If a sub can be called by sequence number, it perhaps is a part of the calling program, not an external program. But, logically, it should still be a P-word only, not a Q-word.



  10. #10
    Registered
    Join Date
    Aug 2007
    Location
    uk
    Posts
    58
    Downloads
    0
    Uploads
    0

    Default

    Hi All,

    I'm used to using Mac3 controller and M98 calls to a "subroutine" within the main program i.e not an external "program".

    So, i was a bit disapointed to find out my new VMC with a Oi-MD control cant do this simple thing

    I'm very interested in finding the best way to call sub routines (not external sub programs).

    The operators manual does detail M98 P and Q words......

    Such as N00030 M98 P1010 Q1030.....this jumps to an external program and to line number 1030 in the external prog.

    It doesn't give an example of just the Q word - I tried it,and it does not work (even with the SEQ parameter 6005 set).

    I'll give it another try as some of my progs have 6 or 7 subroutines and 24 workoffsets (jig positions) and having to use goto and external sub programs is a house keeping nightmare.

    How do you do it?

    Cheers,
    Derek.



  11. #11
    Registered
    Join Date
    Apr 2011
    Location
    bunga country
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default

    I've been told that if setting 6005.0 doesn't work, then an option must be installed by fanuc.
    I could dump the option params form a machine that had it enabled, but had no luck finding which one needs to be changed (or maybe changing params isn't enough truly, but it's hard to believe).

    So I set my machine to achieve the same result using G65 instead. A program looks like this:

    O1000
    GOTO[0+#17]
    N0
    (main program here)
    (sub call example: )
    G65 P1000 Q123
    M30

    N123
    (subprogram here)
    M99

    Parameter CLV (6001 was it?) should be zero so #17 is cleared upon reset, which will cause the GOTO statement to jump to N0 on program start.
    It can be simplified further using custom M/G codes (but the limitation of such calls not working when nested can be annoying)



  12. #12
    Member
    Join Date
    Feb 2006
    Location
    india
    Posts
    1792
    Downloads
    0
    Uploads
    0

    Default

    G65 calls an external program. Q123 would set local variable 17 to 123, inside the macro.



  13. #13
    Registered
    Join Date
    Aug 2007
    Location
    uk
    Posts
    58
    Downloads
    0
    Uploads
    0

    Default

    Hi Old Newbie,

    Why use GOTO[0+#17] and not just GOTO 0?

    I'm trying to understand the best wat to layout my progs.
    The application I have is machining small parts......
    a 4 sided trunnion, 6 parts on each side and 6 tools.

    Cheers
    Derek.



  14. #14
    Registered
    Join Date
    Apr 2011
    Location
    bunga country
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default

    In my example, G65 P1000 Q123 calls the current program again. At that moment, GOTO[0+#17] equals to GOTO123. That's how it emulates M98 Q123.



  15. #15
    Registered
    Join Date
    Jul 2007
    Location
    USA
    Posts
    34
    Downloads
    0
    Uploads
    0

    Default

    I love your use of G65 as a branch jump. I can see how you would be able to, say, change some variables and then jump back to repeat N123 or go anywhere else as a sub, all within the same program. Brilliant work.
    yours,
    newc

    Last edited by newc; 05-24-2011 at 12:04 PM.


  16. #16
    Member
    Join Date
    Jan 2010
    Location
    Norway
    Posts
    171
    Downloads
    0
    Uploads
    0

    Default Re: M98 P/Q?

    Old topic but think i have the solution
    Take a look at parameter 6005 Bit 0, set it to 1 and M98 Qxxxx should work, if you have the parameter,



  17. #17
    Registered jamessiffel's Avatar
    Join Date
    Jun 2011
    Location
    u.s.a.
    Posts
    124
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by ProToZyKo View Post
    Old topic but think i have the solution
    Take a look at parameter 6005 Bit 0, set it to 1 and M98 Qxxxx should work, if you have the parameter,
    Dude, its FOUR years later and they already said that.



  18. #18
    Member
    Join Date
    Jan 2010
    Location
    Norway
    Posts
    171
    Downloads
    0
    Uploads
    0

    Default Re: M98 P/Q?

    Oh my bad i must have mixed it up with another post wich had no solution.



  19. #19
    Member OkumaWiz's Avatar
    Join Date
    Apr 2009
    Location
    United States
    Posts
    1262
    Downloads
    0
    Uploads
    0

    Default Re: M98 P/Q?

    M98 P1000 will call a sub program in file O1000.

    With 6005.0 set to 1, M98 Q1000 will Jump to line N1000 for the sub. This works well since line N1000 can be placed after the M2 and only one file is needed but can include multiple sub programs, so only one file to upload and download.

    M198 will call a sub program on the external flash card. Handy when memory is at a minumum.

    I know this is an old post, but wanted to add a tidbit to clarify how 6005.0 works.

    Best regards,

    PS: This works on the 0i control. Not sure about the 18...don't have one to try.

    Experience is what you get just after you needed it.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

M98 P/Q?

M98 P/Q?