585,758 active members*
4,264 visitors online*
Register for free
Login
Results 1 to 11 of 11
  1. #1
    Join Date
    Sep 2011
    Posts
    261

    How do I set a Custom G code?

    Hello,
    I am going to make a custom G code on my swiss lathe with a Fanuc 18i-TB control. I had one at my last work and have an idea of what im doing but I didnt set it up and need a little direction.

    I know I need to set parameter 6050-6059 to a number and I need a program with my custom macro with a 9001-9009 prog number I think.

    So, my question is:
    -what does the parameter # correspond to
    -what do i need to set the parameter # to?

    If I remember right I think 6050 is g60, 51 is g61 ect but I forget.

    thanks for any help
    CNC Product Manager / Training Consultant

  2. #2
    Join Date
    Sep 2010
    Posts
    1230
    Quote Originally Posted by MCImes View Post
    Hello,
    I am going to make a custom G code on my swiss lathe with a Fanuc 18i-TB control. I had one at my last work and have an idea of what im doing but I didnt set it up and need a little direction.

    I know I need to set parameter 6050-6059 to a number and I need a program with my custom macro with a 9001-9009 prog number I think.

    So, my question is:
    -what does the parameter # correspond to
    -what do i need to set the parameter # to?

    If I remember right I think 6050 is g60, 51 is g61 ect but I forget.

    thanks for any help

    -what does the parameter # correspond to

    The parameter number relates to a program number as shown below.

    -what do i need to set the parameter # to?

    You register a numeric value that corresponds to the custom G code you wish to create. For example. I use G100 to launch a Tool Length measuring User Macro program. I can use this G code in a program or via MDI when measuring tool length. In this case, the number 100 is registered in the parameter that corresponds to the Macro Program number I wish to use, or is available (9010 to 9019).

    If I remember right I think 6050 is g60, 51 is g61 ect but I forget.
    These parameters don't relate to any G code unless a number has been registered therein. If these parameters already have numbers registered, ie 60, 61, etc, then they are already being used, perhaps by special G codes created by the OEM. If this is the case, then they are unavailable to you and can't be used without destroying the relationship with existing G codes that are calling these Macro programs numbers.

    Regards,

    Bill

    6050 G code that calls the custom macro of program number 9010
    6051 G code that calls the custom macro of program number 9011
    6052 G code that calls the custom macro of program number 9012
    6053 G code that calls the custom macro of program number 9013
    6054 G code that calls the custom macro of program number 9014
    6055 G code that calls the custom macro of program number 9015
    6056 G code that calls the custom macro of program number 9016
    6057 G code that calls the custom macro of program number 9017
    6058 G code that calls the custom macro of program number 9018
    6059 G code that calls the custom macro of program number 9019

  3. #3
    Join Date
    Sep 2011
    Posts
    261
    exactly what I needed. Thanks! Im going to make a turn/dwell chip breaker macro to make my chips more manageable. It will be very nice. Thanks again
    CNC Product Manager / Training Consultant

  4. #4
    Join Date
    Sep 2011
    Posts
    261
    I thought that I had a copy of the chip breaker turn/dwell program from my old machine but I seem to have misplaced it. So anyone want to help me write one? or if you have one post it?

    I thought it looked something like this:

    %9010

    #1 =z end
    #2 =turn distance/chip break
    #3 =dwell
    #4 =feed

    IF [#2 LT0] goto2
    IF [#3 LT0] goto3
    IF [#4 LT0] goto4

    #1= #5401 (not sure if #5401 is correct but i think its close)
    while [current position LT #1] DO1
    G1 W#2 f#4
    G4 U#3
    END1

    m99

    N2 (Bad Distance)
    (alarm code?)

    N3 (Bad Dwell)
    (alarm code?)

    N4 (Bad Feed)
    (alarm code?)
    %

    My questions are
    -How do I define my current Z position. If I remember the old program correctly I thought it was #1=#5401 but I could be wrong.

    -I want to write the code in the program as G65 Z(end) Q(chip break) D(dwell) F(feed). How do I link Z,Q,D, and F to my sub program? Can I say #2=Q? Or do I use some parameter #'s like Q=#5403?

    -At the end of the program how do I get it to alarm if a value is missing? what code or parameter do I put there?

    -In my WHILE statement should I use a Z or W for my feed move? Does it matter? Do I have it written correctly that the loop will end when it hits my end point or could it possibly over-turn by going to the end of the last chip break assuming the chip break distance is not divisible by the overall distance.

    I know thats kinda a lot so thanks a bunch in advance!
    CNC Product Manager / Training Consultant

  5. #5
    Join Date
    Sep 2011
    Posts
    261
    Anyone know what "buffer overflow" means immediately after hitting read>execute?
    CNC Product Manager / Training Consultant

  6. #6
    Join Date
    Sep 2010
    Posts
    1230
    Quote Originally Posted by MCImes View Post
    Anyone know what "buffer overflow" means immediately after hitting read>execute?
    Obviously you're reading data from an external device. Do you see that data starts to be sent from the sending device? Is this a new problem that has only just occurred?

    Buffer overflow alarm normally occurs when the receiving device doesn't send an Xoff handshake signal when software handshaking is used, or doesn't switch the CTS to logic 0 if hardware hand shaking is being used. Alternatively, the sending device does not recognize the handshake, and keeps sending data. In either case the Input Buffer of the receiving device will overflow.

    Post more details on the matter so that more considered advice can be given.

    Regards,

    Bill

  7. #7
    Join Date
    Jun 2008
    Posts
    1511
    It is also due to having the baudrate not set properly. Your 18i should be fine but some of the older controls could only receive so much into the buffer when sending a program. IIRC some could only receive 10 characters when the PC was sending 15. Try slowing down your baudrate and also make sure that the baudrate set in the PC matches the CNC.

    Stevo

  8. #8
    Join Date
    Sep 2010
    Posts
    1230
    Just to add a bit to Stevo's good advice.

    Slowing the baud rate is a bit of a Fudge Fix. Overrun when all settings are correct normally occurs due to the PC not being able to react quick enough when told to stop sending data. This happens more so with Software Handshaking, where the Xoff, control character DC3 (Ascii 19), is interpreted at system level. The issue frequently is with the serial port itself and can be rectified in some cases by using a lower FIFO setting. This setting is accessible through the Advanced Port Setting in the Device Manager. Unequal baud rate between machine control and PC will give a Framing error.

    Regards,

    Bill

  9. #9
    Join Date
    Feb 2006
    Posts
    1792
    Quote Originally Posted by MCImes View Post
    Hello,
    I am going to make a custom G code on my swiss lathe with a Fanuc 18i-TB control. I had one at my last work and have an idea of what im doing but I didnt set it up and need a little direction.

    I know I need to set parameter 6050-6059 to a number and I need a program with my custom macro with a 9001-9009 prog number I think.

    So, my question is:
    -what does the parameter # correspond to
    -what do i need to set the parameter # to?

    If I remember right I think 6050 is g60, 51 is g61 ect but I forget.

    thanks for any help
    Read the attachment for more details on custom G-codes.
    Attached Files Attached Files

  10. #10
    Join Date
    Jun 2008
    Posts
    1511
    Yes Bill you are correct. I was just going from memory last night with no reference material. My book states that it is usually the FIFO buffers on the PC. This is a very common problem on the 10 and 11 series fanucs

    The other 2 things that my book says is the program could be missing the O or : at the beginning of the program number. Also try setting the stop bits =2 and experiment with the different parity’s or data bits.

    These are the typical settings that I usually use.
    DATA FORMAT- ISO
    PARITY- EVEN
    DATA BITS- 7
    STOP BITS- 2
    FLOW CONTROL- XON/XOFF

    Stevo

  11. #11
    Join Date
    Sep 2010
    Posts
    1230
    Quote Originally Posted by stevo1 View Post
    Yes Bill you are correct. I was just going from memory last night with no reference material. My book states that it is usually the FIFO buffers on the PC. This is a very common problem on the 10 and 11 series fanucs

    The other 2 things that my book says is the program could be missing the O or : at the beginning of the program number. Also try setting the stop bits =2 and experiment with the different parity’s or data bits.

    These are the typical settings that I usually use.
    DATA FORMAT- ISO
    PARITY- EVEN
    DATA BITS- 7
    STOP BITS- 2
    FLOW CONTROL- XON/XOFF

    Stevo
    Hi Stevo,
    Your answer highlights why more detail than just a generic error condition should be provided by OPs so that definitive solutions can be provided. Unless there is a physical problem with the control's IO board, its rather hard to get communication with a Fanuc control wrong if you follow the simple steps required to set the control and PC correctly. With the lack of information that is often provided, it becomes a matter of randomly changing stuff until a resolve is stumbled upon.

    Like they say, if you put enough chimps in a room with word processors, eventually you'll get the complete work of William Shakespeare.

    Regards,

    Bill

    .

Similar Threads

  1. Haas chokes on my custom G code
    By Vern Smith in forum Haas Lathes
    Replies: 3
    Last Post: 11-20-2009, 07:15 PM
  2. Writing a custom M code?
    By greeder88 in forum Dynapath
    Replies: 1
    Last Post: 06-24-2009, 02:52 PM
  3. inserting custom code
    By beartrax in forum Mastercam
    Replies: 3
    Last Post: 08-29-2008, 04:53 PM
  4. Custom bending a custom extrusion
    By brokenrinker in forum Bending, Forging, Extrusion...
    Replies: 10
    Last Post: 12-15-2007, 03:28 PM
  5. Is there any G-code for custom using?
    By david_geng in forum G-Code Programing
    Replies: 3
    Last Post: 02-11-2007, 03:56 PM

Posting Permissions

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