User`s manual

GFK-1742A 11-1
Local Logic Tutorial
Introduction
The Local Logic programming language supports assignment, conditional statements, arithmetic,
logical, and relational operations. The Local Logic program runs synchronously with the motion
module position loop and as such is deterministic. The language includes constructs that allow the
Local Logic program to communicate information between the Logic program, the Motion
Program, and the host PLC. The tutorial focuses on the local logic language and its communication
with motion programs. The user should consult the chapter 7 for additional information concerning
the motion programmer language.
Statements
The Local Logic programming language supports assignment and conditional statements.
Assignment statements permit arithmetic results and bitwise logical operations to be assigned to a
variable. Conditional statements permit conditional local logic code execution. Conditional
execution is based on the value of a constant or variable, or the result of a relational or bitwise
logical expression.
Assignment statements use the “:=” operator. The following example multiplies two parameter
registers and assigns the result to another parameter register.
P001 := P210 * P107;
Note: Assignment statements require a semi-colon terminator as shown above.
Conditional statements use the IF-THEN-END_IF keyword combination. The END_IF keyword
concludes the conditional statement. The following example checks the Block_1 variables value
and conditionally sets a value in a parameter register. Specifically, if the Block_1 variable’s value
equals 5 then the parameter P010 value is set to 100.
IF Block_1 = 5 THEN
P010 := 100;
END_IF;
The IF, THEN, and END_IF keywords are case sensitive, and the END_IF statement is terminated
with a semi-colon. IF statements may be nested up to eight levels and the body of the IF statements
may contain one or more statements. Refer to Chapter 12 for a detailed description of these
statements.
11
Chapter