Description
You can use the instruction "Generate on-delay" to delay setting of the Q output by the time configured with the PT time. The instruction is started when the result of logic operation (RLO) at input IN changes from "0" to "1" (positive signal edge). The programmed time PT begins when the instruction starts. When the time PT has elapsed, the output Q has the signal state "1". Output Q remains set as long as the start input is still "1". When the signal state at the start input changes from "1" to "0", the Q output is reset. The timer function is started again when a new positive signal edge is detected at the start input.
The current time value can be queried at the output ET. The timer value starts at T#0s and ends when the value of the time duration PT is reached. The ET output is reset as soon as the signal state at the IN input changes to "0". If the instruction is not called in the program because it is skipped, for example, the ET output returns a constant value as soon as the time PT has expired.
The "Generate on-delay" instruction can be placed within or at the end of the network. It requires a preceding logic operation.
Each call of the "Generate on-delay" instruction must be assigned to an IEC timer in which the instance data is stored.
For S7-1200 CPU
An IEC Timer is a structure of the data type IEC_TIMER or TON_TIME that you can declare as follows:
-
Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIMER")
-
Declaration as a local tag of the type TON_TIME or IEC_TIMER in the "Static" section of a block (for example, #MyIEC_TIMER)
For S7-1500 CPU
An IEC Timer is a structure of the data type IEC_TIMER, IEC_LTIMER, TON_TIME or TON_LTIME that you can declare as follows:
-
Declaration of a data block of system data type IEC_TIMER or IEC_LTIMER (for example, "MyIEC_TIMER")
-
Declaration as a local tag of the type TON_TIME, TON_LTIME, IEC_TIMER or IEC_LTIMER in the "Static" section of a block (for example, #MyIEC_TIMER)
The instruction data is updated in the following cases:
-
When the instruction is called if the ET or Q outputs are interconnected. If the outputs are not interconnected, the current time value at output ET is not updated.
-
At an access to the Q or ET outputs.
Updating the actual values in the instance data
The instance data from "Generate on-delay" is updated according to the following rules:
-
IN input
The "Generate on-delay" instruction compares the current RLO with the RLO from the previous query, which is saved in the IN parameter in the instance data. If the instruction detects a change in the RLO from "0" to "1", there is a positive signal edge and the time measurement is started. After the "Generate on-delay" instruction has been processed, the value of the IN parameter is updated in the instance data and is used as edge memory bit for the next query.
Note that the edge evaluation is disrupted when the actual values of the IN parameter are written or initialized by other functions.
-
PT input
The value at the PT input is written to the PT parameter in the instance data when the edge changes at the IN input.
-
Q and ET outputs
The actual values of the Q and ET outputs are updated in the following cases:
-
When the instruction is called, if the ET or Q outputs are interconnected.
Or
-
At an access to Q or ET.
If the outputs are not interconnected and also not queried, the current time value at the Q and ET outputs is not updated. The outputs are not updated, even if the instruction is skipped in the program.
The internal parameters of the "Generate on-delay" instruction are used to calculate the time values for Q and ET. Note that the time measurement is disrupted when the actual values of the instruction are written or initialized by other functions.
-
|
|
Danger |
|
Danger when reinitializing the actual values Reinitializing the actual values of an IEC timer while the time measurement is running disrupts the function of the IEC timer. Changing the actual values can result in inconsistencies between the program and the actual process. This can cause serious damage to property and personal injury. The following functions can cause the actual values to be reinitialized:
Before you execute these functions, take the following precautions:
|
|
Parameters
The following table shows the parameters of the "Generate on-delay" instruction:
|
Parameters |
Declaration |
Data type |
Memory area |
Description |
||
|---|---|---|---|---|---|---|
|
S7-1200 |
S7-1500 |
S7-1200 |
S7-1500 |
|||
|
IN |
Input |
BOOL |
BOOL |
I, Q, M, D, L or constant |
I, Q, M, D, L, T,C, P or constant |
Start input |
|
PT |
Input |
TIME |
TIME, LTIME |
I, Q, M, D, L or constant |
I, Q, M, D, L, P or constant |
Duration of the on delay. The value of the PT parameter must be positive. |
|
Q |
Output |
BOOL |
BOOL |
I, Q, M, D, L |
I, Q, M, D, L, P |
Output that is set when the time PT expires. |
|
ET |
Output |
TIME |
TIME, LTIME |
I, Q, M, D, L |
I, Q, M, D, L, P |
Current timer value |
Pulse timing diagram
The following figure shows the pulse timing diagram of the "Generate on-delay" instruction:
Example
The following example shows how the instruction works:
The following table shows how the instruction works using specific operand values:
|
Parameters |
Operand |
Value |
|---|---|---|
|
IN |
Tag_Start |
Signal transition "0" => "1" |
|
PT |
Tag_PresetTime |
T#10s |
|
Q |
Tag_Status |
FALSE; after 10 s => TRUE |
|
ET |
Tag_ElapsedTime |
from T#0s => T#10s |
When the signal state of the "Tag_Start" operand changes from "0" to "1", the time programmed for the PT parameter is started. When the time duration expires, the "Tag_Status" operand is set to the signal state "1". The Tag_Status operand remains set to "1" as long as the Tag_Start operand has signal state "1". The current time value is stored in the "Tag_ElapsedTime" operand. When the signal state at the operand "Tag_Start" changes from "1" to "0", the "Tag_Status" operand is reset.