586,103 active members*
3,319 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Fanuc > Toolchange macro to make multiple parts
Page 2 of 2 12
Results 21 to 27 of 27
  1. #21
    Join Date
    Feb 2007
    Posts
    314
    I think i found something... more details soon!
    Just to be sure, cause I'm not familiar with random ATC, Is the way i programed it in my last post ok. (call the next tool right after the M6 even if it is in another sub)

  2. #22
    Join Date
    Aug 2011
    Posts
    92
    This is the approach I was thinking of myself, have the tool changes in the main program. I think something like this would work. I need to try it out and see.

    Quote Originally Posted by samu View Post
    so i think the problem is with the T number and not with M6. M6 just swap the tool in spindle with the tool in the tool changer , but logically you cannot ask to prepare the pocket containing the tool in the spindle. More complicated than i thought! At least, the solution exposed in my previous post should work according that you jump above the M6 and the next tool Txx.
    %
    O1 (main)
    T1 (TOOL FOR THE FIRS SUB )
    G65 A54. B4. C2. D4. P9201
    G91 G28 Z0 M9
    G28 Y0
    M30

    O2
    IF[#130=1] GOTO 5
    M6
    T2(TOOL FOR THE NEXT SUB)
    N5 #130=1
    (REST OF THE SUB)
    M99

    O3
    IF[#130=1] GOTO 5
    M6
    T3(TOOL FOR THE NEXT SUB)
    N5 #130=1
    (REST OF THE SUB)
    M99

    O4
    IF[#130=1] GOTO 5
    M6
    T1(TOOL FOR THE FIRST SUB)
    N5 #130=1
    (REST OF THE SUB)
    M99
    %

    Give it a try and give me feed back! I'll continue thinking a way to avoid hand coding of the "IF GOTO ........."

  3. #23
    Join Date
    Feb 2007
    Posts
    314
    found two more solution!

    first one:

    if you begin each sub by:
    Txx(tool for the current sub)
    M6

    Advantage :simple, no change to the way a tool change is programmed
    disadvantage: the tool is called just before tool change so it is not ready, you loose the time of bring the tool to the tool change position.
    detail of the solution: a macro called by M6 code keep track of the tool in the spindle and another one called by T compare the tool in the spindle with the tool being called. If it is not the same, the macro execute the T code normally if it is the same, the T code is skipped and the macro called by T set a variable to tell to the macro called by M6 to skip the M6.


    solution 2
    each sub begin by
    M6 Txx (both on the same line Txx=next tool)
    The tool of the first sub must be called in the main or alone one a block before the M6 Txx

    Advantage: Faster tool change cause you can prepare the next tool, Just a macro called by M6 (no need of another called by T)
    disadvantage:Create a new way of programming a tool change (although the conventional way still work in a stand alone program but cause problem in our application)
    detail of the solution:A macro called by M6 compare the value of the T code passed in argument (the one one the same line) with the last T code(#4120) if they are the same, the tool change is skipped if not, the tool change is executed and the next tool is called.
    but i don't know if the T passed in argument will affect the value of #4120, to be tested

  4. #24
    Join Date
    Feb 2007
    Posts
    314
    The best of the two !!

    The macro 9201 set a variable that we will call "multipiece mode". We keep the principle of a macro called by M6 and other one called by T(this one is optional but allow to program the way you did (begin the sub by calling the tool for that sub, then do the tool change). The goal of the T macro is to avoid an alarm when the tool in the spindle is called. M6 macro begin by checking if the multipiece mode is on. If not, M6 act normally,if yes it checks if the prog number has change since the last tool change. If so, it do the tool change, if not, it skip the tool change.
    I will post the code in few hour or Monday morning

  5. #25
    Join Date
    Sep 2010
    Posts
    1230
    Quote Originally Posted by samu View Post
    A macro called by M6 compare the value of the T code passed in argument (the one one the same line) with the last T code(#4120) if they are the same, the tool change is skipped if not, the tool change is executed and the next tool is called.
    but i don't know if the T passed in argument will affect the value of #4120, to be tested
    Hi Samu,
    The "T" address used to pass an argument to a Macro Program does not affect the value of System Variable #4120. Any "T" code that is executed in the Macro program called by an "M" code is treated as a normal "T" code and will alter Variable #4120 when executed within the Macro Program.

    Regards,

    Bill

  6. #26
    Join Date
    Feb 2007
    Posts
    314
    Here is ,what i think, the best solution

    O9201
    #11=#7-#3 (QUANTITY OF PROGRAM TO LOOP)
    #132=#3 (WORKING COPY OF THE FIRST PROG)
    #13=0 (PROGRAM COUNTER)
    #130=#0(USED TO DETECT PROGRAM CHANGE AND ENABLE TOOL CHANGE)
    #131=1 (TURN ON MULTIPIECES MODE)
    N10DO1
    #10=0 (LOOP COUNTER)
    IF[#9NE1]GOTO11 (IF YOU DON'T WANT TO BEGIN BY THE LAST WORK OFFSET JUMP TO)
    #1=#1+#2-1 (SET LAST WORK OFFSET)
    GOTO16
    N11DO2
    G#1 (SET CURRENT WORK OFFSET)
    M98P#132 (CALL CURRENT PROGRAM)
    #10=#10+1 (INCREMENT LOOP COUNTER)
    IF[#10EQ#2]GOTO15 (IF CURRENT PROG HAS BEEN RUN ON ALL WORK OFFSET JUMP TO)
    #1=#1+1 (INCREMENT WORK OFFSET)
    END2
    N15#13=#13+1 (INCREMENT PROG COUNTER)
    IF[#13GT#11]GOTO18 (IF ALL PROG HAVE BEEN RUN JUMP TO)
    #10=0 (RESET LOOP COUNTER)
    #132=#132+1 (INCREMENT PROG NUMBER)
    N16DO2
    #9=0 (CLEAR THE BEGIN BY THE LAST OFFSET FLAG)
    G#1 (SET CURRENT WORK OFFSET)
    M98P#132 (CALL CURRENT PROG)
    #10=#10+1 (INCREMENT LOOP COUNTER)
    IF[#10EQ#2]GOTO17 (IF CURRENT PROG HAS BEEN RUN ON ALL WORK OFFSET JUMP TO)
    #1=#1-1 (DECREMENT WORK OFFSET)
    END2
    N17#13=#13+1 (INCREMENT PROG COUNTER)
    IF[#13GT#11]GOTO18 (IF ALL PROG HAVE BEEN RUN JUMP TO)
    #132=#132+1 (INCREMENT PROG NUMBER)
    END1
    N18 #131=0 (TURN OFF MULTIPIECE MODE)
    M99

    Explanation of the change:
    1. #12 become #132 to allow the reading of the program number in the M6 macro
    2. creation of #130 if #130=1, the M6 check if the tool change has to be skipped, else, M6 works normally
    3. CREATION OF #131 : It is the last prog number, it is set to null at the beginning cause there is no prog number yet. It is used in the M6 macro to compare whit #132 which is current prog number. If they are the same, tool change is skipped.

    %
    O9020(M6 MACRO (SET PRM 230 TO 6))
    IF [#133 EQ 1] GOTO 2 (if skip tool change signal coming from T macro is on)
    IF [#131 NE 1] GOTO 10 (JUMP IF MULTIPIECE MODE IS OFF)
    IF [#132 NE #130] GOTO 5 (JUMP IF LAST PROG NUMBER IS DIFFERENT OF CURRENT PROG NUMBER)
    N2 M99 (SKIP TOOL CHANGE)
    N5 #130=#132 (OVERWRITE LAST PROG NUMBER)
    N10 M6 (EXECUTE TOOL CHANGE)
    #500=#501 (SAVE TOOL NUMBER IN THE SPINDLE)
    M99
    %

    Explanation:
    First, M6 macro checks if multipiece mode is ON (in other word, if macro 9201 is used). If not, the tool change works normally, if so, it checks if the prog number has changed since the last tool change. If the prog number haven't changed, it means that there is no need for a tool change so the tool change is skipped. If the prog number has changed, it means that it has to execute tool change. After tool change execution, the tool number of the tool in the spindle is stored in #500. #501 represent the last T word. I can probably use #4120 but i don't know it status at power ON. Does it keep its value after power off/power on ? In the doubt, i used #501 instead.

    %
    O9000(T CODE MACRO)
    #501=#149 (save tool number)
    #133=0 (cancel skip tool change signal))
    IF[#501 NE #500] GOTO 10 (JUMP IF THE TOOL CALLED IS NOT THE ONE IN THE SPINDLE)
    #133=1 (turn on skip tool change signal)
    M99 (SKIP THE T ACTION CAUSE THE TOOL CALLED IS THE ONE IN THE SPINDLE)
    N10 T#501 (DO THE T ACTION)
    M99
    %

    Explanation:
    By setting prm 40.5 to 1, T code call macro O9000. The number following the T code is send in #149. #149 is the saved in #501 for the purpose I explained in M6 macro.
    After that, the T macro compare the tool number in the spindle(#500) with the tool number called(#501) if they are the same, the normal T action is skipped but there is no alarm. If not, the T action is done normally.


    Information about prm and T code called macro are from a 0 series manual, probably the same for a 10 but better to take a look.

    I think it is a must, suppose a one tool prog, actually, i understand that you have to manually call the tool cause if it is written :
    T1
    M6

    at the beginning of the prog, you re-read T1 ,which is already in the spindle, at the second execution, and there is an alarm.

    Hope you will try it and give feedback. I really enjoy macro programming and it is much more pleasant when it is useful for someone.

  7. #27
    Join Date
    Aug 2011
    Posts
    92
    Wow, this is getting pretty complicated.

    I am looking through the code just trying to make sure I understand what i am throwing into the machine. I currently have it running a job so once we get that set I think i will start to play around with this.

    Only thing i have to be very careful of is the machine only has 18kB of memory. So every kB is very important and I have to be careful not too load too many macros or I wont have any room for programs.

Page 2 of 2 12

Similar Threads

  1. How do I make multiple passes on arc.
    By Andrew96 in forum Vectric
    Replies: 4
    Last Post: 07-02-2011, 05:16 AM
  2. Toolchange macro/sub for OSP5000L
    By nlh in forum Okuma
    Replies: 7
    Last Post: 10-02-2010, 11:31 AM
  3. how to get multiple parts from a bar
    By firekoe in forum Fanuc
    Replies: 13
    Last Post: 02-11-2010, 03:23 PM
  4. KIWA excel 510 toolchange macro help
    By bensoli in forum Uncategorised MetalWorking Machines
    Replies: 0
    Last Post: 12-29-2009, 06:49 PM
  5. Macro b multiple choice menu?
    By tomi6678 in forum Parametric Programing
    Replies: 2
    Last Post: 12-12-2009, 09:16 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
  •