CNC Z32 - Programming Guide (LATHES)
Structuring conditioned jumps
Normally the various commands to be executed in a single advanced line are separated by the “;” character. When
an IF condition is programmed, if the condition is verified, the subsequent commands are executed, otherwise the
analysis jumps to the next “!” character present in the line.
Example:
!
IF HA > 10
;
GON20
!
IF HA >5
;
GON30
!
GON40
!
In the above example, if the HA > 10 is verified, the program jumps to N20.
If HA > 10 is not verified, the instruction following next “!” character is executed, thus controlling if HA is higher than
5.
With this logic, the sample line behaves as follows:
If HA is higher than 10, jump to N20.
If HA is between 5 and 10, jump to N30
Otherwise jump to N40
Warning: the character “!” doesn’t interrupt an advanced line execution. To interrupt an advanced line
execution, a jump command !GON..! is necessary, or the programming of an end of block instruction EB.
For example, in the following line:
!IF HA>=0 ; HA=HA+1 ; EB ! HA=HA-1!
the EB instruction is necessary to terminate the line execution.
The line has the following behavior:
If HA is higher or equal to zero, it is incremented by 1, otherwise it is decremented by 1.
If the programming were as follows:
!IF HA>=0 ; HA=HA+1 ; EB ! HA=HA-1!
This instruction is not correct because:
if HA is higher or equal to zero, HA is at first incremented and then decremented by 1, because, as already told, the
“!” character doesn’t interrupt the line execution.
Another example of using the EB terminator is the following:
!IF HA > 0 ; EB ! GON10!
That means: if HA is higher than zero, it terminates the advanced line and continues the execution from next line,
otherwise, jumps to N10.
Warning: In order to use the N… numbers as destinations for a jump, it is necessary for the N character to
be the first character present in the line, without leading spaces.
5.2.7
59