Need help with proper code for subrtoutine


Results 1 to 3 of 3

Thread: Need help with proper code for subrtoutine

  1. #1
    Member
    Join Date
    May 2009
    Location
    United States
    Posts
    98
    Downloads
    0
    Uploads
    0

    Default Need help with proper code for subrtoutine

    Hi All,
    I have not been able to find an example of a subroutilne in Kmotion with the use of what I know of as L -( run this many times). Can you tell me what needs to be different in these main and sub programs that won't run?
    Thanks,
    Scott

    Similar Threads:
    Attached Thumbnails Attached Thumbnails Need help with proper code for subrtoutine-errant-sub-call-png   Need help with proper code for subrtoutine-errant-surfacing-program-jpg  


  2. #2
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Need help with proper code for subrtoutine

    Hi Scott,

    There is one included example called Subroutine.ngc. Another SubroutineWithConditionals.ngc that shows how to call a subroutine N times - where N may be zero and therefore used as a form of conditional execution.

    Problems with your code:

    The subroutine must be in the same file and labeled with an O word.
    The subroutine should have a return statement M99
    It looks as though you have some letter O characters rather than 0 digits.

    HTH
    Regards

    Simple example to call a subroutine 3 times:
    Code:
    G20 G0 X0 Y0 Z0
    M98 P100 L3(Call the Subroutine 3 times)
    M2 (Stop)
    
    O100 (Subroutine Label of 100)
    F40
    G1 X1 Y0
    G1 X1 Y1
    G1 X0 Y1
    G1 X0 Y0
    M99 (return from subroutine)


    Regards
    TK http://dynomotion.com


  3. #3
    Member
    Join Date
    May 2009
    Location
    United States
    Posts
    98
    Downloads
    0
    Uploads
    0

    Default Re: Need help with proper code for subrtoutine

    Thank you for your help Tom!
    Scott



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

Need help with proper code for subrtoutine

Need help with proper code for subrtoutine