852
26 COUNTER FUNCTION BLOCKS
26.3 Counter Function Block
26.3 Counter Function Block
COUNTER_FB_M
When the execution condition is established, this function block starts counting up.
â– Descriptions, types, and data types
â– Operation processing
• The counter starts counting when detecting the rising edge (from OFF to ON) of (s1). It does not start counting if (s1)
remains ON. The counting is started from the value of (s3). When the count value reaches the value of (s2), (d2) turns ON.
The current count value is stored in (d1).
• A value in the range of 0 to 32767 can be specified for (s2).
• A value in the range of -32768 to 32767 can be specified for (s3). However, when a negative value is specified, the initial
value is set to 0.
• To reset the current value of the counter (d1), reset (s1) of FB directly.
When the label name is TIMER_CONT_FB_M_1
Ladder diagram Structured text
COUNTER_FB_M_1(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:=d2);
Argument Description Type Data type
s1 Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s2 Counter set value Input variable INT
s3 Counter initial value Input variable INT
d1 Counter current value Output variable ANY16
d2 Output Output variable BOOL
[Ladder]
[ST]
RST(M0,TIMER_CONT_FB_M_1.Coil)
[Ladder example]
[Timing chart]
ENO
d
RST
ENM0
TIMER_CONT_FB_M_1.Coll
Preset ValueOut
StatusValueIn
COUNTER_FB_M
Coll
1
10
M0
M10
D10