Description
The "Assign on-delay timer parameters and start" instruction starts a programmed timer when a change from "0" to "1" (positive signal edge) is detected in the result of logic operation (RLO) at input S. The timer expires with the programmed duration (TV) as long as the signal state at input S is "1". If the timer expires correctly and input S still has signal state "1", output Q returns signal state "1". If the signal state at input S changes from "1" to "0" while the timer is running, the timer is stopped. In this case, output Q is reset to signal state "0".
The duration is made up internally of a time value and a time base and is programmed at parameter TV. When the instruction is started, the programmed time value is counted down to zero. The time base specifies the time period with which the time value is changed. The current time value is output binary-coded at output BI and BCD-coded at output BCD.
If the time is running and the signal state at input R changes from "0" to "1", the current time value and the time base are also set to zero. In this case, the signal state at output Q is "0". The timer is reset if the signal state is "1" at the R input even if the timer is not running and the RLO at input S is "1".
The "Assign on-delay timer parameters and start" instruction requires a preceding logic operation for the edge evaluation and can be placed within or at the end of the network.
The instruction data is updated at every access. It can therefore happen that the query of the data at the start of the cycle returns different values than at the end of the cycle.
|
Note In the time cell, the operating system reduces the time value in an interval specified by the time base by one unit until the value equals "0". The decrementation is performed asynchronously to the user program. The resulting timer is therefore at maximum up to one time interval shorter than the desired time base. |
You can find an example of how a time cell can be formed under: See also "L: Load timer value".
Parameters
The following table shows the parameters of the "Assign on-delay timer parameters and start" instruction:
|
Parameters |
Declaration |
Data type |
Memory area |
Description |
|---|---|---|---|---|
|
<Timer> |
Input |
TIMER |
T |
Time of the instruction The number of timers depends on the CPU. |
|
S |
Input |
BOOL |
I, Q, M, T, C, D, L, P or constant |
Start input |
|
TV |
Input |
S5TIME, WORD |
I, Q, M, D, L or constant |
Time duration |
|
R |
Input |
BOOL |
I, Q, M, T, C, D, L, P or constant |
Reset input |
|
BI |
Output |
WORD |
I, Q, M, D, L, P |
Current time value (binary-coded) |
|
BCD |
Output |
WORD |
I, Q, M, D, L, P |
Current time value (BCD format) |
|
Q |
Output |
BOOL |
I, Q, M, D, L, P |
Status of the timer |
You can find more information on the valid data types under "See also".
Pulse timing diagram
The following figure shows the pulse timing diagram of the "Assign on-delay timer parameters and start" instruction:
Example
The following example shows how the instruction works:
"Timer_1" is started when the signal state of the "TagIn_1" operand changes from "0" to "1". The timer expires with the time value of the operand "TagIn_Number". When the timer has expired and the signal state of the operand is "1", the "TagOut" operand is set to "1". If the signal state of the operand "TagIn_1" changes from "1" to "0" before the timer expires, the timer is stopped. In this case the operand "TagOut" returns the signal state "0".