S5-115U Manual
2.6
Measuring and Estimating the Scan Time and Setting the Scan
Monitoring Time
2.6.1
Measuring the Scan Time
The scan time is measured by the CPU and stored in the system data area. You can access the
current, the minimum and the maximum scan time in the control program at any time. The
resolution of the scan time is one millisecond, and the range of scan time values extends from 0 to
32,767 (=7FFF
) milliseconds. At the end of a scan cycle, after it has updated the process output
H
image (PIQ) and the interprocessor communication flags, the operating system stores the scan
time, i.e.:
•
Current scan time in SD 121
•
Maximum scan time in SD 122
•
Minimum scan time in SD 123
If the scan time exceeds 32,767 milliseconds, bit 15 (which is the overflow bit) of the current scan
time is set and entered in system data word SD 123 (maximum scan time). Scan time measurement
begins anew in the next scan cycle.
Note
The contents of the watchdog timer are also entered in system data words 121 to 123
when the PLC stops and outputs the "ZYK" (scan time exceeded) message.
Example:
Function block for measuring the scan time
FB99 STL
NAME :ZYKLUS-Z
DECL :MINI
I/Q/D/B/T/C: A
DECL :AKTU
I/Q/D/B/T/C: A
DECL :MAXI
I/Q/D/B/T/C: A
DECL :LOES
I/Q/D/B/T/C: E
: L
RS 121
: T
=AKTU
: L
RS 122
: T
=MAXI
: L
RS 123
: T
=MINI
: AN =LOES
: BEC
: L
KF +0
: T
RS 121
: T
RS 122
: T
RS 123
: BE
EWA 4NEB 811 6130-02b
BI/BY/W/D: W
BI/BY/W/D: W
BI/BY/W/D: W
BI/BY/W/D: BI
The LOES operand is used to reset system
data words 121, 122 and 123
(if LOES = 1).
Technical Description
Description
2-21