EasyManua.ls Logo

Tormach PCNC 770 - Looping Subroutines

Tormach PCNC 770
230 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 7
141
UM10350_PCNC770_Manual_0916A
Programming
7.10.1.5 Looping Subroutines
Subrounes can be looped using the Do/while or while/endwhile keyword constructs.
Do/While Loop
The Do/While loop executes a block of code once and connues to execute the code block unl the
while argument evaluates to true.
Do/While Loop Example:
#1 = 0 (assign parameter #1 the value of 0)
o100 do
(debug, parameter 1 = #1)
o110 if [#1 EQ 2]
#1 = 3 (assign the value of 3 to parameter #1)
(msg, #1 has been assigned the value of 3)
o100 continue (skip to start of loop)
o110 endif
(some code here)
#1 = [#1 + 1] (increment the test counter)
o100 while [#1 LT 3]
M02
While/endwhile
The while/endwhile repeats a set of statements an indenite number of mes, as long as the while
argument evaluates to true.
While/endwhile Example:
(draw a sawtooth shape)
G00 X1 Y0 (move to start position)
#1 = 1 (assign parameter #1 the value of 0)
F25 (set a feed rate)
o101 while [#1 LT 10]
G01 X0
G01 Y[#1/10] X1
#1 = [#1+1] (increment the test counter)
o101 endwhile
M02 (end program)
The following statements cause an error message and abort the interpreter:
A return or endsub not within a sub denion
A label on repeat which is dened elsewhere
A label on while which is dened elsewhere and not referring to a do

Table of Contents

Other manuals for Tormach PCNC 770

Related product manuals