Hello Guest it is March 28, 2024, 07:48:14 PM

Author Topic: Nested Subroutine hangs after 1 iteration  (Read 603 times)

0 Members and 1 Guest are viewing this topic.

Nested Subroutine hangs after 1 iteration
« on: December 03, 2020, 05:23:13 PM »
I'm running Mach 3 on a DIY machine.Can anyone tell me why the program hangs after the first time through subroutine O125? Also Mach 3 does not display the M99 at the bottom of the subroutine.

#1=-0.1
#2=1
#3=0
#4=60
G20 G40 G80 G90 G00
Z1.1
G1 F60
G1Z[#2]
(Calling sub O125)
M98 P125 Q5 (Repeat 5 times)
G00 Z1
G0A0
M30 (end program)

O124 (this is a sub)
G1 X0Z[#2] F60
#2=[#2+#1] (Step decrease Z by value of #1)
G1 Z1
G1 X6
M99

O125 (this is a sub)
(Call Sub O124)
M98 P124 Q5
#3=[#3+#4] (increase #3 by 60)
G0A[#3] (Rotate A axis 60 degrees)
M99
« Last Edit: December 03, 2020, 05:25:06 PM by Sawdust »

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Nested Subroutine hangs after 1 iteration
« Reply #1 on: December 03, 2020, 05:30:35 PM »
You are probably missing an end of line at the end of the code try starting and ending the code with a %

%
#1=-0.1
#2=1
#3=0
#4=60
G20 G40 G80 G90 G00
Z1.1
G1 F60
G1Z[#2]
(Calling sub O125)
M98 P125 Q5 (Repeat 5 times)
G00 Z1
G0A0
M30 (end program)

O124 (this is a sub)
G1 X0Z[#2] F60
#2=[#2+#1] (Step decrease Z by value of #1)
G1 Z1
G1 X6
M99

O125 (this is a sub)
(Call Sub O124)
M98 P124 Q5
#3=[#3+#4] (increase #3 by 60)
G0A[#3] (Rotate A axis 60 degrees)
M99
%
Without engineers the world stops
Re: Nested Subroutine hangs after 1 iteration
« Reply #2 on: December 03, 2020, 09:28:09 PM »
Doh :-\ Sometimes I can't see the forest for the trees.

Thanks