Technical data
Appendix
27.6 Sample Programs
Programming with STEP 7
662 Manual, 05/2010, A5E02789666-01
27.6.4 Example of Handling Time-Delay Interrupts
Structure of the User Program "Time-Delay Interrupts"
OB20
OB1
27.6.4.1 Structure of the User Program "Time-Delay Interrupts"
Task
When input I 0.0 is set, output Q 4.0 should be set 10 seconds later. Every time input I 0.0 is set,
the delay time should be restarted.
The time (seconds and milliseconds) of the start of the time-delay interrupt should appear as a
user-specific ID in the start event information of the time-delay interrupt OB (OB20).
If I 0.1 is set in these 10 seconds, the organization block OB20 should not be called; meaning the
output Q 4.0 should not be set.
When input I 0.2 is set, output Q 4.0 should be reset.
Translating into a User Program
The following table shows the sub-tasks of the blocks used.
Block Sub-Task
OB1 Read current time and prepare for start of time-delay interrupt
Dependent on edge change at input I 0.0, start time-delay interrupt
Depending on the status of the time-delay interrupt and the edge change at input I 0.1,
cancel time-delay interrupt
Dependent on the state of input I 0.2, reset output Q 4.0
OB20 Set output Q 4.0
Read and prepare current time
Save start event information to bit memory area