Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Using_Timers

Block: Author: Created: Last Modified:

OB_1 02/29/2000 04:06:56 pm 05/16/2005 04:30:38 pm

Symbol

Var Type TEMP TEMP TEMP TEMP

Data Type

Comment

1/7

Using_Timers

Tip031B TOPIC: How to Create Off-Delay Timers, Pulse Timers, and Extended Pulse Timers VERSION: 4.0 DATE: 1/99 ***SPECIAL HARDWARE REQUIREMENTS*** None. ***DISCLAIMER*** These SIMATIC S7-200 Application Tips are provided free of charge to give users of the S7-200 examples of programming techniques available to accomplish certain tasks in various applications. These Tips do not purport to cover all details or variations in equipment, nor do they provide for every possible contingency. Your application may be different from those contemplated herein. It is your responsibility to use the SIMATIC S7-200 properly in your application. These Tips do not relieve you of the responsibility to use sound practices in application, installation, operation and maintenance. By using these Tips, you acknowledge that Siemens shall not be liable under any theory for damages or personal injury resulting from such use. Siemens reserves the right to make changes in these Tips at any time without notice or obligation. Should a conflict arise between the suggestions in these Tips and other Siemens publications such as the S7-200 Programmable Controller System Manual or the SIMATIC S7 / M7 / C7 Programmable Controllers Catalog ST 70, the other publication shall take precedence. Copyright 1999 Siemens Energy & Automation, Inc. Any form of duplication or distribution of these Tips or excerpts hereof is prohibited without the express consent of Siemens Energy & Automation, Inc. ***ONLINE HELP*** To activate the associated online Help file, open the directory on your desktop where you stored these files or select the documentation CD and double-click on the 200TIPSB.hlp file. After the Help file starts, use the Table of Contents or the Help Topics Index to select the file associated with this tip. ***OVERVIEW*** This program example shows how to use the integrated On-Delay Timers to generate an off-delay timer, a pulse timer, or an extended pulse timer. For the off-delay timer, the output signal at Q0.0 stays set for a specified time (in this case, 5 s) after the input signal at I0.0 goes off. The pulse signal at Q0.1 is on for a specified time after the input signal at I0.1 is set. If input I0.1 is reset before the pulse timer has run out, the pulse signal at output Q0.1 is also reset. The extended pulse timer always leaves the output signal at Q0.2 active for the preset time once the input I0.2 has been set, even if the input is reset during that time. ***PROGRAM DESCRIPTION*** The program below is subdivided into three independent parts, which operate off-delay, pulse, and extended pulse timers separately. **OFF-DELAY*** When input I0.0 is switched on, output Q0.0 is set. If input I0.0 is reset, timer T33 starts with a run time of 5 s. As long as

2/7

Using_Timers

the timer is running (that is, the timer bit is not set) memory bit M0.0 remains set, and with that, output Q0.0. After the preset time of 5 s has expired, the timer bit T33 (which is now set) resets memory bit M0.0 and output Q0.0. ***PULSE*** When input I0.1 is switched on, output Q0.1 is set. This sets memory bit M0.1 which starts timer T34. After the preset timer of 5 s has expired or input I0.1 is reset, output Q0.1 is reset. ***EXTENDED PULSE*** When input I0.2 is switched on, output Q0.2 is set. This sets memory bit M0.2 which starts timer T35. After the preset time of 5 s has expired, output Q0.2 is reset.

***MAIN PROGRAM*** Tip031B TOPIC: How to Create Off-Delay Timers, Pulse Timers, and Extended Pulse Timers VERSION: 4.0 DATE: 1/99 ***SPECIAL HARDWARE REQUIREMENTS*** None. ***DISCLAIMER*** These SIMATIC S7-200 Application Tips are provided free of charge to give users of the S7-200 examples of programming techniques available to accomplish certain tasks in various applications. These Tips do not purport to cover all details or variations in equipment, nor do they provide for every possible contingency. Your application may be different from those contemplated herein. It is your responsibility to use the SIMATIC S7-200 properly in your application. These Tips do not relieve you of the responsibility to use sound practices in application, installation, operation and maintenance. By using these Tips, you acknowledge that Siemens shall not be liable under any theory for damages or personal injury resulting from such use. Siemens reserves the right to make changes in these Tips at any time without notice or obligation. Should a conflict arise between the suggestions in these Tips and other Siemens publications such as the S7-200 Programmable Controller System Manual or the SIMATIC S7 / M7 / C7 Programmable Controllers Catalog ST 70, the other publication shall take precedence. Copyright 1999 Siemens Energy & Automation, Inc. Any form of duplication or distribution of these Tips or excerpts hereof is prohibited without the express consent of Siemens Energy & Automation, Inc. ***ONLINE HELP*** To activate the associated online Help file, open the directory on your desktop where you stored these files or select the documentation CD and double-click on the 200TIPSB.hlp file. After the Help file starts, use the Table of Contents or the Help Topics Index to select the file associated with this tip. ***OVERVIEW*** This program example shows how to use the integrated On-Delay Timers to generate an off-delay timer, a pulse timer, or an extended pulse timer. For the off-delay timer, the output signal at Q0.0 stays set for

