Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

(This macro call is independent of the call in the

previous block. So, 00016 is executed once, with


#1 again initially set to 1, even if #1 of the previous
execution contained a different value. In fact, #1 of
the previous execution carries no meaning now)
G65 P0016 A1; (Same as above)
#503 = #1; (Since the subprogram call modified the value
stored in #1 to 7, #503 would store 7. A macro call
has no effect on the local variables of the calling
program)
M30; (Execution end and control reset)
00014; (Program number 14)
#1 = #1 + 2; (Since this program has been called as a subprogram,
#1 used here is the same as #1 of the calling
program 00013. Since every execution of this program
adds 2 to the value stored in #1, the final
value becomes 7, after three executions)
#500 #1; (#500 stores 3 after the first execution, 5 after the
second, and 7 after the third and final execution)
M99; (Return to the calling program, after all the specified
number of repetitions are over. After the
return, #1 of the calling program would contain 7,
since it is the same as #1 of this subprogram)
00015; (Program number 15)
#1 = #1 + 2. (Since this program has been called as a macro, #1
used here is different from #1 of the calling program
00013. The macro call assigns a value of 1 to
the macro variable #1, in the beginning of the first
call of this program. The repeated calls use the
updated values of #1. Since every execution of
this program adds 2 to the value stored in #1, the
final value becomes 7, after three executions)
#501 #1; (#501 stores 3 after the first execution, 5 after the
second, and 7 after the third and final execution)
M99; (Return to the calling program, after all the specified
number of repetitions are over. Since #1 of
this program and #1 of the calling program are
different

You might also like