Examples for Instruction Lists (IL)
SICAM A8000 / CP-8000 • CP-8021 • CP-8022 Manual
Unrestricted
547
DC8-037-2.02, Edition 10.2017
B.4
Operating Hours Counter
A clock pulse generator (
TCLK_PULSE
) is running with a frequency of 30s logical
1
and 30s
logical
0
. The edge change from
0
to
1
is switched to the
CU
Input of the upward-counter
(
CTU_COUNTER.CU
) and the counter will be incremented with 1 per minute.
The sum of the operating hours results of two values:
•
Current counter score (
CTU_COUNTER.CV
)
•
Counter score before the last power down (
MR_DINT_MINUTES
)
The score will be saved in a retaining flag (
M_DINT_MINUTESOLD
). This means, after a
power down (startup) the counter will continue with incrementing based on the last value.
The hours result by minutes devided by 60. The hours always will be recalculated based on
the minutes, the same after a power down.
PLC_RESET:
LD 10
ST PLC_CYCLETIME
(*cycle time in ms*)
PLC_INIT:
LD MR_DINT_MINUTES
(*load power-fail safe value*)
ST M_DINT_MINUTESOLD
(*freeze in a flag as old value*)
PLC_START:
(*Operating hours counter*)
LD PLC_SYSTIME.SEC
(*fetch second value of the system time*)
ST M_DINT_SEC
(*and store in variable*)
LD M_DINT_SEC
(*current second*)
EQ 0
(*compare with second 0*)
ST CTU_COUNTER.CU
(*HIGH always at the second 0, required*)
(*edge detection is implemented within*)
(*the counter*)
CAL CTU_COUNTER
(*increments the counter*)
LD CTU_COUNTER.CV
(*load current counter score*)
ST ADD.IN0
(*store at input 0 for ADD function*)
LD M_DINT_MINUTESOLD
(*load old value*)
ST ADD.IN1
(*store at input 1 for ADD function*)
CAL ADD
(*call ADD function*)
ST MR_DINT_MINUTES
(*store sum of operating minutes in a*)
(*retaining flag, after startup the*)
(*old value will be added to the*)
(*current counter score*)
ST DIV.IN0
(*store at input 0 for DIV function*)
LD 60
(*load constant for 60 minutes*)
ST DIV.IN1
(*store at input 1 for DIV function*)
CAL DIV
(*call DIV function*)
ST M_DINT_HOURS
(*sum of operating hours = minutes*)
(*divided by 60*)
To reset the counter score it is necessary to reset the counter (
CTU_COUNTER.R
) as well as
the flag with the retained value (
M_DINT_MINUTESOLD
).
Содержание CP-8000
Страница 10: ...Open Source Software 10 Unrestricted SICAM A8000 CP 8000 CP 8021 CP 8022 Manual DC8 037 2 02 Edition 10 2017 ...
Страница 74: ...Function Packages 74 Unrestricted SICAM A8000 CP 8000 CP 8021 CP 8022 Manual DC8 037 2 02 Edition 10 2017 ...
Страница 468: ...Engineering via SICAM WEB 468 Unrestricted SICAM A8000 CP 8000 CP 8021 CP 8022 Manual DC8 037 2 02 Edition 10 2017 ...
Страница 524: ...Service 524 Unrestricted SICAM A8000 CP 8000 CP 8021 CP 8022 Manual DC8 037 2 02 Edition 10 2017 ...
Страница 556: ...Error Handling 556 Unrestricted SICAM A8000 CP 8000 CP 8021 CP 8022 Manual DC8 037 2 02 Edition 10 2017 ...
Страница 603: ...Use Cases SICAM A8000 CP 8000 CP 8021 CP 8022 Manual Unrestricted 603 DC8 037 2 02 Edition 10 2017 ...
Страница 604: ......