587,997 active members*
2,664 visitors online*
Register for free
Login
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2005
    Posts
    53

    Help Making Sub Routines

    Could someone please give me an example of using an M98 or, M99 coupled with a "P" and "L". Just a short example would do - like profiling a rectangle and using a subroutine to step the cutter down -ie. "rough depths". Another example I am looking for is to use a subroutine to drill a series of holes. My control supports the RS 274 format. Any help would be appriciated.....
    Patrick

  2. #2
    Join Date
    Mar 2004
    Posts
    1543
    Below are some examples:

    (Call a simple subroutine and repeat the subroutine 3 times.)
    N1 G0 X0 Y0 Z0
    N2 M98 P1234 L3
    N3 M30
    O1234
    N4 G1 Z-.5 F25
    N5 G0 Z.1
    N6 M99

    (Use a subroutine to loop the entire program 100 times.)
    N1 M98 P1234 L100
    N2 M30
    O1234
    N4 G0 X0 Y0 Z0
    N5 G1 Z-.5 F25
    N6 G0 Z.1
    N7 M99

    (Nested subroutines)
    N1 G0 X0 Y0 Z0
    N2 M98 P1234 L1
    N3 M30
    O1234
    N4 G0 X1 Y1 Z1
    N5 M98 P5678 L1
    N6 M99
    O5678
    N7 G1 Z-.5 F25
    N8 G0 Z.1
    N9 M99

    Karl

  3. #3
    Join Date
    Jun 2005
    Posts
    53
    Karl,
    Thank you for the quick response and the clear-cut reply. Now if I may ask one more question? Can I switch into G91 programing from G90 programing in order to get the "stepping" effect. If so how would the code look. By the way I made a mistake my manual lists M79 (Send SWI '0' (ascii 79) commands ,value in "P" WORD) . Also it lists M98 as Subroutine call to block (PWORD), repeat (LWORD). Thank you for any help....
    Patrick

  4. #4
    Join Date
    Mar 2005
    Posts
    60
    The example given did not specify a work coordinate system eg. G54, 55 etc. therefore the code would look the same for G91 (incremental).The only thing that changes between G90 and G91 programs are the X,Y and Z values.

  5. #5
    Join Date
    Mar 2004
    Posts
    1543
    Here's a program to cut holes in a piece of 6" wide stock to hold R8 tooling. Makes use of switching from G90 to G91 and back.


    :Cut holes in 6" channel for R8 holders

    (*BLEC'*',CMST';',CNDL3,CNDR4,ZRSP0,PDOF0.05,FDOV0 *)

    %count = 0 *;counter for looping

    ; Circle - Coordinate Start Point Type
    G90 G40 F2.0 *; ABSOLUTE,NO CUTTER COMP, FEED RATE
    T01 *; TOOL 1

    %LOOP: *;loop to here
    %count = %count + 1



    G73 Y 1.0 Z-0.50 Q 0.060 F 2.0 *; DRILL HOLE AT 0,1
    G00 Z -0.5 *; BACK TO BOTTOM OF HOLE
    G01 G91 G42 T 01 X0.0 Y0.485 *; INCREMENTAL,CUTTER COMP RIGHT,TOP OF CIRCLE
    G02 X0.0 Y 0.0 I 0.0 J -0.485 F 4.0 *;CIRCLE, change radius line up also for new size
    G90 G40 G00 Z0.0 *;ABSOLUTE,,NO CC,RAPID UP

    G73 Y 3.0 Z-0.50 Q 0.060 F 2.0 *; DRILL HOLE AT 0,1
    G00 Z -0.5 *; BACK TO BOTTOM OF HOLE
    G01 G91 G42 T 01 X0.0 Y0.485 *; INCREMENTAL,CUTTER COMP RIGHT,TOP OF CIRCLE
    G02 X0.0 Y 0.0 I 0.0 J -0.485 F 4.0 *;CIRCLE, change radius line up also for new size
    G90 G40 G00 Z0.0 *;ABSOLUTE,,NO CC,RAPID UP

    G73 Y 5.0 Z-0.50 Q 0.060 F 2.0 *; DRILL HOLE AT 0,1
    G00 Z -0.5 *; BACK TO BOTTOM OF HOLE
    G01 G91 G42 T 01 X0.0 Y0.485 *; INCREMENTAL,CUTTER COMP RIGHT,TOP OF CIRCLE
    G02 X0.0 Y 0.0 I 0.0 J -0.485 F 4.0 *;CIRCLE, change radius line up also for new size
    G90 G40 G00 Z0.0 *;ABSOLUTE,,NO CC,RAPID UP

    G00 Y0.0 *;BACK TO HOME
    G91 G00 X2.0 *;INCREMENTAL, MOVE 2.0 FOR NEXT ROW OF HOLES


    IF (%COUNT LE 10) GOTO %LOOP *;LOOP 10 TIMES

  6. #6
    Join Date
    Jun 2005
    Posts
    53
    Thank you Karl for the great example. A long time ago (8 years) I was starting to get into the groove of programing a Sharnoa machining center with parametric programing but, I quit that job for a better one and since then have forgotten alot. The Prototrak I use (DPM V5) is quite honestly a pleasure to use everyday. It can be programed with Gcodes in addition to conversational programing. When I have a very complex job I use OneCnc Expert and havnt had any problems. I would like to increase my skills in manual Gcode programing ,however, and that is why I am asking these questions. The machine doesnt have work offsets on the Gcode side- It does have 6 of them on the conversational side though. Anyway thanks again.....
    Patrick

  7. #7
    Join Date
    Jun 2005
    Posts
    53

    Is this okay?

    I have been busy this week and my machine has been tied up so I havnt gotten a chance to try out a test subroutine. I have made one and hopefully have attached it correctly. Did I make the subroutine correctly? My objective is to edit cam programs so that I only have to program a profile or, a pocket level "once" then use subroutines to "step down" the depths. I have another question not related to subroutines. Can I program a helix to ramp a tool down in a pocket and then connect it to the pockets first G01 move so that the tool stays "down".....
    Patrick

  8. #8
    Join Date
    Jan 2008
    Posts
    65

    step down

    #100=1. (Full Depth)
    #101=.25 (Depth Increment)
    #102=0

    N1
    #102=[#102+#101}
    IF[#102GE#100]THEN[#102=#100]
    G01 Z-#102 F1.

    *****CUT POCKET OR PROFILE********

    G0 Z.1
    IF[#102NE#100]GOTO1


    I think this would work in Macro B.

Similar Threads

  1. Making money with CNC
    By Johnuk in forum Community Club House
    Replies: 26
    Last Post: 12-13-2009, 05:46 PM
  2. Mold making with Deskcam
    By Jon D in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 2
    Last Post: 02-08-2007, 10:41 PM
  3. What are people making with there cnc plasma tables?
    By Apples in forum Waterjet General Topics
    Replies: 9
    Last Post: 01-10-2007, 02:57 AM
  4. Pictorial Guide to Making PCB (DIY)
    By abasir in forum CNC Machine Related Electronics
    Replies: 31
    Last Post: 08-18-2005, 05:14 AM
  5. Anyone Know a know of a good book for mill, tool making?
    By sendkeys in forum MetalWork Discussion
    Replies: 6
    Last Post: 11-02-2004, 04:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •