Delta Tau GEO BRICK LV User Manual

Page of 440
Turbo PMAC User Manual 
Writing and Executing PLC Programs
 
379
 
Arrays 
Compiled PLC programs support two types of arrays: variable arrays and register arrays.  Both provide 
useful capabilities. 
Variable Arrays 
Variable arrays work with the Turbo PMAC’s standard PMAC I, P, Q, and M-variables.  The number of 
the array index is placed inside parentheses, and specifies the variable number for the specified type of 
variable.  The expression that determines this number is a floating-point expression, so it can use Turbo 
PMAC I, P, Q, or M-variables, constants (which will be treated as floating-point values) and the 
compiler’s F-variables, but it cannot use the compiler’s L-variables (unless the value has been converted 
to floating-point with the ITOF function).  The resulting value of this floating-point expression is 
rounded automatically to the nearest integer to select the variable number to be used.  Some examples of 
statements using these variable arrays are: 
P(P1)=P10*32 
P30=I(ITOF(L10)*100+30)*P29 
Register Arrays 
Register arrays work with the compiler’s short L-variables and long F-variables.  These arrays must be 
declared to the compiler before the start of the actual Open Servo algorithm.  In use, the number of the 
array index is placed inside square brackets, and specifies the address offset from the declared beginning 
of the array.  The expression that determines this number is a fixed-point expression, so it can use only 
the compiler’s L-variables and constants that fit within the range of a 24-bit signed integer. 
L and F-variable register arrays must be declared to the compiler before the start of the actual Open Servo 
algorithm.  Examples of these definitions are: 
L100->X:$010000[32] 
F200->D:$030040[64] 
F300->L:$030080[128] 
The declared array size must be a power of 2 in the range 2 to 8192.  L-variable register arrays always use 
full 24-bit X or Y registers, treating the values as signed integers. 
Note: 
The use of register arrays requires the PRO series of PMAC Executive program 
(PEWIN32PRO) and Turbo PMAC firmware revision 1.938 or newer. 
Operators 
As with any Turbo PMAC user program, compiled PLCs can utilize the following mathematical and 
logical operators: + (addition), - (subtraction), * (multiplication), / (division), % (modulo, remainder), & 
(bit-by-bit AND), | (bit-by-bit OR), and ^ (bit-by-bit XOR).  All of these operators can be used in either 
floating-point or integer statements.  Integer division rounds the result to the nearest integer; in the case 
where the fraction is exactly 0.5, it will round to the next more positive integer (e.g. -7.5 to -7,  
and 7.5 to 8). 
Comparators 
As with any Turbo PMAC user program, compiled PLCs can utilize the following comparators in 
conditional statements: = (equal to), > (greater than), < (less than), ~ (approximately equal to [within 
0.5]), != (not equal to),!> (not greater than, less than or equal to), !< (not less than, greater than or equal 
to), and !~ (not approximately equal to [not within 0.5]).   
The ~ and !~ comparators can be used only in floating-point statements.  Note that the <>, >=, and <= 
comparators, which can be used in some programming languages, cannot be used in compiled PLCs or 
other Turbo PMAC programs.