EasyManuals Logo

Siemens CP-8021 User Manual

Siemens CP-8021
614 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #547 background imageLoading...
Page #547 background image
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).

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Siemens CP-8021 and is the answer not in the manual?

Siemens CP-8021 Specifications

General IconGeneral
BrandSiemens
ModelCP-8021
CategoryController
LanguageEnglish

Related product manuals