Reference Manual

PMAC 2 Software Reference
358 PMAC Program Command Specification
Example
WHILE (P20=0)
...
ENDWHILE
WHILE (Q10<5 AND Q11>1)
...
ENDWHILE
WHILE (M11=0) WAIT ; sit until input goes true
INC
WHILE (M11=0 OR M12=0) X100 ; increment until 2 inputs true
To do the equivalent of a For/Next loop:
P1=0 ; Initialize loop counter
WHILE (P1<10) ; Loop until counter exceeds limit
X1000 ; Perform action to be repeated
P1=P1+1 ; Increment loop counter
ENDWHILE ; Loop back
To do a timed wait in a PLC program, use the servo cycle counter as timer
P90=16777216 ; Counter rollover value (2^24)
P91=M0 ; Store starting value of M0 (X:$0) counter
P92=0 ; Time elapsed so far
WHILE (P92<P93) ; Loop until past specified time
P92=(M0-P91)%P90 ; Calculate time elapsed
; Modulo (%) operation to handle rollover
ENDWHILE ; Loop back
To do extended compound conditions in a PLC program
WHILE (M11=1 AND M12=1)
OR (M13=1 AND M14=1)
AND (P1>0)
...
ENDWHILE
See Also
Program Logic (Writing a Motion Program, Writing a PLC Program)
How PMAC Executes a Motion Program (Writing a Motion Program)
Program commands AND, OR, IF, ELSE, ENDIF, ENDWHILE
X{data}
Function
X-Axis Move
Type
Motion program
Syntax
X{data}
where:
{data} is a floating point constant or expression representing the position or
distance in user units for the X-axis.
Remarks
This command causes a move of the X-axis. (See {axis}{data} description above.)
Example
X10
X15 Y20
X(P1) Y30
X(Q10*COS(Q1)) Y(Q10*SIN(Q1))
X3.76 Z2.92 I0.075 K3.42
See Also
Program commands {axis}{data}, A, B, C, U, V, W, Y, Z, CALL, READ