Siemens S7-1200 System Manual page 223

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Counter data retention after a RUN-STOP-RUN transition or a CPU power cycle
If a run mode session is ended with stop mode or a CPU power cycle and a new run mode
session is started, then the counter data stored in the previous run mode session is lost,
unless the counter data structure is specified as retentive (CTU, CTD, and CTUD counters).
When you accept the defaults in the call options dialog after you place a counter instruction
in the program editor, you are automatically assigned an instance DB which cannot be made
retentive. To make your counter data retentive, you must either use a global DB or a Multi-
instance DB.
Assign a global DB to store counter data as retentive data
This option works regardless of where the counter is placed (OB, FC, or FB).
1. Create a global DB:
2. Add counter structure(s) to the DB:
3. Open the program block for editing where you want to place a retentive counter (OB, FC,
4. Place the counter instruction at the desired location.
5. When the call options dialog appears, click the cancel button. You should now see a new
6. On the top of the new counter instruction, type the name (do not use the helper to
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
– Double-click "Add new block" from the Project tree
– Click the data block (DB) icon
– For the Type, choose global DB
– If you want to be able to select individual items in this DB as retentive, be sure the
symbolic-access-only box is checked.
– Click OK
– In the new global DB, add a new static tag using one of the counter data types. Be
sure to consider the Type you want to use for your Preset and Count values.
– In the "Retain" column, check the box so that this structure will be retentive.
– Repeat this process to create structures for all the counters that you want to store in
this DB. You can either place each counter structure in a unique global DB, or you can
place multiple counter structures into the same global DB. You can also place other
static tags besides counters in this global DB. Placing multiple counter structures into
the same global DB allows you to reduce your overall number of blocks.
– Rename the counter structures if desired.
or FB).
counter instruction which has "???" both just above and just below the instruction name.
browse) of the global DB and counter structure that you created above (example:
"Data_block_3.Static_1"). This causes the corresponding preset and count value type to
be filled in (example: UInt for an IEC_UCounter structure).
Basic instructions
7.3 Counter operations
223

Advertisement

Table of Contents
loading

Table of Contents