Page 1 of 2 12 LastLast
Results 1 to 12 of 15

Thread: Example of a Subroutine?

  1. #1
    Registered
    Join Date
    Oct 2006
    Location
    USA
    Posts
    137
    Downloads
    0
    Uploads
    0

    Example of a Subroutine?

    Can someone post an example of a tested and working program, for CNC88 that is using subroutines? I am trying to debug a post processor and although my output looks almost identical to the book example the machine does not like it. I'm hoping I can put the program in the control and see if it runs and then I can back track and figure out why mine isn't working.

    Thanks,
    Don


  2. #2
    Registered
    Join Date
    Feb 2007
    Location
    usa
    Posts
    36
    Downloads
    0
    Uploads
    0
    what doesn't the machine like about your sub routine?


  3. #3
    Registered
    Join Date
    Feb 2007
    Location
    USA
    Posts
    21
    Downloads
    0
    Uploads
    0
    Can you post your program here so we can see what you are doing?
    Jeff


  4. #4
    Registered
    Join Date
    Oct 2006
    Location
    USA
    Posts
    137
    Downloads
    0
    Uploads
    0
    Attached is an example program that as far as I can tell, according to the manual, should work. My control chokes on it though. Any help would be appreciated.

    Thanks,
    Don
    Attached Files Attached Files


  • #5
    Registered carbidecraters's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1,043
    Downloads
    0
    Uploads
    0
    N1o100 (baseplate.nc)
    N2g90g80g40g17g0
    N3(job 3 Cbor Hole Random Point Pattern)
    N4(tool #1 0.2500 Center Drill)
    N5m6t1
    N6m3s500
    N7g0g54x.8049y-7.3042
    N8g0h1z.1
    N9/m8
    N10g81g99x.8049y-7.3042z-.08r.1f5.99
    N11l0501
    N12g80
    N13m9
    N14g0z0h0
    N15m5
    N16(job 3 Cbor Hole Random Point Pattern)
    N17(tool #2 0.2500 Drill)
    N18g0g90m6t2
    N19m3s2505
    N20g0g54x.8049y-7.3042
    N21g0h2z.1
    N22/m8
    N23g81g99x.8049y-7.3042z-.6751r.1f20.05
    N24l0501
    N25g80
    N26m9
    N27g0z0h0
    N28m5
    N29(job 3 Cbor Hole Random Point Pattern)
    N30(tool #3 0.4375 Counter Bore)
    N31g0g90m6t3
    N32m3s1004
    N33g0g54x.8049y-7.3042
    N34g0h3z.1
    N35/m8
    N36g81g99x.8049y-7.3042z-.26r.1f6.02
    N37l0501
    N38g80
    N39m9
    N40g0z0h0
    N41m5
    N42(job 3 Cbor Hole Random Point Pattern)
    N43(tool #4 0.6250 Chamfer Tool)
    N44g0g90m6t4
    N45m3s702
    N46g0g54x.8049y-7.3042
    N47g0h4z.1
    N48/m8
    N49g81g99x.8049y-7.3042z-.1813r.1f8.43
    N50l0501
    N51g80
    N52m9
    N53g0m7m5
    N54m02
    N55l0500
    N56x.8049y-7.3042
    N57x3.3046
    N58x5.8048y-7.3044
    N59x8.3045
    N60x.8048y-4.6393
    N61x.8049y-3.9472
    N62x3.3046
    N63y-4.6391
    N64x4.1957y-4.2892
    N65x5.1954y-4.289
    N66x5.8049y-3.9472
    N67x5.8048y-4.6393
    N68x8.3046y-4.6391
    N69x8.3045y-3.9474
    N70x9.1958y-4.289
    N71x10.1954
    N72y-.6955
    N73x9.1957y-.6957
    N74x8.3046y-1.0457
    N75x5.8049
    N76x5.1954y-.6957
    N77x4.1958y-.6955
    N78x3.3045y-1.0459
    N79x.8049y-1.0457
    N80m30
    %


    Ya!


  • #6
    Registered carbidecraters's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1,043
    Downloads
    0
    Uploads
    0
    You didnt define the beginning of your subroutine


  • #7
    Registered carbidecraters's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1,043
    Downloads
    0
    Uploads
    0
    Code:
    N1o100 (baseplate.nc)
    N2g90g80g40g17g0
    N3(job 3 Cbor Hole Random Point Pattern)
    N4(tool #1 0.2500 Center Drill)
    N5m6t1
    N6m3s500
    N7g0g54x.8049y-7.3042
    N8g0h1z.1
    N9/m8
    N10g81g99x.8049y-7.3042z-.08r.1f5.99
    N11l0501
    Basically you are calling subroutine #5 one time and you havent defined where subroutine 5 is. And where is you M17 at the end of your subroutine.

    Your program might look like this if I am not mistaken



    First avoid tool changes in subroutines

    Code:
    (job 3 Cbor Hole Random Point Pattern)
    (tool #1 0.2500 Center Drill)
    L0500
    g0g54x.8049y-7.3042
    g0h1z.1
    /m8
    g81g99x.8049y-7.3042z-.08r.1f5.99
    M17
    g90g80g40g17g0
    m6t1
    N6m3s500
    N11l0501


  • #8
    Registered carbidecraters's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1,043
    Downloads
    0
    Uploads
    0
    Or even cleaner because you are basically making one move in your subroutine

    Code:
    (job 3 Cbor Hole Random Point Pattern)
    (tool #1 0.2500 Center Drill)
    L0500
    g81g99x.8049y-7.3042z-.08r.1f5.99
    M17
    g90g80g40g17g0
    m6t1
    N6m3s500
    g0g54x.8049y-7.3042
    g0h1z.1
    /m8
    L0501


  • #9
    Registered carbidecraters's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1,043
    Downloads
    0
    Uploads
    0
    Ok so lets complete the mess



    L0500
    g81g99x.8049y-7.3042z-.08r.1f5.99
    M17
    g90g80g40g17g0
    (job 3 Cbor Hole Random Point Pattern)
    (tool #1 0.2500 Center Drill)
    m6t1
    N6m3s500
    g0g54x.8049y-7.3042
    g0h1z.1M8
    L0501
    (job 3 Cbor Hole Random Point Pattern)
    (tool #2 0.2500 Drill)
    M6t2
    M3S2505
    g0g54x.8049y-7.3042
    g0h2z.1M8
    L0501
    (job 3 Cbor Hole Random Point Pattern)
    (tool #3 0.4375 Counter Bore)
    M6T3
    M3S1004
    g0g54x.8049y-7.3042
    g0h3z.1M8
    L0501
    (job 3 Cbor Hole Random Point Pattern)
    (tool #4 0.6250 Chamfer Tool)
    M6T4
    M3S704
    g0g54x.8049y-7.3042
    g0h4z.1M8
    L0501


    Its late here so I may be wrong but thats how it comes out for format 2 if I am not mistaken


  • #10
    Registered
    Join Date
    Dec 2005
    Location
    USA
    Posts
    86
    Downloads
    0
    Uploads
    0
    No M30 to end the subroutine section? or is that old school fadal?


  • #11
    Registered cadman's Avatar
    Join Date
    Jun 2003
    Location
    USA
    Posts
    513
    Downloads
    0
    Uploads
    0
    Place subroutines at the top of the program.

    Begin with L word: Lxxxx
    end with M17.

    Separate subroutine from main with M30.

    My example is posted with one of my Format 2 posts.
    Attached Files Attached Files


  • #12
    Registered
    Join Date
    Oct 2006
    Location
    USA
    Posts
    137
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by cadman View Post
    Place subroutines at the top of the program.

    Begin with L word: Lxxxx
    end with M17.

    Separate subroutine from main with M30.

    My example is posted with one of my Format 2 posts.
    CadMan,

    Thanks a million. I thought I had done exactly what you posted, but I put your post in the mill and it took right off. So I modified my post and it worked as well. I'm not sure what I missed the first time. I did try putting the Subroutine at the top of the program once before, so I guess I had missed something else.

    Thanks Again,
    Don


  • Page 1 of 2 12 LastLast

    Similar Threads

    1. Eia subprogram in mazatrol
      By magneto259 in forum Mazak, Mitsubishi, Mazatrol
      Replies: 3
      Last Post: 04-10-2007, 11:19 AM
    2. having trouble with subprogram
      By dshowald in forum Milltronics
      Replies: 10
      Last Post: 02-10-2007, 03:32 PM
    3. Restarting an EIA subprogram
      By ajl6549 in forum Mazak, Mitsubishi, Mazatrol
      Replies: 6
      Last Post: 08-09-2006, 07:06 AM
    4. Fanuc 16T subprogram example??
      By stex in forum Fanuc
      Replies: 11
      Last Post: 03-27-2006, 03:15 PM
    5. Mazatrol subprogram
      By BeanO in forum Mazak, Mitsubishi, Mazatrol
      Replies: 5
      Last Post: 11-24-2005, 04:12 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.