
2) BFM #3, #2 Ring length
Note: Write counter data with (D) TO
• Count data is always handled as a pair from two 16-bit values in this special function block. 16-bit 2’s
complement value stored in the registers of the PLC cannot be used.
• When you are writing a positive value between K32,768 and K65,535, the data should be treated as a
32-bit value even when a 16-bit ring counter is used.
• When transferring counter data to/from this special function block, always use the 32-bit forms of the
FROM/TO instructions ((D) FROM, (D) TO).
3) BFM #4 Command
4) BFM #11, #10 Preset data
• Data to used as the initial value when the counter starts to count.
• Data becomes valid when b4 of BFM #4 is set to ON, and PRESET input terminal changes from OFF
to ON. The default value of the counter is zero. You can change it by writing a value into BFM #11 and
#10 or by using the command below.
• The initial counter value can also be set by writing the data directly into BFM #21 and #20 (current
value of the counter).
5) BFM #13, #12 Comparison value for YH output, BFM #15, #14 Comparison value for YS output
• After comparing the current value of the counter with the value
written in BFM #13 and #12, BFM #15 and #14, the hardware and
software comparator in the FX2N-1HC outputs the comparison
result.
• YH, YS output will not turn ON if you use PRESET or the TO
instruction to set the counter value equal to the comparison
value. It will turn ON only when a match occurs by the counting of
input pulses.
• The YS comparison operation takes about 300µs, and if a match
occurs, the output goes ON.
• Output occurs when the current value becomes equal to the compare value but only if b1 and b2 of
BFM #4 are ON. Once an output is set, it remains ON until it is reset by b9 or b10 of BFM #4. If b3 of
BFM #4 is ON, however, one of the outputs is reset when the other is set.
6) Counter current value (BFM #21, 20)
The current value of the counter can be read by the PLC. It will not be the correct value during
high-speed operations because of the communication delay. The current value of the counter can be
forcibly changed by writing a 32-bit value into the appropriate BFMs from the PLC.
7) Maximum count value (BFM #23, 22)
These store the maximum and minimum value reached by the counter. If the power is turned off, the
stored data is cleared.
8) Comparison status (BFM #26)
BFM #26 is for reading only. Write commands from the programmable controller are ignored.
9) Terminal status (BFM #27)
BFM#4 When ’0’(OFF) When ’1’(ON)
b0 Count prohibit Count permit
b1 YH output prohibit YH output permit
b2 YS output prohibit YS output permit
b3 YH/YS independent
action
Mutual reset
action
b4 Preset prohibit Preset permit
b5 to b7 Undefined
b8 No action Error flag reset
b9 No action YH output reset
b10 No action YS output reset
b11 No action YH output set
b12 No action YS output set
BFM#26 When ’0’ (OFF) When ’1’ (ON) BFM#26 When ’0’ (OFF) When ’1’ (ON)
YH
b0 Set value ≤current
value
Set value > current
value
YS
b3 Set value ≤current
value
Set value > current
value
b1 Set value ≠current
value
Set value = current
value b4 Set value ≠current
value
Set value = current
value
b2 Set value ≥current
value
Set value < current
value b5 Set value ≥current
value
Set value < current
value
BFM#26 When ’0’ (OFF) When ’1’ (ON) BFM#26 When ’0’ (OFF) When ’1’ (ON)
b0 PRESET input is OFF. PRESET input is ON. b2 YH output is OFF. YH output is ON.
b1 DISABLE input is OFF. DISABLE input is ON. b3 YS output is OFF. YS output is ON.
b4-b15 Undefined
X 002
T0 K2 K2 K100 K1
D
UP
DOWN
98 99 0 1
1 0 99 98
In the above example, K100 is written into BFMs #3 and
#2 of special block No.2 as a 32-bit binary value (BFM
#3 = 0, BFM #2 = 100). Permitted values: K2 to K65,536.
When ring length K100 is specified, the
value of the counter changes as shown
above.
Stores the data that specifies the length of the
16-bit counter (default: K65,536).
1. When b0 is set to ON and the DISABLE input
terminal to OFF, the counter is permitted to
start counting input pulses.
2. Unless b1 is set to ON, YH (hardware
compared output) does not turn ON.
3. Unless b2 is set to ON, YS (software
compared output) does not turn ON.
4. When b3=ON, YS output is reset if YH output
is set, and YH output is reset if YS output is
set. When b3=OFF, YH and YS output act
independently, and do not reset each other.
5. When b4=OFF, preset function by the
PRESET input terminal is disabled.
6. When b8 is set to ON, all error flags are reset.
7. When b9 is set to ON, YH output is reset.
8. When b10 is set to ON, YS output is reset.
9. When b11 is set to ON, YH output is set ON.
10.When b12 is set to ON, YS output is set ON.
Current value
Current value
BFM #4
b9,b10
Coincidence output
Current value
Current value
BFM #4
b9,b10
Coincidence output