D.1 using the pre-defined program scan variables, D.1 using the prećdefined program scan variables – Rockwell Automation AutoMax Enhanced Ladder Language Reference Manual User Manual
Page 304

DĆ2
D.1
Using the PreĆDefined Program Scan Variables
Use the following Boolean variables to execute logic based on the Processor's scan.
Only use these variables for input parameters (read only):
D first_scan
Use this variable to execute logic during a program's first scan. This variable is
true during the initial scan of the ladder rung and false during all other scans.
D second_scan
Use this variable to execute logic during a program's second scan. This
variable is true during the second scan of the ladder rung and false during all
others.
D last_scan
Use this variable to execute logic during a program's last scan. This variable is
true on the final pass of the ladder rung after you have selected TASK STOP.
This variable is not set when a STOPĆALL error occurs.
To use the last_scan variable, your program scan must be less than 0.5 s.
I
MPORTANT:
Do not use the last_scan variable in an eventĆdriven program. Because these
programs are based on the occurrence of an event, the last_scan variable may
never be executed when used in an eventĆdriven program.