Do loop


Results 1 to 6 of 6

Thread: Do loop

  1. #1
    Member
    Join Date
    May 2013
    Location
    Usa
    Posts
    261
    Downloads
    0
    Uploads
    0

    Default Do loop

    Does Kmotion Gcode controller have a "do loop" option with a counter ? I looked at the EMC user manual but did not see anything like it .

    I would like to perform a simple move in X and Y and have it stop after a hundred moves.

    Or is there an easier way of doing this .

    Similar Threads:


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

    Default Re: Do loop

    Hi Gregore,

    You can call a subroutine N times. Such as:


    G20 G0 X0 Y0 Z0
    M98 P10 L100(Call the Subroutine 100 times)
    M2 (Stop)

    O10 (Subroutine Label of 10)
    F40
    G1 X1 Y0
    G1 X1 Y1
    G1 X0 Y1
    G1 X0 Y0
    M99

    HTH
    Regards

    Regards
    TK http://dynomotion.com


  3. #3
    Member
    Join Date
    May 2013
    Location
    Usa
    Posts
    261
    Downloads
    0
    Uploads
    0

    Default Re: Do loop

    Thank you Tom , I think that should work perfectly for me

    What function does the M2 call do before the O10 sub routine



  4. #4
    Member
    Join Date
    May 2013
    Location
    Usa
    Posts
    261
    Downloads
    0
    Uploads
    0

    Default Re: Do loop

    Never mind , I think I under stand . The first part up to m2 is the main program the second part is the seperate sub routine .

    Is that correct ?

    I assume that the m99 command will move the machine back to the start position X0 Y0 Z0



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

    Default Re: Do loop

    Hi Gregore,

    I think I under stand . The first part up to m2 is the main program the second part is the seperate sub routine .

    Is that correct ?
    Yes the M2 is there to stop the Main Program after it is finished.

    I assume that the m99 command will move the machine back to the start position X0 Y0 Z0
    No. That is the return from subroutine. The code has already moved back to X0 Y0 Z0 by the end of the subroutine in the example. You might Single Step through the code for a better understanding of how a subroutine works.

    HTH
    Regards

    Regards
    TK http://dynomotion.com


  6. #6
    Member
    Join Date
    May 2013
    Location
    Usa
    Posts
    261
    Downloads
    0
    Uploads
    0

    Default Re: Do loop

    The single stepping is a good idea , that should give me a really clear idea of each lines function.



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

Do loop

Do loop