Entry type: FAQ, Entry ID: 67585220, Entry date: 02/28/2013

How do you declare the timers and counters for the S7-1500 in STEP 7 (TIA Portal) V12?

  • Entry
  • Associated product(s)

In this entry we deal with the topic of "Using times in the program" and the different ways of proceeding in STEP 7 V5.x and STEP 7 (TIA Portal) V12.

Procedure in STEP 7 V5.x
Due to their compatibility with STEP 5 you can also use STEP 7 S5 Timer and S5 Counter. These timers/counters are global and are addressed by one number. When you start the timers/counters, with the call of the "Value Range" and "Precision" modes it is defined whether the timer is to run as switch-on delay or the counter as up counter. Pay attention to the following system properties when calling and setting parameters:

  • The programs are specifically number-dependent.
  • Blocks with S5 timers/counters cannot be used multiple times.
  • The value range of the time is limited to a maximum of 9990s and that of the counter to a maximum of 999.
  • The interval times are 0.01 .. 9.99, 0.1 … 99.9, 1 … 999 and 10 … 9990 seconds.
  • The timer precision depends on the time interval selected.

Procedure in the TIA Portal
Declare the timers and the counters in the block in which they will be called and used. The IEC time is a structure of the data type IEC_TIMER, IEC_LTIMER, TON_TIME or TON_LTIME, which you can also declare as local variable in a block.


  • You can call the block multiple times with newly created instance data blocks.
  • The blocks have a wider counting range and the timer precision is independent of the interval timing.
  • The IEC timer provides a better performance than the S5 timers.

Fig. 01 shows two examples for this procedure. The IEC time "SwitchDelay" was declared as local variable of the data type "TON_TIME" and the IEC counter "CountDB" as local variable of the data type "CTU_INT".

Fig. 01

Note on security
The functions and solutions described in this article confine themselves predominantly to the realization of the automation task. Furthermore, please take into account that corresponding protective measures have to be taken in the context of Industrial Security when connecting your equipment to other parts of the plant, the enterprise network or the internet. More information is available in Entry ID: 50203404.

Creation environment
The figures in this FAQ response were created with STEP 7 V12.