6 Programming
6-118
NJ-series CPU Unit Software User’s Manual (W501)
When an instruction error occurs in a ladder algorithm or when a syntax/function error occurs in an ST
algorithm, the P_PRGER (Instruction Error Flag) system-defined variable changes to TRUE. The
P_PRGER flag is a local variable for the program. This flag changes to TRUE when an instruction error
occurs in the program, and remains TRUE during the next task period.
The user can write the P_PRGER Flag. You can temporarily set the value of this flag to FALSE through
a user operation to determine if the error occurs within a specific range, for example. After this flag
changes to TRUE, it remains TRUE until the operating mode is changed or the flag is overwritten by a
program.
Example:
The P_PRGER Flag also changes to TRUE when an instruction error occurs inside a user-defined
function block that is used by the program.
Example:
Control con-
structs
IF condition
expression
No statements between IF and END_IF are executed.
CASE condition
expression
No statements between CASE and END_CASE are executed.
FOR condition
expression
No statements between FOR and END_FOR are executed.
WHILE condition
expression
No statements between WHILE and END_WHILE are executed.
REPEAT condi-
tion expression
No statements between REPEAT and END_REPEAT are executed.
Instruction Error Flag
Variable
name
Meaning Function
Data
type
Range of values Initial value
Read
/writ
e
P_PRGER Instruction Error Flag This flag changes to and
remains TRUE when an
instruction error occurs. After
this flag changes to TRUE, it
stays TRUE until the program
changes it back to FALSE.
BOOL TRUE or FALSE FALSE Read
/write
Syntax Error location Operation
P_PRGER
User Program
Initial process
Error processing
for normal
process #1
P_PRGER
If the flag is ON, you
know that the
instruction error has
to be inside this
range.
Example: Initial values
set for variables
Normal process #1
Normal process #2
Algorithm (instructions)
R
Program
User-defined
function block
Inside function block definition
Instruction error
P_PRGER : OFF
P_PRGER : OFF
P_PRGER : ON
P_PRGER : ON