User`s manual
Local Logic Tutorial
GFK-1742A Chapter 11 Local Logic Tutorial 11-3
11
The Local Logic Parser generates an error if the program attempts to write to a read only variable,
or attempts to read a write only variable.
In addition, Local Logic variables have a size attribute ranging from Boolean (1-bit) to double
integer (64-bits). The Local Logic Parser generates a warning message when a non-Boolean value
is assigned to a Boolean variable. The warning indicates that data may be lost, due to truncation,
when this assignment occurs. The user should note that double integer variables (64-bit) variables
may only be used as the destination of a multiply operation, or the numerator of a divide or
modulus operation.
Consult chapter 13 for additional information concerning Local Logic variables. Additionally, the
Local Logic Variables Table (LLVT) within VersaPro contains the information on the variables
size, type and Read/Write properties.
Operators
Local logic provides three classes of operators. The operators are arithmetic, relational, and bitwise
logical operators. An introduction to each operator follows. A more detailed discussion of the
operators is contained in Chapter 12.
Arithmetic Operators
Local Logic provides the user with the ability to perform basic arithmetic operations. The language
supports 32-bit integer operations and limited use of 64/32 bit operations where appropriate to
maintain precision. All arithmetic functions, except the ABS function, require two operands.
Local Logic supports addition, subtraction, multiplication, division, absolute value, and modulus
operations.
Example constructs are:
P010 := Commanded_Velocity_1 - P009; (* P010=Commanded Velocity Axis 1 – P009*)
The user should note that the following would be an invalid mathematical construct:
Commanded_Velocity_1 := P010 - P009; (* Commanded_Velocity_1=P010-P009*)
The reason this is invalid is that the mathematical expression is attempting to assign the result
(P010-P009) to Commanded_Velocity_1 which is a read-only variable.
Storing intermediate results into parameter registers provides the flexibility necessary to solve
complex mathematical expressions.
For example, the following construct is invalid since it contains more than one operation (Multiply
and Subtraction):
P005:= Torque_Limit_1 *( P001 – P010);
To achieve the same result, the user can enter the following:
P004:= P001 – P010;
P005:= Torque_Limit_1 * P004;