Programming instructions

NC Programming 17VRS Commands for Controlling Processes and Programs
9-17
DOK-MTC200-NC**PRO*V17-ANW1-EN-P
Example NC program Loop construct
@51=0 Pre-assigning the loop variable
.NEXT Start-of-loop label
@51=@51+1 Increment loop variable
@100=MTD(250,0,1,@51) Read machine data variable
Page=250, LV1=0,
LV2=1, Element=@51
@100=@100-25 BEQ .BREAK Exit loop if machine variable = 25
@100=@51-10 BMI .NEXT Interrogate loop variable if loop
condition is still true
[no element of the machine data
has a value of 25] Output message
M00 Acknowledge programmed halt
from SPS
BRA .EXIT Branch to end of program
.BREAK Loop exit label
[one element of the machine data
has a value of 25] Output message
M00 Acknowledge programmed halt
from SPS
.EXIT End-of-program label
M30 Acknowledge end of program
from SPS