584,830 active members*
5,698 visitors online*
Register for free
Login
Page 1 of 2 12
Results 1 to 20 of 31
  1. #1
    Join Date
    Feb 2008
    Posts
    15

    help with sub-routine programing

    Hi All,

    I have a Supermax max5 VMC and I would like to run multiple cycles without the tool being taken out after each M02 or each M30. I assume I need to use a subroutine to do this but do not understand how to do this? I got this machine used and did not get a user manual with it, help please !

    regards, John S. Wracher
    Accra machine shop, Inc.

  2. #2
    Join Date
    Feb 2007
    Posts
    314
    what is your control? and what do you mean by "the tool being taken out after each M02 or each M30".

    Do you want to keep spindle running between each cycle?

  3. #3
    Join Date
    Aug 2007
    Posts
    339
    It depends a lot on your control as to the format for calling up and running a sub routine.
    On a Fanuc control you would have your subprogram numbered like O2300, and your main program like O230.
    In your main program when you want to run your sub routine you call up your sub by inserting an M98P02300, at the end of your sub you need the line M99 instead of the normal M02 or M30 so it knows to jump back into the main program where it left off. That's it in a nutshell. Very simple to impliment so long as you know the format required of your machining center.
    We all live in Tents! Some live in content others live in discontent.

  4. #4
    Join Date
    Feb 2009
    Posts
    64

    Cycles

    What kind of cycles are you running? Trying to get a visual of what you want to do. You don't necessarily have to end a program with an m2 or m30 unless you want it to rewind. You could even use a 'GOTO' line at the bottom of your cycle with a line number reference if your machine supports this feature. I might have something like this:

    N5000 M0; (I'd want an opportunity to pause the cycle before restarting it so M0 is used)
    ......
    ......
    cycle;
    .....
    GOTO 5000; (you might include a block delete feature here if you want to stop the cycles)

    It's a little sloppy, but it would allow you to bypass an end program/rewind statement and you could stop it all by hitting 'Reset' or turning 'Block Delete' on.

  5. #5
    Join Date
    Feb 2008
    Posts
    15
    Thank you all for the quick responses, I can see I forgot to include some pertinant information so here goes. I am running a Fanuc control o-m control on a Supermax max5 VMC. What I meant by not takeing the tool out every time is let's say I have an air vise set on the table, I am going to drill 2 holes and then have the machine returne to a home position and stop while I put another piece in the vise and then hit the cycle start button again. The way this machine works it will not start another cycle with a tool in the spindle, so I am forced to remove the tool at the end of the program cycle. You can see what I wast of time and wear and tear on the machine if you were cycling many thousands of cycles. Thank you for your time, I will look for your reply.

    regards, John S. Wracher
    Accra Machine Shop, inc.

  6. #6
    Join Date
    Feb 2006
    Posts
    338
    A simple way to do this is a M0 at the end of the program followed by GOTO 10 (beginning of the tool)

    Be sure to check that you turn off coolant, and the spindle ect. as well as start/set everything back up correctly inside your loop.

    On another note, the requirement to have the spindle empty to start seems a bit odd. Perhaps you can talk to the machine tool builder to find out how to change that. There is a pretty good chance the fix is small and relatively painless.

  7. #7
    Join Date
    Dec 2008
    Posts
    3110
    Best method is to have the progam operate as you would normally have it run
    ie
    1-> header
    2-> select the tool
    3-> body of the program
    4-> return the tool

    What you want is to continually cycle #3
    Code:
    ...
    N19 T2M6
    /N20 M0
    N21 S-- M3 
    M8
    ....
    N200 M9
    N201 M5
    N202 G91 G28 Z0
    /N203 G0T0 N20
    N204 T0 M6
    N205 M30
    %
    Block skip ON = program runs thru to the end normally
    Block skip OFF = prog. will load tool, stop on M0, run to GOTO command, jump back to M0 and stop. Turn the block skip ON when in the program body, it will then run thru to the end as normal.

    If you have more than one tool in the program put the M0 and jump to spot before the first toolchange

  8. #8
    Join Date
    Jun 2009
    Posts
    28
    Wouldn't it just be easier to replace the m30 or m02 with m99 and put an m00 on the line before it? Or have I missed something?

  9. #9
    Join Date
    May 2007
    Posts
    1003
    Quote Originally Posted by Jawbreaker38 View Post
    Wouldn't it just be easier to replace the m30 or m02 with m99 and put an m00 on the line before it? Or have I missed something?

    That's exactly how you could do it on a lathe. Of course a lathe wouldn't be causing his problem. An M02 or M30 would work fine. Never programming for a mill, I haven't a clue. My only question about using the M99 would be "How would the machine react when it sees the T2M6 block." I don't know, but wouldn't mind knowing.

    Maybe some others could clarify the point for me. Not that I will ever get the opportunity to put that knowledge to work.

  10. #10
    Join Date
    Oct 2005
    Posts
    672
    I have a mill part I run for a customer with an 11 second cycle time. Code is essentially:

    G0 G40 G90
    M0
    T1
    S3500 M8
    G0 Xx Yy M3
    G0 G43 H1 Z.025
    ....
    M9
    G0 Z5.
    G28 Y0.
    M99
    M30

    The first part requires pressing the Cycle Start button twice, but then each subsequent part only requires one Cycle Start. Spindle remains spinning while running through all the parts in the job. By eliminating the spindle start/stop, the cycle is much quicker.

    This is on a VMC with a Mitsubishi M3 control.

  11. #11
    Join Date
    May 2007
    Posts
    1003
    Quote Originally Posted by Caprirs View Post
    I have a mill part I run for a customer with an 11 second cycle time. Code is essentially:

    G0 G40 G90
    M0
    T1
    S3500 M8
    G0 Xx Yy M3
    G0 G43 H1 Z.025
    ....
    M9
    G0 Z5.
    G28 Y0.
    M99
    M30

    The first part requires pressing the Cycle Start button twice, but then each subsequent part only requires one Cycle Start. Spindle remains spinning while running through all the parts in the job. By eliminating the spindle start/stop, the cycle is much quicker.

    This is on a VMC with a Mitsubishi M3 control.


    I gather from your example that if the OP takes out the M6 then he should have no problem either.

  12. #12
    Join Date
    Feb 2008
    Posts
    15
    Let me try to explain this better. The program cycle will not run if there is a tool in the spindle before it is started. So after the program ends the tool needs to be taken out befor the program will run again. Thank you all who have responded.

    regards, John S. Wracher

  13. #13
    Join Date
    Oct 2005
    Posts
    672
    My machines do not require using the M6. Calling the Tt runs the tool changer as this has an umbrella type, not swing arm ATC. M6 is redundant if the machine cannot pre-load from the magazine.

    By having the M99, the program never ends. As far as the control knows, it is forever running the program and you only entered an M0 to change clamps or clear chips.

    A modified version using a GOTO can eliminate the control seeing the tool call line more than the first time.

    G0 G40 G90
    T1
    N1000
    M0
    S3500 M8
    G0 Xx Yy M3
    G0 G43 H1 Z.025
    ....
    M9
    G0 Z5.
    G28 Y0.
    GOTO1000
    M30

    Again, my machines are Mitsubishi control so format may be different. This leaves the spindle running which may or may not be safe for your application. Likely not OSHA approved method.

    I am confused why your machine will not cycle with the tool already in the spindle. That is something I've never encountered before. Have you contacted the builder to see if there is a parameter that is set incorrectly or you have the wrong tool change macro?

  14. #14
    Join Date
    Feb 2008
    Posts
    15
    Yes I am going to contact the machine builder to see if I can maybe change a parameter that would leave the tool in and recycle. Also I tried the G0T0 trick today but apparently my control does not like it. It gave me an error. Thanks for your reply.

    regards, John S. Wracher

  15. #15
    Join Date
    Oct 2005
    Posts
    672
    Without attempting to be insulting, are you using "GOTO" or "G0T0"? All letters, no number zeros.

  16. #16
    Join Date
    Jun 2009
    Posts
    28
    Quote Originally Posted by Caprirs View Post
    Without attempting to be insulting, are you using "GOTO" or "G0T0"? All letters, no number zeros.

    I tried this in a different application today on a lathe, but it wouldn't post it as mentioned. It tried to enter it as an invalid tool number. I run numerous parts in the same family and would like to use this feature as described, I get tired of adding the block skips on each line. I really want to use this, any advice?

  17. #17
    Join Date
    Feb 2008
    Posts
    15
    No I must confess I used zeroes instead of letter o. I will try this again, Thank you for the sugestion.

    regards, John S. Wracher

  18. #18
    Join Date
    Feb 2009
    Posts
    64
    Using an actual sub-program may be the best bet if 'GOTO' is giving trouble.

    For this one, you say that you want to drill a cpl holes in multiple parts without changing the tool. I would set it up like this :

    O11111 (MAIN PROGRAM)
    T1 M6;
    G00 G54 G90 X0. Y0. S1000 M3;
    G43 H1 Z.25 M8;
    /M0;
    /M98 P2222 L99 (PICK ANY NUMBER LARGE ENOUGH TO COVER ALL PARTS);
    G49 Z0. M9;
    G28;
    M30;



    O2222 (SUB-ROUTINE)
    M0;
    G81 ......... (WHATEVER DRILL ROUTINE);
    G80;
    M99;

    This uses the 'Block Skip' feature to allow you to recycle the sub-routine indefinitely. Just turn block skip on when you want it to stop.

  19. #19
    Join Date
    Feb 2008
    Posts
    15
    Hi All,
    I realy appreciate all the help with the sub-routine programming, but now I am having an even bigger problem trying to understand the tool changer on this machine. The machine is a Supermax max5 VMC with a Fanuc O-M control and the tool changer is the belt style. I was told to load tools into the changer and to initialize them to the control you have to first, push T#,input,cycle start then m6,input,cycle start then load that tool manually into the spindle and then perform the same opperation again for the next tool. The first tool is then loaded into the magazine with each successive load. The machine does not seem to remember the proper tool numbers with this routine. And yes I did try starting with an M19 as somebody recomended earlier. Any help would be a real blessing.

    regards, John S. Wracher

  20. #20
    Join Date
    Dec 2008
    Posts
    3110
    Quote Originally Posted by accramachine View Post
    I was told to load tools into the changer and to initialize them to the control you have to first, push T#,input,cycle start then m6,input,cycle start then load that tool manually into the spindle and then perform the same opperation again for the next tool. The first tool is then loaded into the magazine with each successive load. The machine does not seem to remember the proper tool numbers with this routine. And yes I did try starting with an M19 as somebody recomended earlier.
    M19 is spindle orientate, this rotates the spindle and locks it aligning the drive keys to suit the toolchange arm and carousel ( chain or umbrella styles). It is a hidden command inside a M6 ( toolchange cycle )

    Txx is to pre-select or pre-stage the tool ready for toolchanging
    M6 is the actual toolchange cycle, if no tool is pre-staged most machines will error.
    This can be shortened to Txx M6, then cycle start

    The routine that you are instructed to use is a safe method of loading the tools into the machine, the machine will remember what "pot" it has placed that tool.
    There is nothing worse than calling up a drill cycle and expecting a drill when there is a face mill in the spindle

Page 1 of 2 12

Similar Threads

  1. Sub Routine
    By ynnek in forum Uncategorised CAM Discussion
    Replies: 1
    Last Post: 09-18-2009, 01:01 PM
  2. adding loop sub routine
    By wronggrade in forum Mastercam
    Replies: 3
    Last Post: 04-21-2008, 07:25 PM
  3. ez track V6. pocket routine
    By guy-b in forum Bridgeport / Hardinge Mills
    Replies: 5
    Last Post: 08-03-2006, 01:09 AM
  4. Activating HPCC in a sub-routine?
    By Dawson in forum Daewoo/Doosan
    Replies: 0
    Last Post: 03-18-2006, 09:04 PM
  5. 3D surface sub-routine
    By lazza in forum G-Code Programing
    Replies: 2
    Last Post: 08-30-2005, 02:58 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
  •