User`s manual

Local Logic Language Syntax
GFK-1742A Chapter 12 Local Logic Language Syntax 12-3
12
The <
destination>
operator may consist of any read-write or write-only variable. The
<expression>
may be a simple constant or variable, a mathematical or bitwise logical operation on
two operands, an ABS function, or a bitwise NOT operation. Write-only variables can not be the
expression
for an assignment operation.
Examples:
P032 := Strobe1_Position_1 + 5000; This construct is okay.
P001 := ABS(Analog_Input1_1); This construct is okay.
Reset_Strobe1_1 := BWNOT Strobe1_Flag_1; This construct is okay.
P040 := 2#11111010_1011000; This construct is okay.
P011 := 3 * Strobe1_Position_1 + 20; This construct is ILLEGAL too many operations.
If complex operations are required, perform the operation using a series of steps that use parameter
registers to store intermediate results.
Examples:
To set Velocity_Loop_Gain_2 equal to (1+75000/Actual_Velocity_2), the programmer uses a
series of statements similar to the following...
P012 := 75000 / Actual_Velocity_2;
Velocity_Loop_Gain_2 := 1 + P012;
The build process will issue a warning if a Boolean variable is used as the destination for an
expression containing non-Boolean variables or a constant whose value is not zero or one. A
warning is generated because the DSM will assign the Boolean variable the value of the least
significant bit of the expression.
Local Logic Conditional Statements
Conditional statements permit conditional code execution based on simple relational and bitwise
logical operations. A conditional statement has the following format.
IF <expression> THEN
Local Logic Statements
END_IF;
The
<expression>
may consist of a constant, a variable, a relational or bitwise logical operation on
two variables, or a bitwise complement of a constant or variable. Write-only variables are not
allowed in the expression. If the relational expression is true, or if a bitwise operation, variable or
constant has a non-zero value, the Local Logic statements in the body of the IF statement are
executed. Any number of program statements may appear in the body of an IF statement (subject to
the total limit). Each IF-THEN statement must have an accompanying END_IF.
Examples:
IF P226 THEN This construct is okay.
IF CTL_1_to_32 BWAND 2#1010 THEN This construct is okay.
IF Strobe1_Level_1 = TRUE THEN This construct is okay.