
User Manual
Chapter 13
GFK-1742F
Jan 2020
Local Logic Variables
309
Variable Sign
Local Logic variables that are less than 32 bits long are either Signed or Unsigned (except Bit
Operands, which are always Unsigned). All Math/Logic operations in the Logic Engine are
signed 32 bit operations (except the 64 bit signed Divide and Modulus operations). Signed
variables that are less than 32 bits long are automatically sign extended to 32 bits when they
are loaded by the Logic Engine. Unsigned variables are not sign extended. Thus the Logic
Engine handles all data conversion and limit checking automatically.
13.2
Local Logic System Variables
The First_Local_Logic_Sweep, Overflow and System_Halt variables are used exclusively in
the Logic engine and are described below.
13.2.1
First_Local_Logic_Sweep Variable
The First_Local_Logic_Sweep variable is a Read-Only Bit Operand (refer to Table 69). It is set
by the Logic Engine during the first execution sweep when Local Logic is enabled and the
host controller is in RUN mode. It is reset to zero for subsequent sweeps. Thus it can be used
in the Local Logic program to initialize some variables. For example, the code below
initializes some parameter registers and Control variables in the first sweep using the
First_Local_Logic_Sweep variable.
IF First_Loca
l_Logic_Sweep THEN (* If it’s the Fi
rst execution sweep then *)
P001 := 0; (* Initialize P001 to 0 *)
P015 := 1000; (* Initialize P015 to 1000 *)
Velocity_Loop_Gain_1 := 20; (* Set the Velocity Loop Gain for Axis 1 to 20 *)
END_IF;
13.2.2
Overflow Variable
The Overflow variable is a Read-Write Bit Operand (refer to Table 69). It is set by the Logic
Engine when an Addition, Subtraction or Absolute value (ABS) overflow occurs. A warning
error code is also reported in the Module Status Code if the Overflow flag is set and an
overflow error occurs (refer to Chapter 12). Note that the user can prevent
Add/Subtract/ABS overflow warnings from being reported by setting the Overflow variable
to zero at the end of the Local Logic program. Similarly the user can test for Overflow errors
within the Local Logic program by reading the Overflow variable and performing some
appropriate action. The Overflow variable is cleared under the following circumstances:
1.
It is automatically cleared when Local Logic starts running, before the first execution
sweep.
2.
It can be cleared by the user in the Local Logic program (by setting Overflow := 0; ).
3.
It is cleared when the user toggles the error clear Q bit.