Need Help! GOTO condition


Results 1 to 14 of 14

Thread: GOTO condition

  1. #1
    Registered
    Join Date
    Oct 2016
    Posts
    19
    Downloads
    0
    Uploads
    0

    Default GOTO condition

    Hi,

    I'm working on a milling with Fanuc controller.
    I'm trying to adjust the tool change command with the GOTO condition but I don't know how it work.
    Here's what my program look like :


    (* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *)
    (LOAD TOOL NO: 10 DRILL .500)
    (* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *)
    N10 M5
    N12 M1
    N14 G54
    IF[#994EQ10]GOTO?
    N16 T10
    N18 M6
    N20 M1
    N22 G40
    N24 S391 M3

    The thing here is : IF the tool number (10) actually in the spindle (#994 = 10 variable) is EQual to 10, GOTO (I would like to next M1 at line N20)

    The reason why is like that is, Fanuc give me an alarm if the tool is called (T10, M6) while he his already in the spindle so that's why I want a GOTO to next M1 if the tool is already in spindle to skip tool change.

    So my question is : how can I complete the GOTO condition that it will automatically calculate to jump 3 lines lower or going to next M1 (like GOTO N+3..... GOTO next M1) cause right now I'm adding the line number manually each time my program is posted.

    Tx a lot for help

    Phil

    Similar Threads:


  2. #2
    Member
    Join Date
    Feb 2009
    Location
    usa
    Posts
    6028
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    Check your ladder diagram, a lot of machines have a keep relay to do this in the ladder, you wouldn't need to write a macro at all.

    Sent from my SM-T813 using Tapatalk



  3. #3
    Flies Fast Superman's Avatar
    Join Date
    Dec 2008
    Location
    Antarctica
    Posts
    3110
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    What Fanuc version ? Oi ?

    Your program is set to pre-select the tool before executing the toolchange ( following line )
    - does it error if the M6 was on the same line as tool selection

    normally the toolchange macro would cover this issue..... then you wouldn't have to have that line of code within the program ( or as Underthetire points to )

    Code:
    N10 M5
    N11 M9
    N12 G91 G28 Z0.
    N12 G90
    N12 M1
    ()
    (*****************************)
    (LOAD TOOL NO: 10 DRILL .500)
    (*****************************)
    N14 G54
    N16 M6 T10
    N17 T[next tool #]
    N24 S391 M3




  4. #4
    Registered
    Join Date
    Oct 2016
    Posts
    19
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    Tx guys for yours answers ,
    I'm working on a Mitsui Seiki 5 axis milling with a 30i Model A Fanuc series

    Here, the company I'm working for, have made lots of custom modifications I think in the Fanuc code. We cannot play in the ladder diagram or machine parameters, only technician or electrician for security purpose
    So when I tried to put the tool change on the same line, I've got "PS1091 duplicate sub-call word" alarm.
    When the tool is already in the spindle and if the tool is call again, it give "ALM81 ATC program error"
    Really often, we have to make restart in the program on different tools and that's why they skip the tool change with the check line (IF[#994EQ10]GOTO)....

    We have a programming dept. who's working with Catia V5 (where I take the GOTO exemple) for programming 5 axis part but I recently acquire BobCAD CAM to make simple part on that 5 axis machine.

    In BobCAD, I tried to edit the post like they do here with Catia to make it work but I'm stuck with the GOTO command to complete the line
    Here's the line in the BobCAD post :
    "IF[#"994""force_no_add_spaces"EQ"force_no_add_spaces, list_tool_number"]GOTO"

    I'm not an expert in macro or more complex programming code.... that's why I'm here asking for help



  5. #5
    Registered
    Join Date
    Oct 2016
    Posts
    19
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    The reason why there's two M1 in the exemple I gived is that there's a tool probing custom command line :

    (* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *)
    (LOAD TOOL NO: 10 DRILL .500)
    (* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *)
    N10 M5
    N12 M1
    N14 G54
    IF[#994EQ10]GOTO?
    N16 T10
    N18 M6
    N20 G65 P9904 Z8.A0 W0 U0 V0
    N22 M1
    N24 G40
    N26 S391 M3

    The reason is to skip the probing line (N20) if i do a restart with that tool



  6. #6
    Member
    Join Date
    Oct 2010
    Location
    Canada
    Posts
    134
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    When the tool is already in the spindle and if the tool is call again, it give "ALM81 ATC program error"
    I can't believe a tool change macro can't be made to avoid this alarm, that's ridiculous !!
    I saw that same problem on a milling with a yasnac control.
    Hope somebody can figure this out for you.



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

    Default Re: GOTO condition

    Some MTBs define a system variable for "tool in spindle." It is typically #1033/1034/1035.
    If available, a conditional statement can be used to determine if a particular tool is in the spindle.
    These variables can be checked by assigning to some variable, and then reading the value stored, e.g., #500 = #1035. MDI can be used.



  8. #8
    Registered
    Join Date
    Oct 2016
    Posts
    19
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    Here's the macros when i do a mdi tool change (T1;M6 :

    9000 (T-CALL MACRO)
    (#6001.5=1)
    T#149
    M99

    9026 (M6 CALL SERVO-ATC)
    (PRM6086=6)
    #3003=1
    G90 G53 Z0
    G90 G53 A0 Y0
    M6
    #990=#149
    M98 P9050
    G91
    G28 Z0
    G90 G53 X-20.
    G53 Y-20.
    M5
    #3003=0
    M99

    Maybe it could help



  9. #9
    Member
    Join Date
    Oct 2010
    Location
    Canada
    Posts
    134
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    I would try to add a check just before the first move in the program 9026 to skip tool change, jumping directly to M99 if the tool is already in the spindle.
    I assume that the program 9050 contains all the moves for the tool change! And as Sinha nsit just wrote, check for your variable for tool in the spindle (#1033,1034 ,1035) and
    then you'll be able to compare your calling tool # (probably variable #149) with the tool in the spindle.

    But be careful if you do changes, I'm just trying to give some hints, a lot of people here are better than me with this stuff so wait and ask if you're not sure before you do anything.



  10. #10
    Registered
    Join Date
    Oct 2016
    Posts
    19
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    A huge thanks to you guys for the help

    The fact is i can't really change or play with thoses tool change Macro in here

    We bought BobCAD CAM for simple 3-4 axis part recently and i was trying to adjust the Fanuc post tool change code to work like it work here in our programming department who's pgrogramming with Catia V5. Catia post generated the code line i want BobCAD to do.
    .
    If i take a Catia program, at each tool change, their post automatically generate the GOTO (line number) to jump to next M1 three lines lower to skip the automatic tool probing line.
    The only place in the BobCAD post that i'm stuck with is that GOTO line generated
    Maybe is more simple if i show you guys the BobCAD post

    n, spindle_off
    n,"M1"
    n,work_coord,
    "(TOOL #", list_tool_number, " " , tool_label, ")"
    n,"M5"
    n,"M1"
    n,work_coord,
    "IF[#"994""force_no_add_spaces"EQ"force_no_add_spaces, list_tool_number"]GOTO"
    n,t
    n,"M6"
    n,"G65P9904Z8.A0W.003U0V0" (Tool probing)
    n,"M1"
    n,"G40"
    n, work_coord
    n, s, spindle_on

    Tx again for the help



  11. #11
    Member
    Join Date
    Oct 2010
    Location
    Canada
    Posts
    134
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    And if you do this (in red), do you think the goto will always go forward ? If yes It would be a step forward for you, as long as the program has no more than 9999 lines !!

    n, spindle_off
    n,"M1"
    n,work_coord,
    "(TOOL #", list_tool_number, " " , tool_label, ")"
    n,"M5"
    n,"M1"
    n,work_coord,
    "IF[#994",force_no_add_spaces,"EQ",force_no_add_spaces ,list_tool_number"]GOTO9999"
    n,t
    n,"M6"
    n,"G65P9904Z8.A0W.003U0V0" (Tool probing)
    "N9999"
    n,"M1"
    n,"G40"
    n, work_coord
    n, s, spindle_on



  12. #12
    Registered
    Join Date
    Oct 2016
    Posts
    19
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    The GOTO9999 like is exactly what i had in mind for my Plan-B but i was not sure if the line search was always forward

    I'll give a try with that option

    Tx a lot for the help.....really appreciated



  13. #13
    Member
    Join Date
    Jul 2010
    Location
    South Africa
    Posts
    118
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    Hi,

    Please find the answer to your 1st mail below;
    GOTO[#4314+3]

    some info;
    then program 9000, T-code call,
    i don't see the practical advantage as the file does nothing extra than a normal T-code would, sending the number to pmc.
    if the mtb made this function, then leave it there.

    but because this function is activated, the following rule would apply,
    T10M6, will call program 9000
    here M6 becomes #13=6
    as #13 is not processed on 9000, so the M is meaningless?

    M6T10, will call your program 9026
    here T10 becomes #20=10
    as #20 is not processed on 9026, so the T is meaningless.

    as it is unclear the action of M6 in 9026 + the workings of 9050, therefor more detailed info is not possible.

    it is very unusual for a mtb to leave a toolchange macro with faults on a machine.

    have fun.

    Norbert



  14. #14
    Registered
    Join Date
    Oct 2016
    Posts
    19
    Downloads
    0
    Uploads
    0

    Default Re: GOTO condition

    I'm agree with you Norbert that thoses Macro are not well done and have somes meaningless code
    The CNC machines in here and thoses T-changer Macro weres modify like that ... like 20 years ago
    Hope someone else than me will tell them to re-work that Macro



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

GOTO condition

GOTO condition