587,487 active members*
3,771 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Fanuc > Tool Change Macro ; Can anybody read and tell me whats going on?
Results 1 to 11 of 11
  1. #1
    Join Date
    Feb 2015
    Posts
    9

    Tool Change Macro ; Can anybody read and tell me whats going on?

    Hi Guys,
    I have a Kira VTC-30E with Fanuc 21M Turret style tool changer
    I lost my macro to tool change :
    I got this program from a Kira Fanuc 21i Turret style tool changer


    %
    O9020(TOOL CHANGE)
    M5
    G0G91M9
    M19
    G91G30Z0
    M6T#20
    G28Z0
    G90
    N999
    M99
    %

    Would This Work?

    What does #20 do?
    N999 do?
    Should I have something in for those values?
    Thanks for viewing

  2. #2
    Join Date
    Feb 2015
    Posts
    161

    Re: Tool Change Macro ; Can anybody read and tell me whats going on?

    See my notes below

    %
    O9020(TOOL CHANGE)
    M5 spindle stop
    G0G91M9 rapid,incremental mode,coolant off
    M19 spindle orientation
    G91G30Z0 move Z to tool change position
    M6T#20 tool change, tool number that is in macro variable #20. Passed from calling program
    G28Z0 send Z to home position
    G90 absolute mode
    N999 line number, doesn't call anywhere in program, appears to be superfluous
    M99 go back to program that called this program
    %

  3. #3
    Join Date
    Feb 2006
    Posts
    1792

    Re: Tool Change Macro ; Can anybody read and tell me whats going on?

    The value stored in parameter 6080 would be the M code for tool change.
    E.g., M<6080 value> T1 would place tool number 1 in the spindle.

  4. #4
    Join Date
    Feb 2015
    Posts
    9
    when I go to mdi and do t1m6 ;
    It still says tool not in 2nd position .
    It's like it doesn't call for macro tool change or can't find it . How do you know what program number it needs to be ?

  5. #5
    Join Date
    Sep 2010
    Posts
    1230

    Re: Tool Change Macro ; Can anybody read and tell me whats going on?

    Quote Originally Posted by Jab814 View Post
    when I go to mdi and do t1m6 ;
    It still says tool not in 2nd position .
    It's like it doesn't call for macro tool change or can't find it . How do you know what program number it needs to be ?
    Hello Jab814,
    This is a poorly written Tool Change Macro, with no error trapping to pick up a simple mistake such as the Tool Change Syntax, or the omission of a Tool Number.
    As suggested by Sinha, a number corresponding to the M code used to call the Tool Change Macro has to be registered in parameter 6080. Accordingly, if you have not already done so, ensure that the number 6 is registered therein.

    When a number is registered in parameters to call a Macro program, it replaces the general code to call a Macro. For example, if program O9020 were to be called using the Macro Call G Code "G65", then the syntax would be as follows:

    G65 P9020

    Accordingly, if 6 is registered in parameter 6080, then M6 will have the same meaning, and replaces G65 P9020.

    When calling a Macro Program with G65 P_ _ _ _, or an M code to replace it, arguments can be passed to the Macro being called by using Alpha Characters that correspond to the Local Macro Variable set that is available. In the case of the address "T", it corresponds to Local Variable #20 and therefore, will pass the value used with this address to #20 in the Macro Program being called. Correspondingly, T6 will pass the value of 6 to #20 in the Macro Program.

    When using the General Call syntax using G65 P_ _ _ _, arguments being passed to the Macro must come after the G65 P_ _ _ _. As M6 can replace G65 P9020 by registering 6 in parameter 6080, the argument being passed to the Macro must come after the M6, the same as it must come after G65 P9020. Therefore, executing T1M6 as stated in you last Post is not going to work.

    First you need to ensure that the number 6 is registered in parameter 6080. Once done, select Single Block and execute the following to ensure that M6 is successfully finding your Macro Program O9020:

    M6 T1

    When the above code is executed in Single Block, program O9020 should appear on the monitor if the Program Screen is active.

    Tool Change execution can be carried out completely by the PLC, or by a combination of PLC and Tool Change Macro interaction; its up to the MTB as to how the Tool Change is implemented.

    When you say that your tool magazine is a Turret Style, I assume you're referring to what is commonly called a Carousel Magazine where the tools have to go back into the same pocket whence they came. This type of Tool Magazine arrangement often uses a communication between a Tool Change Macro and the PLC to ensure various events of the Tool Change have been completed. Accordingly, there may be a specific Tool Change Macro for your model of Kira machine. If executing M6 T1 doesn't result in a successful tool change, I'd suggest contacting Kira, or their agents, quoting the Serial Number of your machine, and seek a copy of the correct Tool Change Macro. The Macro program that you have listed does nothing more than position the Z axis slide, which means that this program will only work with a machine where all of the I/O checking is done by the PLC. Your statement "It still says tool not in 2nd position" suggest more than just syntax error. Do you see the Z axis slide moving to Second Z axis Reference Return Position? If the O9020 Macro is being called then all of the Blocks up to M6 T#20 should execute without error irrespective of the Macro Call syntax used.

    The following is a slightly modified version of your program that would pick up the error of your T1 M6 syntax.

    %
    O9020(TOOL CHANGE)
    IF [#20 EQ #0] GOTO100 (ERROR TRAP FOR MISSING TOOL DATA OR SYNTAX ERROR)
    #1 = #4001 (STORE GROUP 1 G CODE)
    #2 = #4003 (STORE GROUP 3 G CODE)
    M5
    M9
    M19
    G91G30Z0
    M6T#20
    G28Z0
    GOTO900
    N100
    #3006 = 1 (TOOL OR SYNTAX ERROR)
    N900 G#1 G#2 (RESTORE GROUP 1 AND 3 G CODES)
    M99
    %

    Regards,

    Bill

  6. #6
    Join Date
    Feb 2015
    Posts
    9

    Re: Tool Change Macro ; Can anybody read and tell me whats going on?

    Hello again,
    I put 6 into 6080
    Still nothing ?
    Do I need do do something with g65 p9020?

  7. #7
    Join Date
    Sep 2010
    Posts
    1230

    Re: Tool Change Macro ; Can anybody read and tell me whats going on?

    Quote Originally Posted by Jab814 View Post
    Hello again,
    I put 6 into 6080
    Still nothing ?
    Do I need do do something with g65 p9020?
    No, but you should check that 6 is not registered in any other parameters from 6081 to 6089 inclusive. If you have lost an existing Tool Macro, there is a fair chance that the Macro program could have been called by M6 with 6 being registered in another parameter. Also, its common for machines that have a Carousal type Tool Changer to use a Macro called by a T code, Therefore you should also check the status of bit 5 of parameter 6001. If its set to to 1, then a Tool Macro program for your machine would have called a Macro registered in program number O9000 by a T address.

    Regards,

    Bill

  8. #8
    Join Date
    Feb 2006
    Posts
    1792

    Re: Tool Change Macro ; Can anybody read and tell me whats going on?

    Maybe replace M6T#20 by T#20M6 in program number 9020. (but call the macro by M6T1)

  9. #9
    Join Date
    Feb 2015
    Posts
    9

    Re: Tool Change Macro ; Can anybody read and tell me whats going on?

    Hey,
    So I checked 6081 to 6089 all zeros
    6001.5 is zero as well
    I will try
    Also I noticed when I do a m19 it times out and I don't think it finds orientation .

  10. #10
    Join Date
    Sep 2010
    Posts
    1230

    Re: Tool Change Macro ; Can anybody read and tell me whats going on?

    Quote Originally Posted by Jab814 View Post
    Hey,
    So I checked 6081 to 6089 all zeros
    6001.5 is zero as well
    I will try
    Also I noticed when I do a m19 it times out and I don't think it finds orientation .
    You need to carry out some controlled trouble shooting. Not answering the questions put to you doesn't help the Forum help you; such as "Do you see the Z axis slide moving to Second Z axis Reference Return Position?" from Post #5.

    In your Post #4 you stated "when I go to mdi and do t1m6, It still says tool not in 2nd position"; this was before you stated in Post #6 "I put 6 into 6080". Without 6 being registered in any parameter from 6080 to 6089, M6 will be treated as a normal M code and processed by the PLC immediately, rather than call a Macro Program. When a Macro Program is called by an M code, M6 for example, any M code that appears in the Macro will be treated as a normal M code and processed by the PLC.

    Given that, as of your Post #4, you had no 6 registered in parameters 6080 to 6089, your program O9020 would NOT have been accessed at all and the message "tool not in 2nd position" would have been generated by the PLC. Now that you have 6 registered in parameter 6080, you should confirm that the Macro Program is being accessed by executing a Tool Change command (M6 T1, for example) with the control in single Block Mode. With 6 registered in 6080, program O9020 should have been accessed, M19 should have been executed and a Time Out occur, as you state in your Post #9 that it does. However, you state state in your Post #6 "I put 6 into 6080 Still nothing?" Does this mean that absolutely nothing happened, or there was a Time Out error when M19 in the Macro was executed?

    You state in your first Post that you lost the Tool Change Macro. Did you also lose parameters? If no, then parameter 6080 through to 6089 all being Zero and 6001.5 Zero would indicate that your machine never used a Tool Change Macro in the first place, with all of the Tool Change execution being made by the PLC.

    Have you used this machine before and if so, is T_ _ M6 the syntax used in the past? If so, then the #20 in your Macro will have a Null value and will not work. With a T_ _ M6 syntax, at least in your Macro, the Tool Number variable should be as follows:
    T#4120 M6
    or if parameter 6001.5 was previously set to 1, then the following variable would be used in the Macro:
    T#149 M6

    In any case, if a Time Out error is being raised when M19 is executed, you will need to resolve that problem first before you address the use of a Tool Change Macro.

    Regards,

    Bill

  11. #11
    Join Date
    Jan 2009
    Posts
    117

    Re: Tool Change Macro ; Can anybody read and tell me whats going on?

    I suggest change the line M6T#20 to M6T#4120

    #4120 is the macro system variable that stores the tool number called up in the main program.

    #20 is just a common volatile variable that does not contain any data when the control is powered on.

Similar Threads

  1. Need help with Macro for checking tool length before tool change
    By mioduz in forum Tormach Personal CNC Mill
    Replies: 11
    Last Post: 04-18-2014, 08:43 PM
  2. tool change and measure tool lenght, macro?
    By Charon in forum Mach Wizards, Macros, & Addons
    Replies: 3
    Last Post: 03-20-2012, 06:56 PM
  3. Replies: 0
    Last Post: 02-14-2010, 07:26 PM
  4. M6 tool change macro
    By at6c in forum Mach Mill
    Replies: 0
    Last Post: 08-08-2009, 01:41 PM
  5. Tool Change Macro
    By cncdiag in forum Mazak, Mitsubishi, Mazatrol
    Replies: 0
    Last Post: 03-26-2007, 08:20 PM

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
  •