Results 1 to 8 of 8

Thread: Custom Macro B

  1. #1
    Registered
    Join Date
    Oct 2005
    Location
    usa
    Posts
    2
    Downloads
    0
    Uploads
    0

    Custom Macro B

    I would like to create a program for a pallet change. All of it I can do except change the main program to match the pallet number.I see that #4115 = the program number but I can only read it( and pass to a variable). Is there a way to call up a program to a pallet without putting it in a sub? Fadal has what I need... I believe it was something like #STARTprog# but what I need is for Fanuc custom macro B.Thanks


  2. #2
    Registered
    Join Date
    Jun 2010
    Location
    USA
    Posts
    12
    Downloads
    0
    Uploads
    0
    Variable #4115 is the last O number read by the control so it contains the current program number.

    I believe that the Fanuc control will run a M98 P#4115 but that would just send your program to the top of the current program sort of like a M99 if there is just one program ( no sub program ).

    You could use the #4115 and a math statement to run a certain program.
    M98 P[#4115+1] ( O number plus one )

    Or you could do an IF statement.
    IF[#4115 EQ 100] GOTO100 ( IF IN PROG O100 JUMP TO N100 )
    IF[#4115 EQ 200] GOTO200 ( IF IN PROG O200 JUMP TO N200 )
    N100
    M98 P101 ( RUN PROGRAM O101 )
    GOTO999 ( JUMP TO N999 )
    N200
    M98 P201 ( RUN PROGRAM O101 )
    GOTO999 ( JUMP TO N999 )
    N999 ( END PROGRAM )
    M30
    This could be a generic section of program you put in all your programs but it would probably be easer to just figure out where you want to go in a particular program and program a GOTO command.

    Just some ideas. Hope this helps.

    Best regards.

    Mike


  3. #3
    Registered
    Join Date
    Feb 2006
    Location
    india
    Posts
    1275
    Downloads
    0
    Uploads
    0
    Let us say you have 10 pallets and 10 programs for them. If you do not want to use subprograms, all the 10 programs would need to be included in the main program. You would need to enter pallet number in the beginning of the program, and the program would jump to appropriate blocks depending on this value. Something like this:

    #1 = <enter pallet number>;
    IF [#1 EQ 1] GOTO 100;
    IF [#1 EQ 2] GOTO 200;
    IF [#1 EQ 3] GOTO 300;

    ...

    N100 ;
    <machining program for pallet number 1>
    GOTO 999;
    N200 ;
    <machining program for pallet number 2>
    GOTO 999;

    ...

    N999 M30;


  4. #4
    Registered
    Join Date
    Jun 2008
    Location
    United States
    Posts
    1509
    Downloads
    0
    Uploads
    0
    When it comes to macros there are so many different ways of going about it and it will be decided by preference and what your operator’s capability is.

    All the ways suggested above will work.

    If I am understanding what you are wanting to do with the limited info we have is setup a custom M or G code or subprogram call to call the pallet change program in your main program but when it is finished changing pallets you want your main program to know which pallet is in the machine?

    Well it will depend if you have a system variable to track the current pallet in the machine that would be ideal. If not you can set up a variable to do so. How many pallets do you have?

    I would go about it in this way. If you have a system variable that tracks the current pallet then I would set up a custom M-code for a pallet change say M60. Now let’s say #1010 is the system variable that tracks the current pallet. Your M60 is going to call program 9020 to change pallets. Your main program is 1 and your subprogram for machining of pallet 1 is 1001 and your subprogram for machining of pallet 2 is 1002. These program numbers can be changed to suite what you want, I was just using them as reference.

    O0001(main program)

    M60
    M98P#501
    M30

    O9020(pallet change program)

    …(pallet change sequence)
    #500=#1010
    #501=#500+1000
    M99

    Now you will have to make sure that you are not using the #500 and #501 for anything else. If so we can make them different variables.

    All of the stuff above has only been rambled and typed up in the last 5 minutes. I had no time to proof read or try so take it with a grain of salt.

    Stevo


  • #5
    Registered christinandavid's Avatar
    Join Date
    Aug 2009
    Location
    New Zealand
    Posts
    660
    Downloads
    0
    Uploads
    0
    The method that has evolved on our twin pallet machine is to allocate extended work offsets P1-24 to pallet 1, and P25-47 to pallet 2.

    The main program first calls a standard sub program we always use to define the current Tool/Work Offsets in use.

    It then calls an offset rotation macro (at every N number), which loads the relevant pallet if necessary, before rotating B, setting the running offset as P48 and returning to the main program. We have set a custom G-code to call this, which keeps it all tidy.

    We use the status of the proximity switches to determine position of pallets.

    DP


  • #6
    Registered
    Join Date
    Oct 2005
    Location
    usa
    Posts
    2
    Downloads
    0
    Uploads
    0
    Stevo
    That is exactly what I want. Your ref to the m codes and bit calls are what I have on this machine (#1010= pallet 1 #1011= pallet 2 ) I've done similar to what is mentioned above. I didn't want to put it in a sub if the the operator hits reset and when they try to restart a potential crash will happen.On the Fadal I ran it had the #start that would change the main program.I was just curious to see if Fanuc had something similar couldn't find anything in the manual.Ran out of time today but was going to see if I called a sub up and put an M30 at the top to see if it would force it to stay at that program.We have around 75 entry level operators and 4 setup guys trying to help them out as much as possible.


  • #7
    Registered
    Join Date
    Jun 2008
    Location
    United States
    Posts
    1509
    Downloads
    0
    Uploads
    0
    What do you mean if you hit rest they could crash on startup? Going by program 1 it will always call the proper program for the proper pallet in the machine.

    Now if you are talking about starting at a specific area in a program based on having to stop the process mid cycle then I would not trust anything other than actually resetting to the beginning of the main program. A few options with this would be to have a starting sequence for the pallet number and the operation you want to jump to. I have done this in a few processes. However my consisted of about 30 macros with 20 tools all running together on complex parts. Just a matter of plugging in the 6 digit code for where you wanted to start.

    You would make a laminated sheet that has a number the correlates to the operation and the pallet number. Say pallet 1 operation 30 so at the beginning of the main program you would have a variable like #1=130. Now with a bunch of calculations you can verify pallet, operation, tools, positions, etc it would go to that operation and run.

    There are so many different ways of doing this when it comes to macros. My job is to always find the best way along with the most error proof way. I write all my calculations with the question in my head “what if the operator does this”. You have to account for every scenario.

    I may be reading a bit more into what you are looking for but if you tell me step by step what you’re looking to do and why I can lend a better hand. Do you want all of your machining in a main program? What kind of restart options are you looking for? etc, etc.

    Stevo


  • #8
    Registered
    Join Date
    Feb 2006
    Location
    United States
    Posts
    297
    Downloads
    0
    Uploads
    0
    Personally our 2 pallet setup is a standard main program that does the pallet checks and calls the "normal" part programs needed on that pallet.

    very simple sudo code outline to show the idea:
    Code:
    O0001 (main program)
    #101 = 1234 (first program on pallet 1)
    #102 = 0 (second program on pallet 1)
    #103 = 0 (third program on pallet 1)
    
    #201 = 3422 (first program on pallet 2)
    #202 = 2515 (second program on pallet 2)
    #203 = 0 (third program on pallet 2)
    
    if [#501=2] goto 200 (manually set 501 to start on pallet 2)
    
    (Pallet 1 check)
    (skip any that are =0)
    call #101
    call #102
    call #103
    
    (Pallet change to 2)
    M90
    N200
    (Pallet 2 check)
    (skip any that are =0)
    call #201
    call #202
    call #203
    
    (Pallet change to 1)
    M90
    M99


  • Similar Threads

    1. Custom Macro?
      By cncwhiz in forum Fanuc
      Replies: 9
      Last Post: 06-23-2010, 11:11 PM
    2. "difference between Custom Macro A and Custom Macro B"
      By arulthambi in forum Parametric Programing
      Replies: 4
      Last Post: 10-05-2009, 04:34 PM
    3. Custom macro!!!!
      By chrisryn in forum G-Code Programing
      Replies: 4
      Last Post: 05-27-2008, 11:13 PM
    4. Custom Macro B On A 18t.
      By JIMMYZ in forum Fanuc
      Replies: 3
      Last Post: 10-18-2006, 11:08 PM
    5. custom macro
      By The Metal in forum Daewoo/Doosan
      Replies: 2
      Last Post: 09-28-2006, 08:26 AM

    Posting Permissions



    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.