======Subroutines in myCNC====== {{youtube>h69QymaY6PE?large}} Subroutines in myCNC are done in a manner similar to other industrial CNC systems. Sample code of a G-code program containing subroutines #100 and #101: G90 G0 Z10 F500 #100=[10] #101=[10] G0 X#100 Y#101 M98 P101 L5 M2 O100 G0 X#100Y#101 G1Z0 G2 X#100 Y#101 I10 #100=[#100+40] G0 Z10 M99 O101 M98 P100 L5 #100=[10] #101=[#101+40] M99 The resultant program will look the following way: {{:mycnc:forum-mar2020-020-vis-subroutine.png}} Subroutines are called using the following syntax: M98 P[SUBROUTINE NUMBER] L[NUMBER OF REPETITIONS] As can be seen in the code above, this takes the form of M98 P100 L5 The M99 code is used inside the subroutine that is being called to indicate the end of that subroutine.