6-117
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-6 Instructions
6
6-6-3 Instruction Errors
Errors in Assignment Statements
When an error occurs in an assignment statement written in ST, that line is not executed.
This operation is the same as when the output ENO of a user-created function is FALSE.
Errors in IF Constructs
If a syntax error occurs in ST, perform error processing for the syntax error.
When the value of (c+d), below, is zero, the lines between the IF and END_IF are not executed.
Syntax Errors in ST
The following syntax errors can occur in ST.
• Exceeding the number of elements in an array.
• No parameter set for in-out variable.
• STRING assignment: When the text string size (bytes) of the left side is less than the text string
length (bytes) of the right side
• Division by zero (excluding floating-point number calculations)
* When the value of a floating-point number is nonnumeric, the result of the calculation will also be nonnumeric.
This is not considered an error.
Operation for Structure Errors
The P_PRGER Flag changes TRUE and the following occurs.
Operation When a Syntax Error Occurs in a POU Written in ST
Syntax Error location Operation
Assignment
statement
The line is not executed.
5 a = b / (c + d) + e ∗ f + ABS(g);
6
x := 1;
For example, if a division by zero error occurs
in (b/(c+d)) on line 5, execution of line 5 is
cancelled (the value of a is not changed) and
line 6 is executed.
5 a = User-created_function_block (b) + c;
6
x := 1;
When the ENO output from the user-created
function is FALSE, execution of line 5 is
cancelled (the value of a is not changed) and
line 6 is executed.