This manual confers no industrial property rights or any rights of any other kind,
nor does it confer any patent licenses. Mitsubishi Electric Corporation cannot be
held responsible for any problems involving industrial property rights which may
occur as a result of using the contents noted in this manual.
Warranty
Exclusion of loss in opportunity and secondary loss from warranty liability
Regardless of the gratis warranty term, Mitsubishi shall not be liable for compensation to:
(1) Damages caused by any cause found not to be the responsibility of Mitsubishi.
(2) Loss in opportunity, lost profits incurred to the user by Failures of Mitsubishi products.
(3) Special damages and secondary damages whether foreseeable or not, compensation for
accidents, and compensation for damages to products other than Mitsubishi products.
(4) Replacement by the user, maintenance of on-site equipment, start-up test run
and other tasks.
For safe use
This product has been manufactured as a general-purpose part for general
industries, and has not been designed or manufactured to be incorporated in
a device or system used in purposes related to human life.
Before using the product for special purposes such as nuclear power, electric
power, aerospace, medicine or passenger movement vehicles, consult with
Mitsubishi Electric.
This product has been manufactured under strict quality control. However
when installing the product where major accidents or losses could occur if the
product fails, install appropriate backup or failsafe functions in the system.
•
•
•
HEAD OFFICE : TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN
9. Reference (CH1 System Block Diagram)
TO
DISABLE
PRESET
S
YH1
Direct initialization
Count start
16/32-bit Counter
for YH1 output
Matched
Count pulse
TO
TO
TO
Counter mode
Counter mode BFM #0
1-phase
1-input
counter
DOWN/UP command BFM #1
16 bit mode
32 bit mode
Count permit BFM #4 b0
Preset permit BFM #4 b4
Direct initialization
TO
R
S
R
YH2
for YH2 output
Matched
TO
DISABLE
PRESET
YH1
YH2
: Module input/output
: Buffer memory
Preset data
BFM #11,#10
Current value register
BFM #21,#20
Maximum value BFM #23,#22
Minimum value BFM #25,#24
Terminal status
BFM #27
YH2 output reset
BFM #4 b10
Mutual reset action
BFM #4 b3
YH2 compared output
BFM #4 b2
YH2 output set
BFM #4 b12
Comparision data
BFM #15,#14
Compare results
BFM #26
Comparison data
BFM #13,#12
YH1 output reset
BFM #4 b9
YH1 output set
BFM #4 b11
YH1 compared output
BFM#4 b1
CH1 Error flag reset
BFM #4 b8
CH1 Error status
BFM #29 b0 to b8
H/W
DOWN/UP
S/W
DOWN/UP
Ring length upper limit value
BFM #3,#2
*1 The mutual reset action becomes valid only when both the YH1 comparison output and the YH2 comparison output are permitted (BFM #4 b1, b2=ON).
*1
B
A
Z
5. Buffer Memories (BFM)
5.1 Buffer memory List
Note:
1) When writing to BFM #0 (CH1 counter mode), BFM #1 to #27 and #29 bit1 to
6 will be initialized. When writing to BFM #40 (CH2 counter mode), BFM #41
to #67 and #29 bit10 to 15 will be initialized.
When setting the counter mode, use a TOP (pulsed) instruction, or M8002
(initial pulse) to drive the TO instruction. (The continuous operation type
cannot be used.)
2) Read/Write of 16 bit data
When using a positive value between K32,768 and K65,535 with 16 bit
counters, read/writes of data, such as the current value, ring length, preset
data, YH1/YH2 compare value, maximum count value and the minimum
count value should use the 32-bit forms of FROM/TO instructions ((D)
FROM, (D) TO).
3) Read/write of 32 bit data
The usage of a 32-bit FROM/TO instruction is recommended.
In the event that a 16-bit FROM/TO instruction is used, the following cases
need to be considered.
If the writing order is low word first and then high word, the 32 bit data will
be written normally. Data becomes valid after both low and high words are
written.
In the event that data is not written in the order low word first and then high
word, the error bit b7 of BFM #29 turns ON.
5.2 Details of buffer memories
5.2.1
Counter mode
[BFM #0 (CH1), #40 (CH2)]
The counter mode is shown in the upper right table. (Default value: K0)
Note:
When writing to BFM #0 (CH1 counter mode), BFM #1 to #27 and #29 bit1 to 6 will
be initialized. When writing to BFM #40 (CH2 counter mode), BFM #41 to #67 and
#29 bit10 to 15 will be initialized. Please perform the setting of other BFM(s) after
the setting of the counter mode (BFM #0, #40).
When setting the counter mode, use a TOP (pulsed) instruction, or M8002 (initial
pulse) to drive the TO instruction. (The continuous operation type cannot be used.)
BFM #
Description
Default
BFM
Access
CH1
CH2
BFM #0
BFM #40
Counter mode
(Setting range: K0 to K11)
K0
R/W
BFM #1
BFM #41
DOWN/UP command
(1-phase 1-input mode [S/W UP/
DOWN] only)
K0
R/W
BFM #2
BFM #42
Ring length
Lower
K65536
R/W
BFM #3
BFM #43
Upper
R/W
BFM #4
BFM #44 Command
K0
R/W
B F M # 5
~ #9
BFM #45
~ #49
Not used
-
-
BFM #10 BFM #50
Preset data
Lower
K0
R/W
BFM #11 BFM #51
Upper
R/W
BFM #12 BFM #52
YH1 compare value
Lower
K32767
R/W
BFM #13 BFM #53
Upper
R/W
BFM #14 BFM #54
YH2 compare value
Lower
K32767
R/W
BFM #15 BFM #55
Upper
R/W
BFM #16
~ #19
BFM #56
~ #59
Not used
-
-
BFM #20 BFM #60
Counter current value
Lower
K0
R/W
BFM #21 BFM #61
Upper
R/W
BFM #22 BFM #62
Maximum count value
Lower
K0
R/W
BFM #23 BFM #63
Upper
R/W
BFM #24 BFM #64
Minimum count value
Lower
K0
R/W
BFM #25 BFM #65
Upper
R/W
BFM #26 BFM #66 Compare results
-
R
BFM #27 BFM #67 Terminal status
-
R
BFM #28
Not used
-
-
BFM #29
Error status
-
R
BFM #30
Model identification code: K4020
K4020
R
BFM #31 ~ 39
Not used
-
-
BFM #68 ~ 32767
Not used
-
-
1) 16/32-bit counter modes
a) 32-bit counter modes
Modes: K0, K2, K4, K6, K8, K10
A 32-bit binary counter which executes UP/
DOWN counting will change from the lower
limit value to the upper limit value or the
upper limit value to the lower limit value
when overflow occurs. Both the upper and
lower limit values are fixed values: the upper
limit value is +2,147,483,647, and the lower
limit value is -2,147,483,648.
b) 16-bit counter modes
Modes: K1, K3, K5, K7, K9, K11
A 16-bit binary counter handles only positive
values from 0 to 65,535. Changes to zero
from the upper limit value or to the upper
limit value from zero when overflow occurs;
the upper limit value is determined by BFMs
#3 and #2 (CH1), #43 and #42 (CH2).
2) 2-phase counter [1 edge-count] (K0, K1)
3) 2-phase counter [2 edge-count] (K2, K3)
4) 2-phase counter [4 edge-count] (K4, K5)
5) 1-phase 2-input counter (K6, K7)
6) 1-phase 1-input counter [Hardware UP/DOWN] (K8, K9)
7) 1-phase 1-input counter [Software UP/DOWN] (K10, K11)
Count modes
32 bits
16 bits
Reference
2-phase input
(phase difference
pulse)
1 edge count
K0
K1
1), 2)
2 edge count
K2
K3
1), 3)
4 edge count
K4
K5
1), 4)
1-phase 2-input (add/subtract pulse)
K6
K7
1), 5)
1-phase
1-input
Hardware UP/DOWN
K8
K9
1), 6)
Software UP/DOWN
K10
K11
1), 7)
0
+2,147,483,647
Upper limit value
Lower limit value
-2,147,483,648
0
Ring length
CH1 : (BFM #3, #2) -1
CH2 : (BFM #43, #42) -1
Phase A
Phase B
+1
+1
-1
-1
Phase B input OFF
→
ON while phase A input
ON Count up by 1.
Phase B input ON
→
OFF while phase A input
ON Count down by 1.
Phase A
Phase B
+1
+1
-1
-1
Phase B input OFF
→
ON (ON
→
OFF) while
phase A input ON (OFF)
Count up by 1.
Phase B input ON
→
OFF (OFF
→
ON) while
phase A input ON (OFF)
Count down by 1.
DOWN COUNT
Phase A
Phase B
UP COUNT
+1
+1
+1
+1
-1
-1
-1
-1
Phase A
Phase B
ON
OFF
1 0
4
2
3
3
2
1
ON
OFF
Phase A input-1
at OFF
→
ON
Phase B input+1
at OFF
→
ON
Phase A
Phase B
Current
value
UP
DOWN
ON
OFF
ON
OFF
UP/DOWN is
determined by input
phase A (ON/OFF).
BFM #1, #41
Phase B
UP
DOWN
K1
K0
ON
OFF
Current
value
UP/DOWN is determined
by the contents of
BFM #1, #41 (K0/K1).
5.2.2
DOWN/UP command
[BFM #1 (CH1), #41 (CH2)]
When using the 1-phase 1-input counter [Software UP/DOWN] (counter mode: K10,
K11), set the count direction by the current value of BFM #1 or BFM #41. (Default
value: K0)
For the operation, refer to the Subsection 5.2.1 7)
5.2.3
Ring length [BFM #3, #2 (CH1), #43, #42 (CH2)]
When setting the upper limit value of the 16 bit counters, the setting range is K2 to
K65536. (Default value: K65536)
Please use the DTO instruction and write data as 32 bit data.
When ring length K100 is specified, the current value of the counter is changed as
shown the following figure, and the upper limit value is set to 99.
5.2.4
Command [BFM #4 (CH1), #44 (CH2)]
*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, YH1 (compared output) does not turn ON.
*3 Unless b2 is set to ON, YH2 (compared output) does not turn ON.
*4 When b3=ON, YH2 output is reset if YH1 output is set, and YH1 output is reset if
YH2 output is set. When b3=OFF, YH1 and YH2 output act independently, and
do not reset each other.
The mutual reset action becomes valid only when both the YH1 comparison
output and the YH2 comparison output are permitted (b1, b2=ON).
*5 When b4=OFF, the preset function using the PRESET input terminal is disabled.
*6 When bit 5 is set to ON, the counter will be stopped and reset and the outputs
YH1 and YH2 will be switched OFF when the PLC is set from RUN to STOP.
*7 When bit 8 in BFM #4 is set to ON, the error flags bit 1 to 6 in BFM #29 will be
reset. The shared error flags (bit 7 and bit 8) will also be reset if no error on the
other counter channel requires them to remain ON. When bit 8 in BFM #44 is set
to ON, the error flags bit 10 to 15 in BFM #29 will be reset. The shared error flags
(bit 7 and bit 8) will also be reset if no error on the other counter channel requires
them to remain ON. After clearing BFM #29 error flags this flag will be reset
automatically.
*8 b9 to b12 can perform a forced set of the YH1 output or the YH2 output, and
reset.
The output is not changed when the forced set and reset are performed
simultaneously.
5.2.5
Preset data [BFM #11, #10 (CH1), #51, #50 (CH2)]
When BFM #4, #44 b4 is ON and the PRESET input is switched from OFF to ON,
preset data is stored in BFM #21, #20 (CH1) #61, #60 (CH2) (counter current value).
5.2.6
YH1 compare value [BFM #13, #12 (CH1), #53, #52 (CH2)],
YH2 compare value [BFM #15, #14 (CH1), #55, #54 (CH2)]
The comparison set value for the output currently written here and the present value
of the counter are measured, and when the comparison result is equal, the YH1
output or the YH2 output is set to ON within 30
s.
Count Direction
Setting Value
Up count
K0
Down count
K1
Bit No.
Setting Value
OFF (0)
ON (1)
b0
*1
Count prohibit
Count permit
b1
*2
YH1 compared output prohibit
YH1 compared output permit
b2
*3
YH2 compared output prohibit
YH2 compared output permit
b3
*4
YH1/YH2 independent action
Mutual reset action
b4
*5
Preset prohibit
Preset permit
b5
*6
No action if PLC is set from RUN
to STOP
(FX
2N
-1HC compatibility mode)
Counter is stopped and reset if
PLC is set from RUN to STOP
b6, b7
Not used
b8
*7
No action
Error flag reset
b9
*8
No action
YH1 output reset
b10
*8
No action
YH2 output reset
b11
*8
No action
YH1 output set
b12
*8
No action
YH2 output set
b13 ~ b15
Not used
UP
99
98
0
1
DOWN
1
0
98
99
Output occurs when the current value becomes equal to the compare value but
only if b1 and b2 of BFM #4, #44 are ON. Once an output is set, it remains ON
until it is reset by b9 or b10 of BFM #4, #44.
If b3 of BFM #4, #44 is ON, however, one of the outputs is reset when the other is set.
(refer to the following figure)
5.2.7
Counter current value [BFM #21, #20 (CH1), #61, #60 (CH2)]
The current value of the counter can be read by the PLC. It will not be an accurate
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.
5.2.8
Maximum count value [BFM #23, #22 (CH1), #63, #62 (CH2)],
Minimum count value [BFM #25, # 24 (CH1), #65, #64 (CH2)]
These BFM store the maximum and minimum value reached by the counter. If the
power is turned off, the stored data is cleared. Any value written to maximum and
minimum count value in 16 bit counter mode which is exceeding the valid range
(0 <= value < ring length) will be automatically adjusted. Values < 0 will be
adjusted to 0, values >= ring length will be adjusted to "ring length" - 1.
5.2.9
Compare results [BFM #26 (CH1), #66 (CH2)]
5.2.10 Terminal status [BFM #27 (CH1), #67 (CH2)]
5.2.11
Error status
[BFM #29]
Bit No.
Target
output
OFF (0)
ON (1)
b0
YH1
Compare value
current value Compare value
current value
b1
Compare value
current value Compare value
current value
b2
Compare value
current value Compare value
current value
b3
YH2
Compare value
current value Compare value
current value
b4
Compare value
current value Compare value
current value
b5
Compare value
current value Compare value
current value
b6 ~ b15
Not used
Bit N0.
Signal Name
OFF (0)
ON (1)
b0
PRESET input
OFF
ON
b1
DISABLE input
OFF
ON
b2
YH1 output
OFF
ON
b3
YH2 output
OFF
ON
b4 ~ b15
Not used
Bit N0.
Error Status
b0
Set when any of b1 to b15 is ON.
b1
Set when the value of the ring length is
written incorrectly. (CH1)
Outside of K2 to K65,536
Written while CH1 is in
32-bit counter mode
Ring length changed
while counter running
b2
Set when the preset value is written
incorrectly. (CH1)
Value is other than "K0 to ring
length-1" for 16-bit counters.
b3
Set when the compare value is written
incorrectly. (CH1)
Value is other than "K0 to ring
length-1" for 16-bit counters.
b4
Set when the current value is written
incorrectly. (CH1)
b5
Set when the counter overflows the
upper limit. (CH1)
When the upper or lower limit
i s e x c e e d e d o n a 3 2 - b i t
counter.
b6
Set when the counter underflows the
lower limit. (CH1)
b7
Set when the FROM/TO command is used incorrectly.
*1
YH1/YH2 output
Current value
YH1/YH2
compare value
BFM #4,#44
b9,b10:ON
BFM #4,#44
b9,b10:ON
YH1 compare value
YH2 compare value
Current value
YH1 output
YH2 output
*1 In the following case, BFM #29 b7 turns on.
write in a BFM that is not used
writing to read only BFMs
accessing 32 bit BFMs using the FROM/TO command in the wrong order
Error status in the FX
3U
-2HC can be checked by reading the contents of b0 to b15
of BFM #29 to auxiliary relays of the PLC.
The error flag of b1 to b8 is reset-table with ON of BFM #4 b8. The error flag of b7,
b8 and b10 to b15 is resettable with ON of BFM #44 b8. The error flags in BFM
#29 can also be reset by writing 0 to it. The Hardware error flag (bit 9 of BFM #29)
can not be cleared.
5.2.12
Model identification code
[BFM #30]
This BFM stores the identification number for the FX
3U
-2HC.
The identification number for the FX
3U
-2HC unit is K4020.
By reading this identification number, the user may create built-in checking
routines to check whether the physical position of the FX
3U
-2HC matches that of
the software.
6. Example Program
Please use the following program as a guide whenever you use the FX
3U
-2HC unit.
Other instructions to read the current value of the counter, status etc. can be added
as required.
Bit N0.
Error Status
b8
Set when the counter mode (BFM #0,
#40) is written incorrectly.
Except K0 to K11
b9
Hardware error (UP, DOWN LED turn ON)
b10
Set when the value of the ring length is
written incorrectly. (CH2)
Outside of K2 to K65,536
Written while CH2 is in
32-bit counter mode
Ring length changed
while counter running
b11
Set when the preset value is written
incorrectly. (CH2)
Value is other than "K0 to
ring length-1" for 16-bit
counters.
b12
Set when the compare value is written
incorrectly. (CH2)
b13
Set when the current value is written
incorrectly. (CH2)
b14
Set when the counter overflows the upper
limit. (CH2)
When the upper or lower
limit is exceeded on a 32-
bit counter.
b15
Set when the counter underflows the
lower limit. (CH2)
K11
K2
K0
K1
K1234
K2
K2
K1
K1
K2
K1
K1
M8002
Initial
pulse
K11 is written into BFM #0 (CH1) of special function block No.2.
The counter input is 16-bit 1-phase.
Please use a pulse command for this initialization.
K1234
BFM #3, #2 (CH1) (special function block No.2)
The ring length can be specified when a 16-bit counter is specified.
UP/DOWN direction should be specified for 1-phase 1-input
software determined UP/DOWN counter.
FNC 79
TO
FNC 79
DTO
FNC 79
TO
K1000
K2
K12
K1
K900
K2
K14
K1
FNC 79
DTO
FNC 79
DTO
K1000
BFM #13, #12 (CH1)
Set the compare value for YH1 output.
K900
BFM #15, #14 (CH1)
Set the compare value for YH2 output
(not necessary if only YH1 output is used).
~
M8000
M11
M13
Count allowed
Output allowed,
Mutual reset
Preset allowed
Error flag reset
YH1 output reset
YH2 output reset
X010
M10
X011
M14
X012
PLS
M18
X013
PLS
M19
PLS
M20
Counting only occurs if the count permit is set to ON. Also, outputs will not be set from
the counting process at all if the relevant output prohibit is set in the command register.
Please reset error flags and YH1/YH2 output before you start. The mutual reset and
preset initialization commands can be used as required.
The following programs are the examples of error processing.
Error status in the FX
3U
-2HC can be checked by reading the contents of b0 to b15 of
BFM #29 to auxiliary relays of the PLC. These error flags are resettable BFM #4, #44 b8.
7. Preliminary checks
1) Check that the I/O wiring and extension cable of the FX
3U
-2HC are properly
connected.
2) The FX
3U
-2HC occupies 8 points of I/O on the FX
3U
, FX
3UC
expansion bus. The
8 points can be allocated from either inputs or outputs.
5V DC 245mA power is supplied from the main or extension power supply units
for the FX
3U
-2HC. Check that there is no power overload from this and other
extension blocks.
3) The counter works correctly only when data such as the counter mode (set with a
pulse command), the TO command, the compare value, etc. are appropriately
specified. Remember to initialize the count (BFM #4, #44 b0), preset (BFM #4,
#44 b4), and output (BFM #4, #44 b2, b1) prohibits. The YH1/YH2 outputs are
reset during start.
Note:
Inputting pulses higher than the maximum frequency may cause miscounting in the
FX
3U
-2HC or a FROM/TO error in the PLC main unit.
8. Diagnostics
1) The following LEDs on the main panel of the FX
3U
-2HC may help you to
troubleshoot the unit.
a)
A, B:
Goes on/off as A, B input turn ON/OFF. It can be checked by rotating the
encoder slowly.
b) UP, DOWN:
Lights up to indicate whether the counter is going up (UP) or down (DOWN).
c) PRE, DIS:
The appropriate LED lights up when the PRESET (PRE) terminal or the
DISABLE (DIS) terminal is ON.
d) YH1, YH2:
The appropriate LED lights up when YH1/YH2 output is turned on.
2) You can check the error status by reading the content of BFM #29 to the PLC.
For error contents, refer to the Subsection 5.2.11
STARTUP AND MAINTE-
NANCE PRECAUTIONS
Do not disassemble or modify the PLC.
Doing so may cause fire, equipment failures, or malfunctions.
*For repair, contact your local Mitsubishi Electric representative.
Do not drop the product or exert strong impact to it.
Doing so may cause damage.
DISPOSAL
PRECAUTIONS
Please contact a certified electronic waste disposal company for the
environmentally safe recycling and disposal of your device.
TRANSPORTATION AND
STORAGE PRECAUTIONS
The product is a precision instrument. During transportation, avoid impacts larger
than those specified in the general specifications by using dedicated packaging
boxes and shock-absorbing palettes. Failure to do so may cause failures in the
product. After transportation, verify operation of the product and check for
damage of the mounting part, etc.
M8000
K4M10
K2
K4
K1
D2
K2
K20
K1
RUN
monitor
FNC 79
TO
FNC 78
DFROM
M25 to M10
o
BFM #4 (b15 to b0) command (CH1)
BFM #21, #20
o
Reads the current value to the data registers D3 and D2. (CH1)
K4M100
K2
K29
K1
K4M10
K2
K4
K1
M8000
X004
M100
M18
Error flag reset
Y10
Error occurrence (BFM#29 b1 to b15 turn on)
M109
Y12
Hardware error occurrence
M108
Y11
Mode setting error occurrence
M8000
BFM #4 (CH1)
command write
FNC 78
FROM
FNC 79
TO
1RWH7KLVV\PEROPDUNLVIRU&KLQDRQO\
᳝᳝ᆇ⠽䋼ⱘৡ⿄ˈ᳝䞣ˈ᳝䚼ક
ǂᴀѻકЁ᠔᳝ⱘ᳝ᆇ ⠽䋼ⱘৡ⿄ˈ᳝䞣ˈ᳝䚼કབϟ㸼᠔⼎DŽ
ѻકЁ᳝ᆇ⠽䋼ⱘৡ⿄ঞ䞣
ᴀ㸼Ḑձ6-7ⱘ㾘ᅮ㓪ࠊDŽ
ƻ㸼⼎䆹᳝ᆇ⠽䋼䆹䚼ӊ᠔᳝ഛ䋼ᴤ᭭Ёⱘ䞣ഛ*%7
㾘ᅮⱘ䰤䞣㽕∖ҹϟDŽ
h㸼⼎䆹᳝ᆇ⠽䋼㟇ᇥ䆹䚼ӊⱘᶤϔഛ䋼ᴤ᭭Ёⱘ䞣䍙ߎ*%7
㾘ᅮⱘ䰤䞣㽕∖DŽ
䚼ӊৡ⿄
᳝ᆇ⠽䋼
䪙
3E
∲
+J
䬝
&G
݁Ӌ䫀
&U9,
⒈㘨㣃
3%%
⒈Ѡ㣃䝮
3%'(
ৃ㓪
ࠊ఼
ॄࠋᵓ
ƻ
ƻ
ƻ
ƻ
ƻ
ƻ
ƻ
ƻ
ƻ
ƻ
ƻ
h
Nj⬉఼⬉ᄤѻક᳝ᆇ⠽䋼䰤ࠊՓ⫼ᷛ䆚㽕∖njⱘ㸼⼎ᮍᓣ
ѢЁᷛޚ⊩ⱘখ㗗㾘Ḑ*%7