586,005 active members*
4,975 visitors online*
Register for free
Login
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2006
    Posts
    1792

    Redefining standard G-codes

    These days I am trying to figure out various things that can be done using macro programming.

    I came to know that it is possible to define 10 new G-codes, in the range 1-9999, on 0i Mate TC. And, by mistake or deliberately, if you select a number which already exisits, such as 1 (i.e., G01), it will redefine G01! This is something I never expected. At least the standard G-code should have been "locked" by Fanuc.

    If you want to verify what I said, just insert 1 as the value of parameter 6050 (or any parameter in the range 6050 - 6059, on 0i Mate TC) , and then run a program which has G01. You will get NUMBER NOT FOUND alarm (because you have not defined a corresponding macro in the range O9010 -O9019, which G01 is trying to call). Such a simple way to make a machine "misbehave"!

  2. #2
    Join Date
    Jun 2008
    Posts
    1511
    Sinha,
    Interesting find!! I do agree with you; however where would Fanuc draw the line on which G-code is considered standard and should be locked and what is non standard?

    This brings the other point of if a MTB creates a custom code that runs via ladder you can block out there code by making a custom G-code call via parameters. Would there be any repercussions to this?

    This is why I will use higher G-code numbers when creating this function. Things like G150, G500, G123 etc. I have found MTB to use numbers in this range that is why I will research the MTB to determine which code I will use.

    I guess I would ass u me that if someone has the programming skills and ability to start creating custom G&M codes that they would know enough to check the current codes of the machine and use ones not pertaining to that specific machine.

    Stevo

  3. #3
    Join Date
    Feb 2006
    Posts
    1792

    More information

    It is indeed possible to redefine some G-codes, M-codes and the T-code. But the basic idea behind this is to provide some extra functions to these codes. We never change the basic function of these codes. Some examples are as follows:

    1:
    There may be a requirement, due to whatever reason, that a feedrate of not more than 100 mm/min be used with tool number 7. The G01 code may be modified to clamp the feedrate to 100 mm/min whenever the specified feedrate for tool number 7 is more than 100 mm/min.

    2:
    When the spindle is running at a very high rpm, reversing the direction abruptly may cause excessive load on the motor, due to inertia. A better way may be to first stop the spindle (M05), dwell for 5 seconds to allow it to stop completely, and then reverse the spindle. Both M03 and M04 can be modified to do this automatically.

    3:
    It is dangerous to change the tool unless the turret is at a safe position, due to a possible interference between the rotating turret and headstock/workpiece/tailstock. The T-code may be modified to automatically send the turret to the reference position before changing the tool.

    There can be a number of such requirements. Macro programming can make the machine "intelligent", so that it automatically takes care of certain mistakes by the programmer.

  4. #4
    Join Date
    Feb 2009
    Posts
    64

    Macros

    It is for this very reason that I prefer to call macros with the old G65... setting up a new gcode is convenient but really only saves about 1.5 secs of typing time to program.

  5. #5
    Join Date
    Jun 2008
    Posts
    1511
    James,
    I agree with you on the macro call portion of using G65 vs a custom code. However there are many other reasons to create these codes. Sometimes a lot of codes are written into the ladder logic and have no programs that run them. Tool change, auto tool offset, pallet changing etc.

    For example I like to write a lot of custom code inside my tool change operation but on some of my machines there is no tool change program it is all done through the ladder, so I create a custom M6 to call a specific program and in that I have positioning, G43 instate, speed and feed calculation, and variable tracking of the tools.

    I also use a custom code for head rotation on my 5axis. This program has all the calculations to follow the tool tip based on tool length and angle of rotation so the machine always knows were to tool tip is when programming.

    Stevo

  6. #6
    Join Date
    Feb 2007
    Posts
    592

    Cool Crude yet effective.

    This feature was very handy for me.

    I had been handed an overflow job from another shop that had a simular machine - except mine had a Fanuc 18m and the other shop had a Yaznaq

    Well the supplied programs were full of G13 calls...

    Instead of having the other shop repost everything I wrote a macro that would do the G13 Circle cutting/Circle pocket except it could not use an "L" word.

    The macro was complete with error checking and reading modal values like "D" and "F"

    It was rushed = Crude yet effective.

  7. #7
    Join Date
    Feb 2006
    Posts
    1792
    L-word is used for number of repetitions of the macro (1 to 9999). L cannot be used for passing data to local variables. Similarly, O, N, G and P cannot be used. I remember this by the phrase "LONG Program".

Similar Threads

  1. SHEETCAM standard vs. TNG
    By WSS in forum Waterjet General Topics
    Replies: 12
    Last Post: 07-03-2009, 06:26 PM
  2. pocket standard
    By Beaker in forum Mastercam
    Replies: 1
    Last Post: 11-29-2007, 01:00 PM
  3. M-codes and G-codes 4 Matsuura ES-1000V
    By maximusek in forum G-Code Programing
    Replies: 2
    Last Post: 11-27-2007, 01:41 PM
  4. Help with non-standard pac-sci stepper
    By Argofanatic in forum Stepper Motors / Drives
    Replies: 11
    Last Post: 08-21-2007, 12:43 PM
  5. Standard Ballscrews
    By rhino in forum Linear and Rotary Motion
    Replies: 5
    Last Post: 05-14-2006, 12:24 AM

Posting Permissions

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