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
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:
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
Thank you Tom , I think that should work perfectly for me
What function does the M2 call do before the O10 sub routine
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
Hi Gregore,
Yes the M2 is there to stop the Main Program after it is finished.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 ?
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.I assume that the m99 command will move the machine back to the start position X0 Y0 Z0
HTH
Regards
Regards
TK http://dynomotion.com
The single stepping is a good idea , that should give me a really clear idea of each lines function.