Description
You can use the "Set counter value" instruction to set the value of a counter. The instruction is executed when the result of logic operation (RLO) at the start input of the instruction changes from "0" to "1". When the instruction is executed, the counter is set to the specified counter value.
The "Set counter value" instruction needs a preceding logic operation for the edge evaluation and can only be placed on the right edge of the network.
Parameters
The following table lists the parameters of the "Set counter value" instruction:
|
Parameters |
Declaration |
Data type |
Memory area |
Description |
|---|---|---|---|---|
|
<operand> |
Input |
BOOL |
I, Q, M, T, C, D, L |
Start input |
|
PV |
Input |
WORD |
I, Q, M, D, L or constant |
Value with which the counter is preset in the BCD format. (C#0 to C#999) |
|
<counter> |
InOut/Input |
COUNTER |
C |
Counter that is preset. |
For additional information on valid data types, refer to "See also".
Example
The following example shows how the instruction works:
the counter "Counter_1" starts with the value "100" when the signal state of the "TagIn" operand changes from "0" to "1".