3/7

Using_Timers

a specified time (in this case, 5 s) after the input signal at I0.0 goes off. The pulse signal at Q0.1 is on for a specified time after the input signal at I0.1 is set. If input I0.1 is reset before the pulse timer has run out, the pulse signal at output Q0.1 is also reset. The extended pulse timer always leaves the output signal at Q0.2 active for the preset time once the input I0.2 has been set, even if the input is reset during that time. ***PROGRAM DESCRIPTION*** The program below is subdivided into three independent parts, which operate off-delay, pulse, and extended pulse timers separately. **OFF-DELAY*** When input I0.0 is switched on, output Q0.0 is set. If input I0.0 is reset, timer T33 starts with a run time of 5 s. As long as the timer is running (that is, the timer bit is not set) memory bit M0.0 remains set, and with that, output Q0.0. After the preset time of 5 s has expired, the timer bit T33 (which is now set) resets memory bit M0.0 and output Q0.0. ***PULSE*** When input I0.1 is switched on, output Q0.1 is set. This sets memory bit M0.1 which starts timer T34. After the preset timer of 5 s has expired or input I0.1 is reset, output Q0.1 is reset. ***EXTENDED PULSE*** When input I0.2 is switched on, output Q0.2 is set. This sets memory bit M0.2 which starts timer T35. After the preset time of 5 s has expired, output Q0.2 is reset.

***MAIN PROGRAM***

Network 1

Set Memory Bit for Off-Delay Timer

Load input I0.0. When there is a negative transition (Edge Down) at input I0.0 (input is switched off), set memory bit M0.0.

I0.0 N

M0.0 S 1

4/7

Using_Timers

Network 2

Start Timer T33

Load memory bit M0.0. If memory bit M0.0 is set, start timer T33 with a preset time (PT) of 500 (5 s). The time base for timer T33 is 10 ms. That is, when the value 500 is loaded, the count time is 5 s.

M0.0 IN

T33 TON

+500

PT

10 ms

Network 3

After Timer T33 Expires (5 s), Reset Memory Bit M0.0

After the time that was set in timer T33 (5 s) has run out, memory bit M0.0 is reset. Load timer T33. If the count time has run out (Preset Time = Current Time), reset memory bit M0.0.

T33

M0.0 R 1

Network 4

Set Output Q0.0.

When input I0.0 is set or memory bit M0.0 is set (timer T33 is running), output Q0.0 is set. Load input I0.0. If input I0.0 is set or if memory bit M0.0 is set, set output Q0.0.

I0.0

Q0.0

M0.0

Network 5

Set Memory Bit for Pulse Timer

Load input I0.1. When there is a positive transition (Edge Up) at input I0.1 (input is switched on), set memory bit M0.1.

I0.1 P

M0.1 S 1

5/7

Using_Timers

Network 6

Start Timer T34

Load memory bit M0.1. If memory bit M0.1 is set, start timer T34 with a preset time (PT) of 500 (5 s). The time base for timer T34 is 10 ms. That is, when the value 500 is loaded, the count time is 5 s.

M0.1 IN

T34 TON

+500

PT

10 ms

Network 7

Reset Memory Bit M0.1

If input I0.1 is switched off or if the time that was set in timer T34 (5 s) has run out, memory bit M0.1 is reset. Load timer T34. If the count time has run out (Preset Time = Current Time), or if input I0.1 is not set, reset memory bit M0.1.

T34

M0.1 R 1

I0.1 /

Network 8

Set Output Q0.1

The state of memory bit M0.1 directly affects the state of output bit Q0.1. If memory bit M0.1 is set, output Q0.1 is set. If memory bit M0.1 is reset, output Q0.1 is reset. Load memory bit M0.1. If memory bit M0.1 is set, set output Q0.1.

M0.1

Q0.1

Network 9

Set Memory Bit for Extended Pulse Timer

Load input I0.2. When there is a positive transition (Edge Up) at input I0.2 (input is switched on), set memory bit M0.2.

I0.2 P

M0.2 S 1

6/7

Using_Timers

Network 10

Start Timer T35

Load memory bit M0.2. If memory bit M0.2 is set, start timer T35 with a preset time (PT) of 500 (5 s). The time base for timer T35 is 10 ms. That is, when the value 500 is loaded, the count time is 5 s.

M0.2 IN

T35 TON

+500

PT

10 ms

Network 11

Reset Memory Bit M0.2

If the time that was set in timer T35 (5 s) has run out, memory bit M0.2 is reset. Load timer T35. If the count time has run out (Preset Time = Current Time), reset memory bit M0.2.

T35

M0.2 R 1

Network 12

Set Output Q0.2

The state of memory bit M0.2 directly affects the state of output bit Q0.2. If memory bit M0.2 is set, output Q0.2 is set. If memory bit M0.2 is reset, output Q0.2 is reset. Load memory bit M0.2. If memory bit M0.2 is set, set output Q0.2.

M0.2

Q0.2

Network 13

End of Main Program // End the main program.

End the main program. MEND

7/7

You might also like