Manual Completo Do Modbus No CLP
Manual Completo Do Modbus No CLP
USER’S MANUAL
Before installing, operating, maintenance or inspecting this product, thoroughly read through and understand
this manual and all of the associated manuals. Also, take care to handle the module properly and safety.
This manual classifies the safety precautions into two categories: and .
Depending on the circumstances, procedures indicated by may also cause severe injury.
In any case, it is important to follow the directions for usage.
Store this manual in a safe place so that it can be taken out and read whenever necessary. Always forward it
to the end user.
1. DESIGN PRECAUTIONS
• Make sure to have the following safety circuits outside of the PLC to ensure safe system operation even during
external power supply problems or PLC failure.
Otherwise, malfunctions may cause serious accidents.
1) Most importantly, have the following: an emergency stop circuit, a protection circuit, an interlock circuit for
opposite movements (such as normal vs. reverse rotation), and an interlock circuit (to prevent damage to the
equipment at the upper and lower positioning limits).
2) Note that when the PLC CPU detects an error, such as a watchdog timer error, during self-diagnosis, all
outputs are turned off. Also, when an error that cannot be detected by the PLC CPU occurs in an input/output
control block, output control may be disabled.
External circuits and mechanisms should be designed to ensure safe machinery operation in such a case.
3) Note that the output current of the service power supply for sensors varies depending on the model and the
absence/presence of extension blocks. If an overload occurs, the voltage automatically drops, inputs in the
PLC are disabled, and all outputs are turned off.
External circuits and mechanisms should be designed to ensure safe machinery operation in such a case.
4) Note that when an error occurs in a relay, triac or transistor output device, the output could be held either on or
off.
For output signals that may lead to serious accidents, external circuits and mechanisms should be designed to
ensure safe machinery operation in such a case.
• Do not bundle the main circuit line together with or lay it close to the main circuit, high-voltage line or load line.
Otherwise, noise disturbance and/or surge induction are likely to take place. As a guideline, lay the control line at
least 100mm (3.94") or more away from the main circuit or high-voltage lines.
• Install module so that excessive force will not be applied to the built-in programming port, power connectors, I/O
connectors, communication connectors, or communication cables.
Failure to do so may result in wire damage/breakage or PLC failure.
(1)
Safety Precautions
(Read these precautions before use.)
2. WIRING PRECAUTIONS
• Make sure to cut off all phases of the power supply externally before attempting installation or wiring work.
Failure to do so may cause electric shock or damage to the product.
• Make sure to attach the terminal cover, offered as an accessory, before turning on the power or initiating operation
after installation or wiring work.
Failure to do so may cause electric shock.
• Make sure to observe the following precautions in order to prevent any damage to the machinery or accidents due
to abnormal data written to the PLC under the influence of noise:
1) Do not bundle the main circuit line together with or lay it close to the main circuit, high-voltage line or load line.
Otherwise, noise disturbance and/or surge induction are likely to take place. As a guideline, lay the control line
at least 100mm (3.94") or more away from the main circuit or high-voltage lines.
2) Ground the shield wire or shield of the shielded cable at one point on the PLC. However, do not use common
grounding with heavy electrical systems.
• Make sure to properly wire to the European terminal board in accordance with the following precautions.
Failure to do so may cause electric shock, equipment failures, a short-circuit, wire breakage, malfunctions, or
damage to the product.
- The disposal size of the cable end should follow the dimensions described in the manual.
- Tightening torque should follow the specifications in the manual.
- Twist the end of strand wire and make sure that there are no loose wires.
- Do not solder-plate the electric wire ends.
- Do not connect more than the specified number of wires or electric wires of unspecified size.
- Affix the electric wires so that neither the terminal block nor the connected parts are directly stressed.
(2)
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition
Foreword
This manual explains the "MODBUS serial communication" provided in FX3G/FX3U/FX3UC Series
Programmable Controllers and should be read and understood before attempting to install or use the unit.
Store this manual in a safe place so that you can take it out and read it whenever necessary. Always forward
it to the end user.
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.
1
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition
Outline Precautions
• This manual provides information for the use of the FX3G/FX3U/FX3UC Series MODBUS serial
communication. The manual has been written to be used by trained and competent personnel. The
definition of such a person or persons is as follows:
1) Any engineer who is responsible for the planning, design and construction of automatic equipment
using the product associated with this manual should be of a competent nature, trained and qualified
to the local and national standards required to fulfill that role. These engineers should be fully aware of
all aspects of safety with regards to automated equipment.
2) Any commissioning or service engineer must be of a competent nature, trained and qualified to the
local and national standards required to fulfill that job. These engineers should also be trained in the
use and maintenance of the completed product. This includes being completely familiar with all
associated documentation for the said product. All maintenance should be carried out in accordance
with established safety practices.
3) All operators of the completed equipment should be trained to use that product in a safe and
coordinated manner in compliance to established safety practices. The operators should also be
familiar with documentation which is connected with the actual operation of the completed equipment.
Note: The term 'completed equipment' refers to a third party constructed device which contains or uses
the product associated with this manual
• 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.
• When combining this product with other products, please confirm the standard and the code, or regulations
with which the user should follow. Moreover, please confirm the compatibility of this product to the system,
machine and apparatus which a user is using.
• If in doubt at any stage during the installation of the product, always consult a professional electrical
engineer who is qualified and trained to the local and national standards. If in doubt about the operation or
use, please consult the nearest Mitsubishi Electric distributor.
• Since the examples indicated by this manual, technical bulletin, catalog, etc. are used as a reference,
please use it after confirming the function and safety of the equipment and system. Mitsubishi Electric will
accept no responsibility for actual use of the product based on these illustrative examples.
• This manual content, specification etc. may be changed without a notice for improvement.
• The information in this manual has been carefully checked and is believed to be accurate; however, if you
have noticed a doubtful point, a doubtful error, etc., please contact the nearest Mitsubishi Electric
distributor.
Registration
• MODBUS® is a registered trademark of Schneider Electric S.A.
• The company name and the product name to be described in this manual are the registered trademarks or
trademarks of each company.
2
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition Table of Contents
Table of Contents
SAFETY PRECAUTIONS .................................................................................................. (1)
Related manuals........................................................................................................................ 6
Generic Names and Abbreviations Used in Manuals ............................................................ 8
1. Outline 9
2. Specifications 13
3. System Configuration 17
4. Wiring 25
5. Communication Setup 32
3
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition Table of Contents
8. Master Specification 84
4
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition Table of Contents
9. Slave Specification 90
Warranty................................................................................................................................. 119
Revised History ..................................................................................................................... 120
5
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition Related manuals
Related manuals
For a detailed explanation of the MODBUS serial communication network in FX3G/FX3U/FX3UC PLCs, refer to
this manual.
For hardware information and instructions on the PLC main unit, other special function units/blocks, etc., refer
to the appropriate manuals.
For acquiring required manuals, contact the distributor from where your product was purchased.
~Essential manual
{Manual required depending on application
UManual with additional manual for detailed explanation
Manual Model
Manual name Contents
number name code
Manuals for PLC main unit
FX3G PLC main unit
I/O specifications, wiring and installation of the
Supplied PLC main unit FX3G extracted from the FX3G
FX3G Series
U with JY997D33401 Series User’s Manual - Hardware Edition. For −
Hardware Manual
product detailed explanation, refer to the FX3G Series
User’s Manual - Hardware Edition.
Details about the hardware including I/O
Additional FX3G Series User’s Manual
~ JY997D31301 specifications, wiring, installation and 09R521
Manual - Hardware Edition
maintenance of the FX3G PLC main unit.
FX3U PLC main unit
I/O specifications, wiring and installation of the
Supplied PLC main unit FX3U extracted from the FX3U
FX3U Series
U with JY997D18801 Series User’s Manual - Hardware Edition. For −
Hardware Manual
product detailed explanation, refer to the FX3U Series
User’s Manual - Hardware Edition.
Details about the hardware including I/O
Additional FX3U Series User’s Manual
~ JY997D16501 specifications, wiring, installation and 09R516
Manual - Hardware Edition
maintenance of the FX3U PLC main unit.
FX3UC PLC main unit
I/O specifications, wiring and installation of the
PLC main unit FX3UC (D, DS, DSS) extracted
Supplied
FX3UC(D, DS, DSS)Series from the FX3UC Series User’s Manual -
U with JY997D28601 −
Hardware Manual Hardware Edition. For detailed explanation,
product
refer to the FX3UC Series User’s Manual -
Hardware Edition.
I/O specifications, wiring and installation of the
PLC main unit FX3UC-32MT-LT-2 extracted
Supplied
FX3UC-32MT-LT-2 from the FX3UC Series User’s Manual -
U with JY997D31601 −
Hardware Manual Hardware Edition. For detailed explanation,
product
refer to the FX3UC Series User’s Manual -
Hardware Edition.
Details about the hardware including I/O
Additional FX3UC Series User’s
~ JY997D28701 specifications, wiring, installation and 09R519
Manual Manual - Hardware Edition
maintenance of the FX3UC PLC main unit.
Programming
FX3G/FX3U/FX3UC Series Items related to programming in PLCs
Additional Programming Manual - including explanation of basic instructions,
~ JY997D16601 09R517
Manual Basic & Applied Instruction applied instructions and various devices in
Edition FX3G/FX3U/FX3UC PLCs.
MELSEC-Q/L/F Structured Programming methods, specifications,
Additional
{ Programming Manual SH-080782 functions, etc. required to create structured 13JW06
Manual
(Fundamentals) programs.
FXCPU Structured
Additional Devices, parameters, etc. provided in
{ Programming Manual JY997D26001 09R925
Manual structured projects of GX Works2.
(Device & Common)
6
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition Related manuals
~Essential manual
{Manual required depending on application
UManual with additional manual for detailed explanation
Manual Model
Manual name Contents
number name code
FXCPU Structured
Additional Programming Manual Sequence instructions provided in structured
{ JY997D34701 09R926
Manual (Basic & Applied projects of GX Works2.
Instruction)
FXCPU Structured
Additional Application functions provided in structured
{ Programming Manual JY997D34801 09R927
Manual projects of GX Works2.
(Application Functions)
Manuals for MODBUS serial communication network
Handling procedures of the RS-232C
communication special adapter.
For MODBUS serial communication network,
refer also to the FX3G/FX3U/FX3UC Series
Supplied
FX3U-232ADP-MB User’s Manual - MODBUS Serial
U with JY997D26401 −
Installation Manual Communication Edition.
product
For computer link or non- protocol
communication by RS instructions, refer also
to the FX Series User’s Manual - Data
Communication Edition.
Handling procedures of the RS-485
communication special adapter.
For MODBUS serial communication network,
refer also to the FX3G/FX3U/FX3UC Series
Supplied
FX3U-485ADP-MB User’s Manual - MODBUS Serial
U with JY997D26301 −
Installation Manual Communication Edition.
product
For N:N link, parallel link, computer link or non-
protocol communication by RS instructions,
refer also to the FX Series User’s Manual -
Data Communication Edition.
FX3G/FX3U/FX3UC Series
Additional User’s Manual - MODBUS Explains the MODBUS serial communication
~ JY997D26201 −
Manual Serial Communication network in FX3G/FX3U/FX3UC PLCs.
Edition (this manual)
Manual for N:N link, parallel link, computer link and non- protocol communication by RS instructions/FX2N-232IF
Details about simple N:N link, parallel link,
FX Series User’s Manual -
Additional computer link and non-protocol
{ Data Communication JY997D16901 09R715
Manual communication (RS instruction and FX2N-
Edition
232IF).
7
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition Generic Names and Abbreviations Used in Manuals
8
FX3G/FX3U/FX3UC Series Programmable Controllers 1 Outline
User’s Manual - MODBUS Serial Communication Edition 1.1 Outline of System
Outline
1. Outline
This chapter outlines the MODBUS serial communication network. 2
Specifications
1.1 Outline of System
The MODBUS serial communication network allows up to 16 slaves to be controlled by one master in
accordance with RS-485 to link devices, or one directly linked slave in accordance with RS-232C.
1) Up to 16 slaves can be controlled by one FX3G/FX3U/FX3UC MODBUS Master
3
Configuration
System
2) Master and Slave functionality
3) RTU and ASCII mode (The ASCII mode is available only in FX3U and FX3UC PLCs)
4) One channel per PLC can be used for MODBUS serial communication (1 MODBUS Master
channel or 1 MODBUS Slave channel)
5) Transmission speed up to 19.2 kbps 4
6) The MODBUS Master function uses a new PLC command dedicated to MODBUS serial
Wiring
communication
Important points and reference
System chapter/section
In the case of RS-485 17 units
500 m (1640' 5")
....... Number of linked units
....... Total extension distance 5
Setup
Communication
For the specifications,
FX PLC FX PLC FX PLC refer to Chapter 2.
Master station Slave station No. 1 (01H) Slave station No. 16 (10H)
.......
For applicable PLC models,
....... refer to Section 1.3.
6
Comm. Status
Devices and
Related
+ + +
Communication Communication Communication
equipment operating equipment operating equipment operating For selection, refer to
in accordance with in accordance with in accordance with ....... Chapter 3.
MODBUS RS-485 MODBUS RS-485 MODBUS RS-485
Commands
Standard
MODBUS
In the case of RS-232C
15 m (49' 2")
8
FX PLC FX PLC
Specification
Master
+ + 9
Communication Communication
Specification
Slave
Note 10
Programs
Creating
9
FX3G/FX3U/FX3UC Series Programmable Controllers 1 Outline
User’s Manual - MODBUS Serial Communication Edition 1.2 Major Procedures until Operation
Refer to Chapter 1.
Programming tool
Connect PLC.*1
Refer to Chapter 6.
Practical program examples Program examples for both Master and Slave are shown
*1. For the corresponding programming tool to PLC connection method, refer to the "Programming
Communication" Chapter of the FX Series User's Manual - Data Communication Edition, or the
corresponding programming tool manual.
For details on operating procedures, refer to the corresponding programming tool manual.
10
FX3G/FX3U/FX3UC Series Programmable Controllers 1 Outline
User’s Manual - MODBUS Serial Communication Edition 1.3 PLC Communication Type Applicability
1
1.3 PLC Communication Type Applicability
Outline
1.3.1 Applicable versions
The communication type is applicable in the following versions. 2
3: Applicable (If applicable versions are limited, they are described inside ( ).) —: Not applicable
Specifications
PLC Applicability (applicable version) Remarks
FX3G Series 3 (Ver. 1.30 or later)
FX3U Series 3 (Ver. 2.40 or later)
FX3UC Series 3 (Ver. 2.40 or later) 3
Configuration
System
1. Version check
The D8001 (decimal) special data register contains information for determining the PLC version.
D8001 2 4 2 4 0 4
PLC type and
Wiring
version Version information (Example: Ver. 2.40)
PLC type (Example: 24 = FX3U/FX3UC Series, 26 = FX3G Series)
Setup
Communication
6
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
11
FX3G/FX3U/FX3UC Series Programmable Controllers 1 Outline
User’s Manual - MODBUS Serial Communication Edition 1.4 Programming Tool Applicability
1. Japanese versions
3: Applicable (If applicable versions are limited, they are described inside ( ).) —: Not applicable
Model name (Media model Applicability
Remarks
name is shown below.) (applicable version)
FX3G PLCs
GX Works2
3 (Ver. 1.07H or later) Select the model "FX3G".
SW
DNC-GXW2-J
GX Developer
3 (Ver. 8.72A or later) Select the model "FX3G".
SW
D5C(F)-GPPW-J
FX-30P 3 (Ver. 1.11 or later)
FX3U PLCs
GX Works2
3 (Ver. 1.07H or later) Select the model "FX3U/FX3UC".
SW
DNC-GXW2-J
GX Developer
3 (Ver. 8.45X or later) Select the model "FX3U(C)".
SW
D5C(F)-GPPW-J
FX-30P 3 (Ver. 1.11 or later)
FX3UC PLCs
GX Works2
3 (Ver. 1.07H or later) Select the model "FX3U/FX3UC".
SW
DNC-GXW2-J
GX Developer
3 (Ver. 8.45X or later) Select the model "FX3U(C)".
SW
D5C(F)-GPPW-J
FX-30P 3 (Ver. 1.11 or later)
2. English versions
3: Applicable (If applicable versions are limited, they are described inside ( ).) —: Not applicable
Model name (Media model Applicability
Remarks
name is shown below.) (applicable version)
FX3G PLCs
GX Works2
3 (Ver. 1.08J or later) Select the model "FX3G".
SW
DNC-GXW2-E
GX Developer
3 (Ver. 8.72A or later) Select the model "FX3G".
SW
D5C(F)-GPPW-E
FX-30P 3 (Ver. 1.11 or later)
FX3U PLCs
GX Works2
3 (Ver. 1.08J or later) Select the model "FX3U/FX3UC".
SW
DNC-GXW2-E
GX Developer
3 (Ver. 8.45X or later) Select the model "FX3U(C)".
SW
D5C(F)-GPPW-E
FX-30P 3 (Ver. 1.11 or later)
FX3UC PLCs
GX Works2
3 (Ver. 1.08J or later) Select the model "FX3U/FX3UC".
SW
DNC-GXW2-E
GX Developer
3 (Ver. 8.45X or later) Select the model "FX3U(C)".
SW
D5C(F)-GPPW-E
FX-30P 3 (Ver. 1.11 or later)
12
FX3G/FX3U/FX3UC Series Programmable Controllers 2 Specifications
User’s Manual - MODBUS Serial Communication Edition 2.1 Communication Specifications
Outline
2. Specifications
This chapter explains the communication specifications and performance. 2
Specifications
2.1 Communication Specifications
MODBUS Serial Communication can be implemented according to the specifications shown in the table
below with the corresponding special adapter attached to the PLC, either the FX3U-232ADP-MB or FX3U-
485ADP-MB. The communication format, protocol, etc. are determined by the communication setup using a
3
Configuration
System
sequence program, as described in Chapter 5.
Specifications
Item Remarks
FX3U-232ADP-MB FX3U-485ADP-MB
Either 1 MODBUS Master or 1
Channels per PLC 1 Channel
MODBUS Slave channel 4
Communication Interface RS-232C RS-485
Wiring
300, 600, 1200, 2400, 4800, 9600,
Transmission Speed
or 19200 bps
FX3U/FX3UC: 7-bit or 8-bit
Data Length
FX3G: 8-bit
Transmission
Specifications Stop Bit 1-bit or 2-bit 5
Transmission Distance varies
Setup
Communication
Transmission Distance Up to 15m (49’2") Up to 500m (1640’5") depending on communication
equipment type
The ASCII mode is available
Communication Protocol RTU or ASCII
only in FX3U and FX3UC PLCs
Comm. Status
Devices and
Related
equipment type
FX3U/FX3UC: 14 (+14 Diagnostic functions)
Number of Functions
Master Function FX3G: 8 (No diagnostic functions)
Number of Simultaneously
1 Instruction
Executable Instructions
Maximum Write Data 123 words or 1968 coils 7
Commands
Standard
MODBUS
Maximum Read Data 125 words or 2000 coils
FX3U/FX3UC: 14 (+14 Diagnostic functions)
Number of Functions
FX3G: 8 (No diagnostic functions)
Number of Simultaneous
Slave Function
Acceptable Request 1 Request Message
Messages 8
Specification
Master
Note
9
This table details the specifications when using MODBUS communication. The FX3U-485ADP-MB and FX3U-
Specification
Slave
232ADP-MB also features FX3U-485ADP and FX3U-232ADP functionality respectively. Therefore the
following communication types are also available when using the following modules:
N:N network, Parallel link, Computer link, Non-protocol
FX3U-485ADP
communication and Inverter communication.
FX3U-232ADP
Computer link, Non-protocol communication, Programming 10
communication and Remote maintenance.
Programs
Creating
For further information on the communication types and please refer to the FX Series User's Manual - Data
Communication Edition.
13
FX3G/FX3U/FX3UC Series Programmable Controllers 2 Specifications
User’s Manual - MODBUS Serial Communication Edition 2.2 Link Time
M0
ADPRW*******
M8029
RST M0
14
FX3G/FX3U/FX3UC Series Programmable Controllers 2 Specifications
User’s Manual - MODBUS Serial Communication Edition 2.2 Link Time
1
The Master processing time (Tm) can be calculated in milliseconds (ms) as follows, where INT (n) indicates
Outline
the concatenation of any remaining decimal values.
Tm = T1 + T2 + T3
2
Specifications
T4
T1 = INT + 1 * Max Scan Time
Max Scan Time
T4 = D8411 (or D8431, depending on the Communication Channel)
3
T5
Configuration
System
T2 = INT + 1 * Max Scan Time
Max Scan Time
T5 = T6 + T7 + T8 + T9 + T10
Wiring
T7 = * 1000 (ms) + 1ms
Baud Rate (bps)
T8 = Slave Delay Time (depending on the Slave)
Number of Bytes in Response * Character Length (bits)
T9 = * 1000 (ms) + 1ms
RTU Mode:
Baud Rate (bps) 5
Setup
Communication
3.5 Characters * Character Length (bits)
T10 = * 1000 (ms) + 1ms
Baud Rate (bps)
ASCII Mode:
T10 = 0
6
T3 = less than 1ms
Comm. Status
Devices and
Related
The Slave processing time (Ts) can be calculated in milliseconds (ms) as follows.
Commands
Standard
MODBUS
Ts = T11 + T12 + T13
10
Programs
Creating
15
FX3G/FX3U/FX3UC Series Programmable Controllers 2 Specifications
User’s Manual - MODBUS Serial Communication Edition 2.2 Link Time
D8411 = 5ms
Max Scan Time = 5ms
Command = Read Holding Registers 0-9 (Command Code 0x03)
Frame Mode = RTU Mode
Bytes in Request = 8bytes (1byte Address, 5byte Frame, 2byte CRC)
Bytes in Response = 25bytes (1byte Address Echo, 22byte Frame, 2byte CRC)
Character Length = 10bits (1bit Start, 8bit Data Length, 0bit Parity, 1bit Stop)
Baud Rate = 19.2Kbps
Slave Delay = 10ms
T4 = 5ms
5ms
T1 = INT + 1 * 5ms = (1 + 1) * 5ms = 10ms
5ms
T6 ≈ 1ms
8 Bytes in Request * 10bits
T7 = * 1000 (ms) + 1ms ≈ 5.2ms
19200bps
T8 = 10ms
25 Bytes in Response * 10bits
T9 = * 1000 (ms) + 1ms ≈ 14.0ms
19200bps
3.5 Characters * 10bits
T10 = * 1000 (ms) + 1ms ≈ 2.8ms
19200bps
T5 = 1ms + 5.2ms + 10ms + 14.0ms + 2.8ms = 33ms
33ms
T2 = INT + 1 * 5ms = (6 + 1) * 5ms = 35ms
5ms
T3 ≈ 1ms
16
FX3G/FX3U/FX3UC Series Programmable Controllers 3 System Configuration
User’s Manual - MODBUS Serial Communication Edition 3.1 System Configuration
Outline
3. System Configuration
This section explains the configuration of communication equipment operating in accordance with RS-485 2
and RS-232C and the selection of equipment required by FX3G/FX3U/FX3UC PLCs.
Specifications
3.1 System Configuration
This section outlines the system configuration required to use MODBUS serial communication.
3
Configuration
System
1 , 2 and 3 indicate the communication equipment combination patterns.
Communication equipment operating
in accordance with MODBUS RS-485 FX PLC Important point in selection Total extension
or RS-232C distance
1
4
Attach the connector conversion RS-485: 500 m
Wiring
+ + adapter to the main unit, and (1640' 5")
then attach the communication RS-232C: 15 m
adapter to the left side of the main (49' 2")
unit.
FX3G Series
Communication
adapter
Connector
conversion 5
adapter
Setup
Communication
2
+ +
Comm. Status
Devices and
Related
adapter board main unit, and then attach the (1640' 5")
communication adapter to the left RS-232C: 15 m
side of the main unit. (49' 2")
+ +
7
Commands
Standard
MODBUS
Communication Expansion FX3UC-32MT-LT(-2)
adapter board
3
RS-485: 500 m
+ Attach the communication adapter (1640' 5")
to the left side of the main unit. RS-232C: 15 m 8
(49' 2")
Specification
Master
For combinations of communication equipment for each FX Series, refer to the next page. 9
Specification
Slave
10
Programs
Creating
17
FX3G/FX3U/FX3UC Series Programmable Controllers 3 System Configuration
User’s Manual - MODBUS Serial Communication Edition 3.2 Applicable FX PLC and Communication Equipment
Total extension
FX Series Communication equipment (option) Check
distance
15 m
(49' 2")
FX3G
(14-point, 24-point FX3G-CNV-ADP FX3U-232ADP-MB
type) (9-pin D-Sub, male)
When using channel 1 (ch 1)
15 m
(49' 2")
FX3G-CNV-ADP FX3U-232ADP-MB
(9-pin D-Sub, male)
When using channel 2 (ch 2)
FX3G
(40-point, 60-point
type)
15 m
FX3G-CNV-ADP FX3U- ADP(-MB) FX3U-232ADP-MB (49' 2")
(Where represents (9-pin D-Sub, male)
232 and 485)
Ch2 is not available when the FX3G-232-BD, FX3G-422-BD,
FX3G-485-BD or FX3G-8AV-BD is connected in the second
expansion board slot.
18
FX3G/FX3U/FX3UC Series Programmable Controllers 3 System Configuration
User’s Manual - MODBUS Serial Communication Edition 3.2 Applicable FX PLC and Communication Equipment
1
Total extension
Outline
FX Series Communication equipment (option) Check
distance
When using channel 1 (ch 1)
ch1
2
+ 15 m
Specifications
(49' 2")
FX3U-CNV-BD FX3U-232ADP-MB
(9-pin D-Sub, male)
Configuration
System
ch1 ch2
+
RD
SD
15 m
(49' 2") 4
Wiring
FX3U--BD FX3U-232ADP-MB
FX3U (Where represents either (9-pin D-Sub, male)
232, 422, 485, USB and 8AV)
When a FX3U-8AV-BD is used, it occupies one communication port
channel.
ch1 ch2
5
Setup
Communication
+ + 15 m
(49' 2")
FX3U-CNV-BD FX3U-232ADP(-MB), FX3U-232ADP-MB
FX3U-485ADP(-MB),
FX3U-CF-ADP
(9-pin D-Sub, male)
6
Comm. Status
Devices and
Related
When a FX3U-CF-ADP is used, it occupies one communication port
channel.
When using channel 1 (ch 1)
ch1
7
Commands
Standard
MODBUS
15 m
(49' 2")
FX3U-232ADP-MB
(9-pin D-Sub, male) 8
Specification
Master
ch1 ch2
FX3UC
(D, DS, DSS)
+ 15 m
9
Specification
Slave
(49' 2")
FX3U-232ADP(-MB), FX3U-232ADP-MB
FX3U-485ADP(-MB), (9-pin D-Sub, male)
FX3U-CF-ADP
When a FX3U-CF-ADP is used, it occupies one communication port
channel. 10
Programs
Creating
19
FX3G/FX3U/FX3UC Series Programmable Controllers 3 System Configuration
User’s Manual - MODBUS Serial Communication Edition 3.2 Applicable FX PLC and Communication Equipment
Total extension
FX Series Communication equipment (option) Check
distance
When using channel 1 (ch 1)
ch1
+ 15 m
(49' 2")
FX3U-CNV-BD FX3U-232ADP-MB
(9-pin D-Sub, male)
ch1 ch2
+
RD
SD
15 m
(49' 2")
FX3UC-32MT-LT FX3U--BD FX3U-232ADP-MB
(Where represents (9-pin D-Sub, male)
(-2) 232, 422, 485, USB and 8AV)
When a FX3U-8AV-BD is used, it occupies one communication port
channel.
ch1 ch2
+ + 15 m
(49' 2")
FX3U-CNV-BD FX3U-232ADP(-MB), FX3U-232ADP-MB
FX3U-485ADP(-MB), (9-pin D-Sub, male)
FX3U-CF-ADP
When a FX3U-CF-ADP is used, it occupies one communication port
channel.
20
FX3G/FX3U/FX3UC Series Programmable Controllers 3 System Configuration
User’s Manual - MODBUS Serial Communication Edition 3.2 Applicable FX PLC and Communication Equipment
Outline
For communication in accordance with RS-485
Total extension
FX Series Communication equipment (option)
distance
Check 2
Specifications
500 m
(1640' 5")
FX3G 3
(14-point, 24-point FX3G-CNV-ADP FX3U-485ADP-MB
Configuration
System
type) (European terminal block)
4
500 m
Wiring
(1640' 5")
FX3G-CNV-ADP FX3U-485ADP-MB
(European terminal block)
When using channel 2 (ch 2) 5
Setup
Communication
FX3G
(40-point, 60-point
type)
500 m
(1640' 5")
6
Comm. Status
Devices and
Related
FX3G-CNV-ADP FX3U- ADP(-MB) FX3U-485ADP-MB
(Where represents (European terminal block)
232 and 485)
Ch2 is not available when the FX3G-232-BD, FX3G-422-BD,
FX3G-485-BD or FX3G-8AV-BD is connected in the second
expansion board slot.
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
21
FX3G/FX3U/FX3UC Series Programmable Controllers 3 System Configuration
User’s Manual - MODBUS Serial Communication Edition 3.2 Applicable FX PLC and Communication Equipment
Total extension
FX Series Communication equipment (option) Check
distance
When using channel 1 (ch 1)
ch1
+ 500 m
(1640' 5")
FX3U-CNV-BD FX3U-485ADP-MB
(European terminal block)
ch1 ch2
+
RD
SD
500 m
(1640' 5")
FX3U--BD FX3U-485ADP-MB
FX3U (Where represent either (European terminal block)
232, 422, 485, USB and 8AV).
+ + 500 m
(1640' 5")
FX3U-CNV-BD FX3U-232ADP(-MB), FX3U-485ADP-MB
FX3U-485ADP(-MB), (European terminal block)
FX3U-CF-ADP
When a FX3U-CF-ADP is used, it occupies one communication port
channel.
When using channel 1 (ch 1)
ch1
500 m
(1640' 5")
FX3U-485ADP-MB
(European terminal block)
ch1 ch2
FX3UC
(D, DS, DSS)
+ 500 m
(1640' 5")
FX3U-232ADP(-MB), FX3U-485ADP-MB
FX3U-485ADP(-MB), (European terminal block)
FX3U-CF-ADP
When a FX3U-CF-ADP is used, it occupies one communication port
channel.
22
FX3G/FX3U/FX3UC Series Programmable Controllers 3 System Configuration
User’s Manual - MODBUS Serial Communication Edition 3.2 Applicable FX PLC and Communication Equipment
1
Total extension
Outline
FX Series Communication equipment (option) Check
distance
When using channel 1 (ch 1)
ch1
2
+ 500 m
Specifications
(1640' 5")
FX3U-CNV-BD FX3U-485ADP-MB
(European terminal block)
Configuration
System
ch1 ch2
+
RD
SD
500 m
(1640' 5") 4
Wiring
FX3UC-32MT-LT FX3U--BD FX3U-485ADP-MB
(Where represents (European terminal block)
(-2) 232, 422, 485, USB and 8AV)
ch1 ch2 5
Setup
Communication
+ + 500 m
(1640' 5")
FX3U-CNV-BD FX3U-232ADP(-MB),
FX3U-485ADP(-MB),
FX3U-485ADP-MB
(European terminal block) 6
FX3U-CF-ADP
Comm. Status
Devices and
Related
When a FX3U-CF-ADP is used, it occupies one communication port
channel.
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
23
FX3G/FX3U/FX3UC Series Programmable Controllers 3 System Configuration
User’s Manual - MODBUS Serial Communication Edition 3.3 Limitation when ch1 and ch2 are used at the same time
3.3 Limitation when ch1 and ch2 are used at the same time
When using Channel 1 (ch1) and Channel 2 (ch2) at the same time, the available communication type
combinations are limited. For more details, refer to the table below.
RD A
RD
RD B
SD A
SD SD B
SG
N:N Networking - -
(Example 2)
Parallel Link - -
Computer Link
Inverter
Communication
Non-protocol
Communication
(RS2 instruction)
Programming
Communication
Remote
-
Maintenance *2
CF card *3
-
*1. Ch2 cannot be set for non-protocol communication using the RS instruction.
*2. When using remote maintenance on ch2, use GX Developer Ver. 8.18U or later.
*3. Only a CF card special adapter is available.
When a CF card special adapter is used, it is handled in the same way as a communication special
adapter, and occupies one communication port channel.
FX3U and FX3UC PLCs Ver. 2.61 and later support CF card special adapters.
Only one CF card special adapter can be connected to the main unit.
Example1:
When using "MODBUS Serial Communication" on ch1, "MODBUS Serial Communication" can not be set on
ch2.
Example2:
When using "MODBUS Serial Communication" on ch1, "N:N Networking" can be used on ch2.
→ For more details on using N:N Networking and MODBUS Serial Communication,
refer to Section 5.3.
24
FX3G/FX3U/FX3UC Series Programmable Controllers 4 Wiring
User’s Manual - MODBUS Serial Communication Edition 4.1 Wiring Procedure
Outline
4. Wiring
This chapter explains the wiring. 2
Specifications
WIRING PRECAUTIONS
• Make sure to cut off all phases of the power supply externally before attempting installation or wiring work.
Failure to do so may cause electric shock or damage to the product.
• Make sure to attach the terminal cover, offered as an accessory, before turning on the power or initiating
3
Configuration
System
operation after installation or wiring work.
Failure to do so may cause electric shock.
WIRING PRECAUTIONS
4
Wiring
• Make sure to observe the following precautions in order to prevent any damage to the machinery or accidents
due to abnormal data written to the PLC under the influence of noise:
1) Do not bundle the main circuit line together with or lay it close to the main circuit, high-voltage line or load line.
Otherwise, noise disturbance and/or surge induction are likely to take place.
As a guideline, lay the control line at least 100mm (3.94") or more away from the main circuit or high-voltage
lines.
2) Ground the shield wire or shield of the shielded cable at one point on the PLC. However, do not use common
5
Setup
Communication
grounding with heavy electrical systems.
• Make sure to properly wire to the European terminal board in accordance with the following precautions.
Failure to do so may cause electric shock, equipment failures, a short-circuit, wire breakage, malfunctions, or
damage to the product.
- The disposal size of the cable end should follow the dimensions described in the manual.
- Tightening torque should follow the specifications in the manual. 6
- Twist the end of strand wire and make sure that there are no loose wires.
Comm. Status
Devices and
Related
- Do not solder-plate the electric wire ends.
- Do not connect more than the specified number of wires or electric wires of unspecified size.
- Affix the electric wires so that neither the terminal block nor the connected parts are directly stressed.
Commands
Standard
MODBUS
4.1 Wiring Procedure
1) Selecting the connection method
Select the wiring method suitable to the application.
→ For details, refer to Section 4.2.
8
Specification
Master
Connect communication equipment operating in accordance with MODBUS RS-485 or MODBUS RS-
232C.
→ For communication in accordance with MODBUS RS-232C, refer to Section 4.4.
→ For communication in accordance with MODBUS RS-485, refer to Section 4.5.
10
Programs
Creating
25
FX3G/FX3U/FX3UC Series Programmable Controllers 4 Wiring
User’s Manual - MODBUS Serial Communication Edition 4.2 Selecting Connection Method
+ +
Communication Communication
equipment operating equipment operating
in accordance with in accordance with
MODBUS RS-232C MODBUS RS-232C
15 m (49' 2")
.......
+ + +
Communication Communication Communication
equipment operating equipment operating equipment operating
in accordance with in accordance with in accordance with
MODBUS RS-485 MODBUS RS-485 MODBUS RS-485
Note
MODBUS Slave Nodes do not need to be numbered in any specific order.
26
FX3G/FX3U/FX3UC Series Programmable Controllers 4 Wiring
User’s Manual - MODBUS Serial Communication Edition 4.3 Selecting Cables and Terminal Resistors (RS-485)
1
4.3 Selecting Cables and Terminal Resistors (RS-485)
Outline
Select cables using the procedure described below.
Specifications
MODBUS RS-485.
Configuration
System
Example of two-pair cable
4
structural drawing Example of three-pair
Wiring
cable structural drawing
Setup
Communication
Number of pairs 2p, 3p
Conductor resistance (20°C) 88.0 Ω/km or less
Insulation resistance 10000 MΩ-km or more
Dielectric withstand voltage 500VDC, 1minute
Electrostatic capacitance (1 kHz) 60nF/km or less by an average 6
Characteristic impedance (100 kHz) 110±10 Ω
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
27
FX3G/FX3U/FX3UC Series Programmable Controllers 4 Wiring
User’s Manual - MODBUS Serial Communication Edition 4.3 Selecting Cables and Terminal Resistors (RS-485)
Approx. 9 mm
(0.35")
CRIMPFOX 6*1
Phoenix Contact AI 0.5-8WH
(or CRIMPFOX 6T-F*2)
Note:
If the diameter of screwdriver grip is too small, the required tightening A B
torque will not be able to be achieved. To achieve the appropriate For size A and size B,
tightening torque shown in the table above, use the following refer to the table above.
screwdriver or an appropriate replacement (grip diameter:
approximately 25mm (0.98"))
<Reference>
FX3U-485ADP-MB
Manufacturer Model name
Phoenix Contact SZS 0.4 × 2.5
28
FX3G/FX3U/FX3UC Series Programmable Controllers 4 Wiring
User’s Manual - MODBUS Serial Communication Edition 4.4 Connection Diagram for MODBUS RS-232C
1
4.3.3 Connecting terminal resistors
Outline
Make sure to provide a terminal resistor at each end of the line.
Specifications
Set the terminal resistor selector switch accordingly.
330 Ω
Terminal
OPEN
110 Ω
resistor selector
switch 3
Configuration
System
4.4 Connection Diagram for MODBUS RS-232C
4
Representative wiring examples are shown in this section. When pin numbers in the counterpart equipment
Wiring
are different, wire the pins as shown below.
Setup
Communication
PLC side External equipment operating in accordance
with MODBUS RS-232C
When CS and When DR and
FX3U-232ADP-MB RS are used ER are used
Name 9-pin D-Sub Name Name
9-pin 25-pin 9-pin 25-pin
D-Sub D-Sub D-Sub D-Sub
FG − FG − 1 FG − 1 6
Comm. Status
Devices and
Related
RD(RXD) 2 RD(RXD) 2 3 RD(RXD) 2 3
SD(TXD) 3 SD(TXD) 3 2 SD(TXD) 3 2
ER(DTR) 4 RS(RTS) 7 4 ER(DTR) 4 20
SG(GND) 5 SG(GND) 5 7 SG(GND) 5 7
DR(DSR) 6 *1
CS(CTS) 8 5 DR(DSR) 6 6 7
Commands
Standard
MODBUS
*1. For third-party external equipment requiring the Control Signal, connect these pins.
The FX3U-232ADP-MB does not require these pins to be connected.
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
29
FX3G/FX3U/FX3UC Series Programmable Controllers 4 Wiring
User’s Manual - MODBUS Serial Communication Edition 4.5 Connection Diagram for MODBUS RS-485
Terminal Terminal
resistor: SDB SDB SDB SDB resistor:
110 Ω 110 Ω
LINK
SG SG SG
SG
*1 Make sure to perform Class-D grounding on the shield of the twisted pair cable connected to the FX3U-485ADP-MB.
*2 Make sure to provide a terminal resistor at each end of a line.
The FX3U-485ADP-MB has a built-in terminal resistor.
Set the terminal resistor selector switch accordingly.
*1 Make sure to perform Class-D grounding on the shield of the twisted pair cable connected to the FX3U-485ADP-MB.
*2 Make sure to provide a terminal resistor at each end of a line.
The FX3U-485ADP-MB has a built-in terminal resistor.
Set the terminal resistor selector switch accordingly.
30
FX3G/FX3U/FX3UC Series Programmable Controllers 4 Wiring
User’s Manual - MODBUS Serial Communication Edition 4.6 Grounding
1
4.6 Grounding
Outline
Grounding should be performed as stated below.
Specifications
When independent grounding can not be performed, perform "shared grounding" as shown in the following
figure
→ For details, refer to the Hardware Edition.
PLC Other
equipment PLC Other
equipment PLC Other
equipment 3
Configuration
System
Independent grounding Shared grounding Common grounding
Best condition Good condition Not allowed
Wiring
5
Setup
Communication
6
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
31
FX3G/FX3U/FX3UC Series Programmable Controllers 5 Communication Setup
User’s Manual - MODBUS Serial Communication Edition 5.1 Setup method for MODBUS serial communication
5. Communication Setup
This chapter explains the setup method for using the MODBUS protocol with an FX3G/FX3U/FX3UC PLC and
MODBUS Communication ADP.
The communication parameters for MODBUS communication can be setup using the following ladder code:
32
FX3G/FX3U/FX3UC Series Programmable Controllers 5 Communication Setup
User’s Manual - MODBUS Serial Communication Edition 5.2 Example of communication setup
1
The ladder code for setting the Master parameters can be expressed as follows:
Outline
Program for setting up a MODBUS Master
b15 b0
MODBUS Serial
Communication Setup
M8411 The communication 0001 0000 1001 0111 2
format is set.
Specifications
0 MOV H1097 D8400 1 0 9 7
b15 b0
Configuration
System
0 0 0 1
Wiring
MOV K400 D8410 Turn Around Delay: 400 ms
Setup
Communication
MOV K10 D8411 Message to Message Delay: 10 ms
Comm. Status
Devices and
Related
b15 b0
The Communication
H1 D8415 Status Information 0000 0000 0000 0001
MOV
Setup *1 is set.
0 0 0 1
7
Commands
Standard
MODBUS
Store Counter to D Devices
8
*1. Available only in FX3U and FX3UC PLCs.
When you program MODBUS communications parameters with structured ladder, the MOV commands
must be connected using the ENO output and the EN input.
<Program example>
MODBUS Serial
Communication Setup 9
Specification
Slave
EN
MOV
ENO EN
MOV
ENO EN
MOV
ENO EN
MOV
ENO
10
Programs
Creating
33
FX3G/FX3U/FX3UC Series Programmable Controllers 5 Communication Setup
User’s Manual - MODBUS Serial Communication Edition 5.2 Example of communication setup
The ladder code for setting the Slave parameters can be expressed as follows:
b15 b0
MODBUS Serial
Communication Setup 0001 0000 1001 0111
M8411 The communication
format is set.
0 MOV H1097 D8400 1 0 9 7
b15 b0
MOV H11 D8401 The protocol is set. 0000 0000 0001 0001
0 0 1 1
b15 b0
The Communication
H11 D8415 Status Information 0000 0000 0001 0001
MOV
Setup *1 is set.
0 0 1 1
34
FX3G/FX3U/FX3UC Series Programmable Controllers 5 Communication Setup
User’s Manual - MODBUS Serial Communication Edition 5.3 Simultaneous N:N Networking and MODBUS Communication
1
5.3 Simultaneous N:N Networking and MODBUS Communication
Outline
When MODBUS communication and N:N Network are used simultaneously, N:N Networking must be setup
first (at program step 0). After which it is possible to program the MODBUS communication setup, as shown
below.
Program for setting up N:N Networking 2
Specifications
N:N Networking
Setup on Channnel 1
M8038 For more details on N:N Networking, refer to the
MOV K0 D8176 FX Series User's Manual - Data Communication Edition.
0
Configuration
System
MOV K2 D8177
MOV K0 D8178
4
Wiring
MOV K3 D8179
MOV K5 D8180
5
Setup
Communication
Program for setting up a MODBUS Slave
MODBUS Serial
Communication
b15 b0 6
Comm. Status
Devices and
Related
Setup on Channel 2 0001 0000 1001 0111
M8411 The communication
format is set.
26 MOV H1097 D8420 1 0 9 7
b15 b0
7
Commands
Standard
MODBUS
MOV H11 D8421 The protocol is set. 0000 0000 0001 0001
0 0 1 1
9
Specification
Slave
b15 b0
The Communication
MOV H11 D8435 Status Information 0000 0000 0001 0001
Setup*1 is set.
0 0 1 1
35
FX3G/FX3U/FX3UC Series Programmable Controllers 5 Communication Setup
User’s Manual - MODBUS Serial Communication Edition 5.4 Cautions on Communication Setup
36
FX3G/FX3U/FX3UC Series Programmable Controllers 6 Related Devices and Communication Status
User’s Manual - MODBUS Serial Communication Edition 6.1 Special Data Registers
Outline
6. Related Devices and Communication Status
In this section the device numbers and functions of the special data registers and special auxiliary relays are 2
described for MODBUS serial communication.
Specifications
6.1 Special Data Registers
The table shows the Special Data registers used in MODBUS serial communication.
3
Configuration
System
Special Data
Register Name Valid Detailed description R/W
CH1 CH2
This device sets the communication format.
Communication
D8400 D8420
Format
M, S R,W*1 4
Note: For details on communication format refer to Section 6.2.
Wiring
Selection of the channel used, RTU or ASCII mode and Master
or Slave identification.
Contents
Bit No. Name
0 (bit = OFF) 1 (bit = ON)
b0
Protocol Other communication MODBUS 5
Selection protocol serial line
Setup
Communication
b1-3 Not used
Master/ slave MODBUS
D8401 D8421 Protocol M, S b4 MODBUS Master R,W*1
setting Slave
b5-7 Not used
RTU/ASCII
6
b8 RTU ASCII*2
Comm. Status
Devices and
Related
mode setting
b9-15 Not used
Commands
Standard
MODBUS
Communication
D8402 D8422 M, S Special clear conditions: R,W
Error Code
1) Power on
2) STOP to RUN (master only)
Current error details.
8
Special clear conditions:
Specification
Master
37
FX3G/FX3U/FX3UC Series Programmable Controllers 6 Related Devices and Communication Status
User’s Manual - MODBUS Serial Communication Edition 6.1 Special Data Registers
Special Data
Register Name Valid Detailed description R/W
CH1 CH2
Communication
D8405 D8425 Format M, S This device stores the communication format set in the PLC. R
Display
Displays the End Of Message character used in ASCII mode.
By default this is the LF (0x0A) character.
Note: If the step number is greater than 32767 the value will
become a negative number. To see the step numbers
above 32767 the user must convert the step number to
an unsigned value.
The current value of retries that the master is sending to
process the request.
38
FX3G/FX3U/FX3UC Series Programmable Controllers 6 Related Devices and Communication Status
User’s Manual - MODBUS Serial Communication Edition 6.1 Special Data Registers
1
Special Data
Outline
Register Name Valid Detailed description R/W
CH1 CH2
The turnaround delay defines the minimum delay time that the
master has to wait after the transmission of a broadcast
message before transmitting the next request. 2
This delay allows the slaves to process the broadcast message
Specifications
and prepare the reception of the next request.
Configuration
System
Note 2:If a value less than 3.5 character times (end of
message detection time) is selected, the master will
wait for at least 3.5 character times.
Wiring
This value defines the minimum waiting time between two
messages. This time is used to detect the end of a message.
Setup
Communication
If a value less than 3.5 character times is selected, the master
will at least wait 3.5 character times.
Comm. Status
Devices and
Related
execution when setting up the network.
Commands
Standard
MODBUS
However, please do not change during normal
operation. For the slave station, this set value can never
be changed.
In the situation where a slave does not respond within the set
time by the Slave Response Timeout the master will try to
retransmit the message a set number of retries before it 8
Number Of terminates the command processing with a timeout error.
Specification
Master
D8412 D8432
Retries
M R,W*1
Valid values: 0 to 20 [times]
If a value of 20 or more is set the number of retries used by the
master is set to 20.
D8413 D8433 Not used -
Slave node address
- -
9
Specification
Slave
39
FX3G/FX3U/FX3UC Series Programmable Controllers 6 Related Devices and Communication Status
User’s Manual - MODBUS Serial Communication Edition 6.1 Special Data Registers
Special Data
Register Name Valid Detailed description R/W
CH1 CH2
Defines the device range that is used to store the
communication state (event & error counter and/or event log).
Contents
Bit No. Name
0 (bit = OFF) 1 (bit = ON)
Event and error Counter values Counter values
b0
counter are not stored are stored
b1-b3 Not used
Communication Event log Event log is not Event log is
Status b4
*Slave Only stored stored
D8415 D8435 Information M,S R,W*1
b5-7 Not used
Setup*2
Communication
b8 status storage D-register R-register
device type
b9-b15 Not used
One MODBUS event is one byte so one 16 bit register will hold
two events. For further details refer to Subsection 9.5.1.
Note: For Event and Error Counter details refer to Section 6.4.
Defines the PLC head device address of the device block that
will store the communication status information.
Communication For D:
D8416 D8436 Status Device M, S Counter only: 0-7990 (i.e. D8415 / D8435 = 01H) R,W*1
Range Setup*2 Log only: 0-7967 (i.e. D8415 / D8435 = 010H)
Log and counter: 0-7957 (i.e. D8415 / D8435 = 011H)
For R:
Counter only: 0-32758 (i.e. D8415 / D8435 = 0101H)
Log only: 0-32735 (i.e. D8415 / D8435 = 0110H)
Log and counter: 0-32725 (i.e. D8415 / D8435=0111H)
40
FX3G/FX3U/FX3UC Series Programmable Controllers 6 Related Devices and Communication Status
User’s Manual - MODBUS Serial Communication Edition 6.1 Special Data Registers
1
Special Data
Outline
Register Name Valid Detailed description R/W
CH1 CH2
Displays the protocol that the serial port is currently using:
0: Programming Port Protocol
1: Programming Port Modem Mode 2
2: Computer Link
Specifications
3: N:N Network
Communication 4: RS Command
D8419 D8439 M, S R
Mode 5: RS2 Command
6: Parallel Link
7: Inverter Communication Command
8: Variable analog potentiometer expansion board is used 3
9: MODBUS Serial
Configuration
System
10: CF-ADP
If a MOV H**** D8470 is triggered by LD M8411 during the
MODBUS MODBUS initialization, the slave device mapping can be
D8470 Device
D8471
S changed by the user. R,W*1
Mapping 1*2
Note: For details refer to Section 9.4.
4
Wiring
If a MOV H**** D8472 is triggered by LD M8411 during the
MODBUS MODBUS initialization, the slave device mapping can be
D8472 Device
D8473
S changed by the user. R,W*1
Mapping 2*2
Note: For details refer to Section 9.4.
If a MOV H**** D8474 is triggered by LD M8411 during the 5
MODBUS MODBUS initialization, the slave device mapping can be
Setup
Communication
D8474 Device
D8475
S changed by the user. R,W*1
Mapping 3*2
Note: For details refer to Section 9.4.
If a MOV H**** D8476 is triggered by LD M8411 during the
D8476
MODBUS
Device S
MODBUS initialization, the slave device mapping can be
changed by the user. R,W*1
6
D8477 *2
Comm. Status
Devices and
Related
Mapping 4
Note: For details refer to Section 9.4.
If a MOV H**** D8478 is triggered by LD M8411 during the
MODBUS MODBUS initialization, the slave device mapping can be
D8478 Device
D8479
S changed by the user. R,W*1
Mapping 5*2
Note: For details refer to Section 9.4.
7
Commands
Standard
MODBUS
If a MOV H**** D8480 is triggered by LD M8411 during the
MODBUS MODBUS initialization, the slave device mapping can be
D8480 Device
D8481
S changed by the user. R,W*1
Mapping 6*2
Note: For details refer to Section 9.4.
If a MOV H**** D8482 is triggered by LD M8411 during the
8
MODBUS
Specification
Master
Mapping 8*2
Note: For details refer to Section 9.4.
41
FX3G/FX3U/FX3UC Series Programmable Controllers 6 Related Devices and Communication Status
User’s Manual - MODBUS Serial Communication Edition 6.2 Communication setting for MODBUS
Contents
Bit No. Name
0 (bit = OFF) 1 (bit = ON)
b0 Data length*1 7-bit 8-bit
Parity
b2, b1
b1
Parity (0, 0): Not provided
b2
(0, 1): Odd
(1, 1): Even
b3 Stop bit 1-bit 2-bit
b7, b6, b5, b4 b7, b6, b5, b4
b4
(0, 0, 1, 1): 300 (0, 1, 1, 1): 4800
b5
Baud rate (bps) (0, 1, 0, 0): 600 (1, 0, 0, 0): 9600
b6
(0, 1, 0, 1): 1200 (1, 0, 0, 1): 19200
b7
(0, 1, 1, 0): 2400
b8 -11 Reserved - -
b12 H/W type RS232C RS485
b13-15 Reserved - -
*1. Please set data length as 8 bits for of RTU mode. In the case of 7 bits, there is a possibility that data
may be missing.
42
FX3G/FX3U/FX3UC Series Programmable Controllers 6 Related Devices and Communication Status
User’s Manual - MODBUS Serial Communication Edition 6.3 Special Auxiliary Relays
1
6.3 Special Auxiliary Relays
Outline
The table shows the Special Auxiliary Relays used for MODBUS serial communication.
Special Device
CH1 CH2
Name Valid Detailed Description R/W 2
Specifications
LD M8411 can be used to trigger a set of subsequent
MODBUS
MOV commands that initialize the MODBUS function.
M8411 Configuration M, S R, W
Request Flag
Note: For details refer to Section 5.2.
This bit is turned on if the processing of a MODBUS
command is completed. 3
Configuration
System
Special clear conditions:
Command 1) Power on
M8029 Execution M 2) STOP to RUN R
Complete 3) If another command using M8029 is triggered
(including another MODBUS command) 4
Wiring
Note: In the event of an error there will be one or
more of the error flags set.
If the MODBUS stack is processing a command no
further commands can be triggered until the current
request is completed and the Command Execution
M8401 M8421
MODBUS
Request in M
Complete Flag is on.
R
5
Setup
Communication
Process
Special clear conditions:
1) Power on
2) STOP to RUN
Set during the processing of the current MODBUS
MODBUS
command error.
6
Comm. Status
Devices and
Related
M8402 M8422 Communication M, S Special clear conditions: R
Error 1) Power on
2) STOP to RUN
3) If another MODBUS command is triggered
Set once a MODBUS command error has been
MODBUS
processed. 7
M8403 M8423
Commands
Standard
MODBUS
Communication M, S R
M8063 M8438 Special clear conditions:
Error (latched)
1) Power on
2) STOP to RUN
0: Normal processing
1: Listen only mode 8
Specification
Master
43
FX3G/FX3U/FX3UC Series Programmable Controllers 6 Related Devices and Communication Status
User’s Manual - MODBUS Serial Communication Edition 6.3 Special Auxiliary Relays
Special Device
Name Valid Detailed Description R/W
CH1 CH2
Set while the master sends retries when the slave
fails to respond in time.
44
FX3G/FX3U/FX3UC Series Programmable Controllers 6 Related Devices and Communication Status
User’s Manual - MODBUS Serial Communication Edition 6.4 Communication status
1
6.4 Communication status
Outline
The communication status is available only in FX3U and FX3UC PLCs.
The event and error counters will occupy ten devices beginning from the device defined by (D8415 / D8435)
and (D8416/D8436). PLC destination devices are latched, therefore the Master's devices will be cleared at
power ON and when the PLC is switched from STOP to RUN. 2
For Slave devices, the event and error counters will be cleared when: the communication is reset, a counter
Specifications
reset command is received, at power ON and when the PLC is switched from STOP to RUN.
The following table shows the communication status of the event and error counters and the communication
event log data for the following scenario:
D8415 = 11H - i.e. store event counter and event log into D devices
D8416 = 100 - i.e. head device is set to D100 3
Configuration
System
Device Description Valid Details R/W
Number of messages that a remote node has
Head Device Bus Message detected on the bus.
M, S R
(D100)*1 Counter Note: Messages with false CRC/LRC are not taken
into account.
This counter is incremented if one of the following
4
errors occur:
Wiring
Head Device + 1 Bus Communication • CRC/LRC mismatch
M, S R
(D101)*1 Error Counter • Bit-level error (overrun, parity error)
• Received telegram length is <= 3 characters
(RTU) or <= 8 characters (ASCII)
Master: Number of received exception error
responses. 5
Head Device + 2
Setup
Communication
Exception Error
M, S Slave: Number of exception conditions detected by R
(D102)*1 Counter the remote node including exceptions
caused by broadcast messages (In this
case no exception response is sent).
Head Device + 3 Slave Message Number of messages addressed to the slave
(D103)*1 Counter
S
(including broadcast).
R
6
Number of received messages for which the slave
Comm. Status
Devices and
Related
Head Device + 4 Slave No Response
*1 S did not return a response (Number of received R
(D104) Counter broadcasted messages).
Head Device + 5 Number of times the slave responds with a NAK
Slave NAK Counter S exception (This is always 0 when using FX3U/ R
(D105)*1 FX3UC.).
Head Device + 6 Number of times the slave respond with a busy 7
Slave Busy Counter S exception (This is always 0 when using FX3U/ R
Commands
Standard
MODBUS
(D106)*1 FX3UC.).
Master: Number of times the master detected a
Head Device + 7 Character Overrun character overrun condition.
M, S R
(D107)*1 Counter Slave: Number of times the slave detected a
character overrun condition. 8
This counter is incremented for each successful
Specification
Master
45
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.1 MODBUS Standard Commands Support List
The following table indicates a list of the MODBUS standard functions supported by the FX-Series MODBUS
Communication ADP.
Accessible
Command Subcommand
Command Name Details Devices per Broadcast Reference
Code Code
Message
Read binary (R/W) 1 to 2000
0x01 Read Coils ✘ Section 7.4
devices points
Read Discrete Read binary (RO) 1 to 2000
0x02 ✘ Section 7.5
Inputs devices points
Read Holding Read 16 bit (R/W) 1 to 125
0x03 ✘ Section 7.6
Registers register points
Read Input Read 16 bit (RO) 1 to 125
0x04 ✘ Section 7.7
Registers register points
Write single binary
0x05 Write Single Coil 1 point ✔ Section 7.8
device
Write Single Write single 16 bit
0x06 1 point ✔ Section 7.9
Register register device
Read 1 byte of
Read Exception
0x07*1 Status
vendor specified - ✘ Section 7.10
data
Loop back Subsection
0x00 Return Query Data - ✘
function 7.11.1
Restart
Restart communication/
Subsection
0x01 Communication Remote - ✔
7.11.2
Option Communication
Reset
Read 16 bit
Return Diagnostic Subsection
0x02 register of vendor - ✘
Register 7.11.3
specified data
0x08 Change ASCII
Diagnosis*1 0x03
Change ASCII Input mode End of
- ✔
Subsection
Delimiter Message 7.11.4
character
Force Listen Only Switch slave to Subsection
0x04 - ✔
Mode Listen Only Mode 7.11.5
Clear all counters
Clear Counters and Subsection
0x0A and the diagnostic - ✔
Diagnostic Register 7.11.6
registers
Read number of
Return Bus Subsection
0x0B detected - ✘
Message Count 7.11.7
messages
46
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.1 MODBUS Standard Commands Support List
1
Accessible
Outline
Command Subcommand
Command Name Details Devices per Broadcast Reference
Code Code
Message
Read number of
Return Bus
detected Subsection
0x0C Communication - ✘
Error Count
communication
errors
7.11.8 2
Specifications
Read number of
Return Bus
detected Subsection
0x0D Exception Error - ✘
exception 7.11.9
Count
conditions
0x0E
Return Slave
Message Count
Read number of
received requests
- ✘
Subsection
7.11.10 3
Configuration
System
Read "No
0x08 Return Slave No Response" Subsection
0x0F - ✘
Diagnosis*1 Response Count counter of the 7.11.11
slave
Read NAK
0x10
Return Slave NAK
Count
counter of the - ✘
Subsection
7.11.12
4
slave
Wiring
Read "Busy"
Return Slave Busy Subsection
0x11 counter of the - ✘
Count 7.11.13
slave
Read "Bus
Return Bus
0x12 Character Overrun
Character
Overrun" counter
- ✘
Subsection
7.11.14
5
Count
Setup
Communication
of the slave
Read
Get Communication
0x0B*1 Event Counter
communication - ✘ Section 7.12
event counter
0x0C*1
Get Communication
Read
communication - ✘ Section 7.13 6
Event Log
event log
Comm. Status
Devices and
Related
Write multiple
1 to 1968
0x0F Write Multiple Coils binary (R/W) ✔ Section 7.14
points
devices
Write Multiple Write multiple 16 1 to 123
0x10
Registers bit (R/W) registers points
✔ Section 7.15
7
Read Slave ID
Commands
Standard
MODBUS
0x11*1 Report Slave ID
code data
- ✘ Section 7.16
Manipulate slave
0x16*1 Mask Write Register register with AND 1 point ✔ Section 7.17
Mask / OR Mask
Read:1 to 8
Read/Write 125
Specification
Master
Read/Write Multiple
0x17*1 Registers
multiple 16 bit pointsWrite: ✘ Section 7.18
(R/W) registers 1 to 121
points
10
Programs
Creating
47
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.1 MODBUS Standard Commands Support List
Command Subcommand
Command Name FX3G FX3U/FX3UC Reference
Code Code
0x01 Read Coils ✔ ✔ Section 7.4
0x02 Read Discrete Inputs ✔ ✔ Section 7.5
0x03 Read Holding Registers ✔ ✔ Section 7.6
0x04 Read Input Registers ✔ ✔ Section 7.7
0x05 Write Single Coil ✔ ✔ Section 7.8
0x06 Write Single Register ✔ ✔ Section 7.9
0x07 Read Exception Status ✘ ✔ Section 7.10
Subsection
0x00 Return Query Data ✘ ✔
7.11.1
Subsection
0x01 Restart Communication Option ✘ ✔
7.11.2
Subsection
0x02 Return Diagnostic Register ✘ ✔
7.11.3
Subsection
0x03 Change ASCII Input Delimiter ✘ ✔
7.11.4
Subsection
0x04 Force Listen Only Mode ✘ ✔
7.11.5
Subsection
0x0A Clear Counters and Diagnostic Register ✘ ✔
7.11.6
Subsection
0x0B Return Bus Message Count ✘ ✔
0x08 7.11.7
Diagnosis Subsection
0x0C Return Bus Communication Error Count ✘ ✔
7.11.8
Subsection
0x0D Return Bus Exception Error Count ✘ ✔
7.11.9
Subsection
0x0E Return Slave Message Count ✘ ✔
7.11.10
Subsection
0x0F Return Slave No Response Count ✘ ✔
7.11.11
Subsection
0x10 Return Slave NAK Count ✘ ✔
7.11.12
Subsection
0x11 Return Slave Busy Count ✘ ✔
7.11.13
Subsection
0x12 Return Bus Character Overrun Count ✘ ✔
7.11.14
0x0B Get Communication Event Counter ✘ ✔ Section 7.12
0x0C Get Communication Event Log ✘ ✔ Section 7.13
0x0F Write Multiple Coils ✔ ✔ Section 7.14
0x10 Write Multiple Registers ✔ ✔ Section 7.15
0x11 Report Slave ID ✘ ✔ Section 7.16
0x16 Mask Write Register ✘ ✔ Section 7.17
0x17 Read/Write Multiple Registers ✘ ✔ Section 7.18
48
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.2 Frame Specifications
1
7.2 Frame Specifications
Outline
The following shows the frame specifications for the MODBUS protocol.
Specifications
MODBUS Protocol Data Section
Section 7.3 to section 7.18
The following table details the frame specification for the MODBUS Protocol.
Area name Description 3
[When the master sends a request message to a slave]
Configuration
System
0: Sends a request message to all the slaves. (Broadcast)
1 to 247: Sends a request to a specific Slave number.
Address field [When the slave sends a response message to the master]
The host station number is stored when sending a response message.
4
Note: 247 is the MODBUS maximum address number. The FX3U MODBUS Master can
Wiring
address from 1 to16 stations within this range.
[When the master sends a request message to a slave]
The master specifies the number of the action to be taken by the slave.
Function code
[When the slave sends a response message to the master]
A requested function code is stored in the case of normal completion. The most
5
significant bit turns ON in the case of error completion.
Setup
Communication
[When the master sends a request message to a slave]
The information needed to execute the action specified by a function code is stored.
Data
[When the slave sends a response message to the master]
The execution result of the action specified by a function code is stored. An exception
code is stored when failed.
6
Comm. Status
Devices and
Related
The node adds the check code automatically to all transmitted messages and
Error check *1 recalculates the check code for any received message. The received message is
discarded if it has an error.
*1. The error check method differs depending on the frame mode. See Subsection 7.2.1.
7
Note
Commands
Standard
MODBUS
Refer to the Subsection 7.2.1 for the data size of each area.
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
49
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.2 Frame Specifications
The frame mode of the FX-Series MODBUS Communication ADP must be consistent with that of the target
device.
END
Start Address field Function code Data Error check (Start) Address field
3.5 character 0 to 252 3.5 character
time or more 1 byte 1 byte bytes 2 bytes time or more 1 byte
Note
The Cyclical Redundancy Checking (CRC) field is two bytes, containing a 16-bit binary value. The CRC value
is calculated by the transmitting device, which appends the CRC to the message. The device that receives
recalculates a CRC during receipt of the message, and compares the calculated value to the actual value it
received in the CRC field. If the two values are not equal, an error results.
50
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.2 Frame Specifications
1
The following is a calculation example in the case where function code 07H is sent to station No. 2.
Outline
CRC error check procedure 16-bit register (MSB) Carry Flag
(Load the register whose 16 bits are all "1") 1111 1111 1111 1111
02H(Station No.) 0000 0010
Exclusive OR (XOR) 1111 1111 1111 1101 2
Specifications
Shift 1 0111 1111 1111 1110 1
Generator polynomial 1010 0000 0000 0001
Exclusive OR (XOR) 1101 1111 1111 1111
Configuration
System
Exclusive OR (XOR) 1100 1111 1111 1110
Wiring
Shift5 0100 1001 1111 1111 0
Shift6 0010 0100 1111 1111 1
Generator polynomial 1010 0000 0000 0001
Exclusive OR (XOR) 1000 0100 1111 1110
Setup
Communication
Generator polynomial 1010 0000 0000 0001
Exclusive OR (XOR) 1000 0001 0011 1110
Comm. Status
Devices and
Related
Generator polynomial 1010 0000 0000 0001
Exclusive OR (XOR) 1110 0000 1001 1101
Commands
Standard
MODBUS
Shift3 0110 1000 0010 0111 1
Generator polynomial 1010 0000 0000 0001
Exclusive OR (XOR) 1100 1000 0010 0110
Shift4
Shift5
0110
0011
0100
0010
0001
0000
0011
1001
0
1
8
Specification
Master
51
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.2 Frame Specifications
b) ASCII mode
The ASCII mode is available only in FX3U and FX3UC PLCs.
In this mode, frames are received or sent in units of 2 characters 2 bytes of ASCII codes.
The frame specifications are compliant with the MODBUS protocol specifications.
: n x 2 bytes CR + LF
2 bytes 2 bytes 2 bytes
(3AH) (n = 0 to 252) (0DH) (0AH)
Note
The Longitudinal Redundancy Checking (LRC) field is one byte, containing an 8-bit binary value. The LRC
value is calculated by the transmitting device, which appends the LRC to the message. The device that
receives recalculates an LRC during receipt of the message, and compares the calculated value to the actual
value it received in the LRC field. If the two values are not equal, an error results.
52
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.2 Frame Specifications
1
The following are calculation examples in the case where function code 01H is sent to station No. 2.
Outline
The following table illustrates the LRC calculation procedure (when sending a request message):
Specifications
Head coil number (H) 00 0000 0000
Head coil number(L) 00 0000 0000
Read points (H) 00 0000 0000
Read points (L) 08 +0000 1000
Configuration
System
Bit reversal 1 F4 1111 0100
+1 1
2’s complement F5 1111 0101
Wiring
Start Address field Function code Head input number Read points LRC
: (02H) (01H) (Error check) "CR" "LF"
(00H) (00H) (00H) (08H) (F5H)
3AH 30H 32H 30H 31H 30H 30H 30H 30H 30H 30H 30H 38H 46H 35H 0DH 0AH
5
Setup
Communication
6
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
53
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.3 Protocol Data Unit Formats by Commands
1) Precautions:
a) When the FX-Series MODBUS Communication ADP receives a broadcast request message:
Although the processing requested by the request message is performed etc., no response message
is sent to the master.
b) When the FX-Series MODBUS Communication ADP receives a request message in the listen only
mode:
Received messages are evaluated, but no action takes place and no response is sent. The only
exception is the "reset communication option" command (diagnosis 0x08 sub command 0x01). If this
command is received the slave recovers from listen only mode without sending a response, all
subsequent commands to this slave will be answered with a response as usual. For further
information refer to Chapter 6.
2) When the processing is completed in error at the slave (FX-Series MODBUS Communication ADP):
When the processing (read/write, diagnostics, etc.) requested by the request message is completed in
error, an exception code is sent to the master.
"Response message formats (when completed with an error)" in Section 7.4 to 7.18.
a) Storage location of exception code and error code. Refer to Chapter 6 for storage location,
confirmation methods, and other detailed contents.
54
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.3 Protocol Data Unit Formats by Commands
1
3) How to see the request/response message formats provided in Section 7.4 to 7.18:
Outline
a) Request/Response message format diagram
The following shows how to see the request/response message format diagrams
provided in Section 7.4 to 7.18.
Specifications
Frame contents Function Head coil number Read points
code (0000H to FFFFH ) (0001H to 07D0H )
[For request message format] (01H)
Setting range
Configuration
System
set the upper byte (8 bits) as (H) and the lower
byte (8 bits) as (L). Note: no switching of the
high and low byte takes place (big endian).
Wiring
For use in ASCII mode, convert the values into ASCII codes.
(Conversion example)
(RTU mode) 5
Setup
Communication
Function code Data
Comm. Status
Devices and
Related
Convert RTU mode to ASCII mode
(ASCII mode)
Commands
Standard
MODBUS
Head coil number Read points
Function code
0 1 0 0 6 E 0 0 3 F
(30 H) (31H) (30 H) (30 H ) (36H) (45H) (30 H) (30H) (33H) (46H)
(H) (L) (H) (L) (H) (L)
8
c) Response message format
Specification
Master
The response message formats issued from the slave to the master differs depending on whether the
slave has normally completed or failed to handle the requested processing (read/write, diagnostics,
etc.)
The formats for normal and error completions are shown in Section 7.4 to 7.18.
9
Specification
Slave
10
Programs
Creating
55
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.4 Read Coils (Command Code: 0x01)
(Device data 1 to n)
b7 b6 b5 b4 b3 b2 b1 b0
Device data 1
Bit device
storage order
Device data n
0 : OFF
1 : ON
The read coil statuses are stored in order from low-order to high-order bits.
When the number of read points is not a multiple of 8, the excess bits turn to 0.
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
56
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.5 Read Discrete Inputs (Command Code: 0x02)
1
7.5 Read Discrete Inputs (Command Code: 0x02)
Outline
Reads the status (ON/OFF) of one or more inputs.
Specifications
Function code Data
Configuration
System
2) Response message format (Slave → Master)
(When completed normally)
Wiring
Function Number of Device data Device data
code read bytes 1 n
(02 H) n
Setup
Communication
(Device data 1 to n)
b7 b6 b5 b4 b3 b2 b1 b0
Device data 1
Bit device
storage order
6
Comm. Status
Devices and
Related
Device data n
0 : OFF
1 : ON
The read input statuses are stored in order from low-order to high-order bits. 7
When the number of read points is not a multiple of 8, the excess bits turn to 0.
Commands
Standard
MODBUS
(When completed with an error)
code code*1
(82 H)
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
9
Specification
Slave
contents.
10
Programs
Creating
57
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.6 Read Holding Registers (Command Code: 0x03)
Function Exception
code code *2
(83 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
58
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.7 Read Input Registers (Command Code: 0x04)
1
7.7 Read Input Registers (Command Code: 0x04)
Outline
Reads the values of one or more input registers.
Specifications
Function Head input register number Read points
code (0000 H to FFFFH) (0001H to 007DH)
(04 H)
Configuration
System
2) Response message format (Slave → Master)
(When completed normally)
Wiring
n
(04 H) m = n x 2* 1
5
*1 For example, if n = 4, the number of bytes is
Setup
Communication
calculated as 4 x 2 = 8 bytes
Comm. Status
Devices and
Related
Function Exception
code code * 2
(84 H)
7
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
Commands
Standard
MODBUS
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
59
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.8 Write Single Coil (Command Code: 0x05)
Function Exception
code code*1
(85 H)
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
60
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.9 Write Single Register (Command Code: 0x06)
1
7.9 Write Single Register (Command Code: 0x06)
Outline
Writes a value to one holding register.
Specifications
Function Holding register number Write data
code (0000 H to FFFFH) (0000 H to FFFFH)
(06 H)
Configuration
System
2) Response message format (Slave → Master)
(When completed normally)
The slave returns the request message received from the master without change.
Wiring
Function code Data
Function Exception
code code*1
(86 H)
5
Setup
Communication
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
6
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
61
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.10 Read Exception Status (Command Code: 0x07)
Function code
Function code
(07H)
Function Error
code information*1
(07 H)
Function Exception
code code *2
(87 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
62
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
1
7.11 Diagnostics (Command Code: 0x08)
Outline
Executes the various diagnostics and checks the FX-Series MODBUS Communication ADP.
Available only in FX3U and FX3UC PLCs.
Specifications
Returns the contents of the request message without change.
Used to check if the network or the target device is operating normally. (Loopback test)
Configuration
System
Function Sub-function code Arbitrary data
code (0000 H)
(08 H)
(H) (L) 4
Wiring
2) Response message format (Slave → Master)
(When completed normally)
The slave returns the request message received from the master without change.
Setup
Communication
Function code Data
Function Exception
code code*1
(88 H)
6
Comm. Status
Devices and
Related
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
63
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
The operation status returns to online mode when it was in the listen only mode.
The following data are cleared when executing the restart communications option.
• Event and Error counter (Refer to Chapter 6)
• Communications event log (Refer to Section 9.5)*1
*1. Clears the data when the communications event log clear is specified in the request message.
Function Exception
code code*2
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
64
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
1
7.11.3 Return diagnostic register (sub-command code: 0x02)
Outline
Reads out the diagnostic register of the remote node to the master.
Specifications
Function Sub-function code
code (0002 H) (0000 H)
(08 H)
Configuration
System
2) Response message format (Slave → Master)
(When completed normally)
Wiring
code (0002 H) value
(08 H)
00H M8060-M8067
(When using CH1 for MODBUS communication)
5
(FX3U/FX3UC)*1
Setup
Communication
M8060-M8062,M8438, M8064-M8067
(When using CH2 for MODBUS communication)
*1. When using 3rd party products. The high byte (H) does not equal 00H. For further information on the
specifications for the slave refer to Chapter 9. 6
Comm. Status
Devices and
Related
(When completed with an error)
Function
code
Exception
code*2
7
Commands
Standard
MODBUS
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed 8
contents.
Specification
Master
9
Specification
Slave
10
Programs
Creating
65
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
: n x 2 characters CR + LF
2 characters 2 characters 2 characters
(3AH) (n = 0 to 252) (0DH) (0AH)
(H) (L)
Note
(0x3A), "0"-"9" (0x30-0x39), "A"-"F" (0x41-0x46) and "a"-"f" (0x61-0x66) should not be used as they might
occur within the message and cause false end of frame detection.
Function Exception
code code*1
(88 H)
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
66
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
1
7.11.5 Force listen only mode (sub-command code: 0x04)
Outline
Places a slave into the offline mode.
Used when disconnecting a slave from the network.
When FX-Series MODBUS Communication ADP is set in the listen only mode, the status is as follows: 2
• Ignores all request messages except for those of restart communications option (Refer to Subsection
Specifications
7.11.2).
• Stops counting of the diagnostic counter (Refer to Chapter 6).
• Continues recording with the communications event log (Refer to Section 9.5).
Configuration
System
Function code Sub-function code Data
Wiring
(H) (L) (H) (L)
Setup
Communication
(When completed with an error)
Function Exception
code
(88 H)
code*1 6
Comm. Status
Devices and
Related
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
7
Commands
Standard
MODBUS
Note
1) Whether the FX-Series MODBUS Communication ADP has been switched to listen only mode or not is
indicated by M8404/M8424.
2) The listen only mode can be changed to online mode by either of the following:
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
67
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
The FX3U/FX3UC bit devices displayed in the diagnostic register are not reset, so the diagnostic register will
be overwritten in the next scan by the actual state of the error flags. The error flags can be reset by PLC
program or monitoring device.
Function Exception
code code*1
(88 H)
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
68
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
1
7.11.7 Return bus message count (sub-command code: 0x0B)
Outline
Reads out the number of messages detected on the line to the master.
Specifications
Function Sub-function code
code (000B H) (0000 H)
(08 H)
Configuration
System
2) Response message format (Slave → Master)
(When completed normally)
Wiring
code (000B H) (0000 H to FFFFH) *1
(08 H)
*1. Refer to Chapter 6 for the relevant counts, count clear methods and precautions.
5
Setup
Communication
(When completed with an error)
Function Exception
6
code code * 2
Comm. Status
Devices and
Related
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
7
Commands
Standard
MODBUS
contents.
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
69
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
*1. Refer to Chapter 6 for the relevant counts, count clear methods and precautions.
Function Exception
code code *2
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
70
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
1
7.11.9 Return bus exception error count (sub-command code: 0x0D)
Outline
Reads out the number of exception errors to the master.
Specifications
Function Sub-function code
code (000DH) (0000 H)
(08 H)
Configuration
System
2) Response message format (Slave → Master)
(When completed normally)
Wiring
Function Sub-function code Exception error count value
code (000DH) (0000 H to FFFFH) * 1
(08 H)
*1. Refer to Chapter 6 for the relevant counts, count clear methods and precautions.
5
Setup
Communication
(When completed with an error)
Function Exception 6
code code *2
Comm. Status
Devices and
Related
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
7
Commands
Standard
MODBUS
contents.
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
71
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
*1. Refer to Chapter 6 for the relevant counts, count clear methods and precautions.
Function Exception
code code * 2
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
72
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
1
7.11.11 Return slave no response count (sub-command code: 0x0F)
Outline
Reads to out the number of broadcast request messages received to the master.
Specifications
Function Sub-function code
code (000F H) (0000 H)
(08 H)
Configuration
System
2) Response message format (Slave → Master)
(When completed normally)
Wiring
code (000F H) value
(08 H) (0000 H to FFFFH) * 1
*1. Refer to Chapter 6 for the relevant counts, count clear methods and precautions.
5
Setup
Communication
(When completed with an error)
Function
code
Exception 6
code *2
Comm. Status
Devices and
Related
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
7
Commands
Standard
MODBUS
contents.
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
73
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
*1. Refer to Chapter 6 for the relevant counts, count clear methods and precautions.
Function Exception
code code *2
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
74
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
1
7.11.13 Return slave busy count (sub-command code: 0x11)
Outline
Reads out the number of busy responses to the master.
The FX-Series MODBUS Communication ADP always returns "0".
Specifications
Function code Sub-function code Data
(L) (L)
3
(H) (H)
Configuration
System
2) Response message format (Slave → Master)
(When completed normally)
Wiring
Function Sub-function code Slave busy count value
code (0011 H) (0000 H) * 1
(08 H)
Setup
Communication
*1. Refer to Chapter 6 for the relevant counts, count clear methods and precautions.
Comm. Status
Devices and
Related
Exception
code code *2
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
7
Commands
Standard
MODBUS
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
75
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.11 Diagnostics (Command Code: 0x08)
*1. Refer to Chapter 6 for the relevant counts, count clear methods and precautions.
Function Exception
code code *2
(88 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
Note
Refer to Subsection 7.2.1 for details on the size of request messages.
76
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.12 Get Communications Event Counter (Command Code: 0x0B)
1
7.12 Get Communications Event Counter (Command Code: 0x0B)
Outline
Acquires the number of messages whose requested actions (read/write, diagnostics, etc.) have been
normally completed.
Available only in FX3U and FX3UC PLCs.
Note 2
Specifications
Only normally completed messages are counted.
Configuration
System
Function
code
(0B H)
Wiring
(When completed normally)
Function code Data
Setup
Communication
(H) (L) (H) (L)
*1. Since the FX-Series MODBUS Communication ADP does not support any program commands,
0000H is stored.
*2. The count is stopped if it has reached FFFFH. 6
Reset the counter by either of the following methods when restarting the count.
Comm. Status
Devices and
Related
Clearing the counter and diagnostic register (Refer to Subsection 7.11.6).
Restart communications option (Refer to Subsection 7.11.2).
Power OFF → ON, or the PLC state is changed from STOP → RUN.
Note 7
Commands
Standard
MODBUS
The communications event counter counts only when the processing (read/write, diagnostics, etc.) has
completed normally.
The communications event counter does not count in the case of the following:
The processing has completed with an error.
• When receiving a request message containing a function code that the FX-Series MODBUS
Communication ADP does not support
8
Specification
Master
Function Exception 9
code code *3
Specification
Slave
(8B H)
*3. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed 10
contents.
Programs
Creating
77
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.13 Get Communications Event Log (Command Code: 0x0C)
Function code
Function
code
(0C H)
Function Number of Program command Communications event Bus message count value Communications Communications
code read bytes status count value (0000 H to FFFFH) *3 event log No. 0 * 4 event log No. 63
(0CH) (0000 H) *1 (0000 H to FFFFH) *2
*1. Since the FX-Series MODBUS Communication ADP does not support any program commands,
0000H is always stored.
*2. Refer to the following for the relevant counts, count clear methods and precautions.
Refer to Section 7.12.
*3. Refer to the following for the relevant counts, count clear methods and precautions.
Refer to Chapter 6.
*4. For information on the Communication Event Log and Communication event log Timing and
Communication event log Format refer to Section 9.5.
Function Exception
code code *5
(8C H)
*5. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
78
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.14 Write Multiple Coils (Command Code: 0x0F)
1
7.14 Write Multiple Coils (Command Code: 0x0F)
Outline
Writes values (ON/OFF) to multiple coils.
Specifications
Function code Data
Configuration
System
(Number of bytes n)
(Device data 1 to n )
b7 b6 b5 b4 b3 b2 b1 b0 4
Device data 1
Wiring
Data storage order
Device data n
0 : OFF 5
1 : ON
Setup
Communication
The values (ON/OFF) stored into the device data 1 to n are written to the coils in order from low-order to
high-order bits of the device data.
*1. The number of the specified write points must be matched with the number of bits specified as the 6
number of bytes. For example, when the write points are set to 16, set the number of bytes to 2 bytes
Comm. Status
Devices and
Related
(= 16 bits).
Commands
Standard
MODBUS
Function Head coil number Write points
code (The same head coil number (The same write points
(0F H) value as in the request value as in the request
message is stored.) message is stored.)
(H) (L) (H) (L)
8
Specification
Master
Function
code
Exception
code*2
9
(8F H)
Specification
Slave
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
10
Programs
Creating
79
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.15 Write Multiple Registers (Command Code: 0x10)
(Number of bytes n x 2)
*1. The number of the specified write points must be matched with the number of bytes.
Function Exception
code code * 2
(90 H)
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
80
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.16 Report Slave ID (Command Code: 0x11)
1
7.16 Report Slave ID (Command Code: 0x11)
Outline
Acquires the information of the slave (FX-Series MODBUS Communication ADP) mounted station into the
master.
Available only in FX3U and FX3UC PLCs.
2
1) Request message format (Master → Slave)
Specifications
Function code
Function
code
(11 H) 3
Configuration
System
2) Response message format (Slave → Master)
(When completed normally)
4
Function code Data
Wiring
Function Number of PLC CPU PLC CPU
code bytes type STOP/RUN
(11 H) (02 H) (F3H) state
Setup
Communication
00H: STOP
FFH: RUN
The slave (FX-Series MODBUS Communication ADP) will return 'F3' as the PLC CPU type data to the
Master:
6
Comm. Status
Devices and
Related
(When completed with an error)
Function Exception 7
code code*1
Commands
Standard
MODBUS
(91 H)
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
8
Specification
Master
contents.
9
Specification
Slave
10
Programs
Creating
81
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.17 Mask Write Register (Command Code: 0x16)
Function Exception
code code*1
(96 H)
*1. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
contents.
82
FX3G/FX3U/FX3UC Series Programmable Controllers 7 MODBUS Standard Commands
User’s Manual - MODBUS Serial Communication Edition 7.18 Read/Write Multiple Registers (Command Code: 0x17)
1
7.18 Read/Write Multiple Registers (Command Code: 0x17)
Outline
Available only in FX3U and FX3UC PLCs.
Reads from and writes to multiple holding registers.
Writing is executed first and reading is then executed.
2
1) Request message format (Master → Slave)
Specifications
Function
code Data
Function Read head holding Read points Write head holding Write points Number of Write . . . Write
code register number n register number m *1 bytes device data device data
(17H) (0000H to FFFFH) (0001H to 007D H) (0000H to FFFF H) (0001H to 0079 H) m x 2
(0002H
*1
1 m 3
to 00F2 H)
Configuration
System
(H) (L) (H) (L) (H) (L) (H) (L) (H) (L) (H) (L)
(Number of bytes m x 2)
*1. The number of the specified write points must be matched with the number of bytes.
4
Wiring
2) Response message format (Slave → Master)
(When completed normally)
Function code Data
5
Function Number of Read Read
Setup
Communication
. . .
code bytes device data device data
(17 H) nx2 1 n
Comm. Status
Devices and
Related
(When completed with an error)
Commands
Standard
MODBUS
*2. Exception and error codes are stored in special data registers and special auxiliary relays in the case
of error completion. Refer to Chapter 6 for storage location, confirmation methods, and other detailed
8
Specification
Master
contents.
9
Specification
Slave
10
Programs
Creating
83
FX3G/FX3U/FX3UC Series Programmable Controllers 8 Master Specification
User’s Manual - MODBUS Serial Communication Edition 8.1 MODBUS Master Command List
8. Master Specification
This chapter explains the MODBUS Master functions supported by the FX-Series MODBUS
Communication ADP.
Command Subcommand
Command Name Details
Code Code
0x01 Read Coils Read binary (R/W) devices
0x02 Read Discrete Inputs Read binary (RO) devices
0x03 Read Holding Registers Read 16 bit (R/W) register
0x04 Read Input Registers Read 16 bit (RO) register
0x05 Write Single Coil Write single binary device
0x06 Write Single Register Write single 16 bit register device
0x07*1 Read Exception Status Read 1 byte of vendor specified data
0x00 Return Query Data Loop back function
Restart communication /Remote
0x01 Restart Communication Option
Communication Reset
0x02 Return Diagnostic Register Read 16 bit register of vendor specified data
0x03 Change ASCII Input Delimiter Change ASCII mode End of Message character
0x04 Force Listen Only Mode Switch slave to Listen Only Mode
Clear Counters and Diagnostic
0x0A Clear all counters and the diagnostic registers
Register
0x0B Return Bus Message Count Read number of detected messages
0x08
Return Bus Communication Error
Diagnosis*1 0x0C Read number of detected comm. errors
Count
Read number of detected exception
0x0D Return Bus Exception Error Count
conditions
0x0E Return Slave Message Count Read number of received requests
0x0F Return Slave No Response Count Read "No Response" counter of the slave
0x10 Return Slave NAK Count Read NAK counter of the slave
0x11 Return Slave Busy Count Read "Busy" counter of the slave
Return Bus Character Overrun Read "Bus Character Overrun" counter of the
0x12
Count slave
0x0B*1 Get Comm. Event Counter Read comm. event counter
*1 Get Comm. Event Log Read comm. event log
0x0C
0x0F Write Multiple Coils Write multiple binary (R/W) devices
0x10 Write Multiple Registers Write multiple 16 bit (R/W) registers
0x11*1 Report Slave ID Read Slave ID code data
Manipulate slave register with AND Mask /
0x16*1 Mask Write Register
OR Mask
0x17*1 Read/Write Multiple Registers Read/Write multiple 16 bit (R/W) registers
84
FX3G/FX3U/FX3UC Series Programmable Controllers 8 Master Specification
User’s Manual - MODBUS Serial Communication Edition 8.2 FNC 276 - MODBUS Read/Write Instruction
1
8.2 FNC 276 - MODBUS Read/Write Instruction
Outline
8.2.1 Outline 2
Specifications
This instruction allows the MODBUS Master to communicate (read/write data) with its associated Slaves.
1) Instruction Format
FNC 276 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition 3
ADPRW Continuous
Configuration
System
11 steps ADPRW Operation
2) Set Data
Operand Type Description Data Type
S Slave Node Address 16-bit binary 4
Wiring
S1 Command Code 16-bit binary
S2 Command Parameter depending on the Command Code (See Section 8.3) 16-bit binary
S3 Command Parameter depending on the Command Code (See Section 8.3) 16-bit binary
Command Parameter depending on the Command Code (See Section 8.3) Bit or 16-bit binary
S4 / D
5
3) Applicable Devices
Setup
Communication
Bit Devices Word Devices Others
Special Con- Real Charac-
Operand Type System User Digit Specification System User Index Pointer
Unit stant Number ter String
X Y M T C S D
.b KnX KnY KnM KnS T C D R U
\G
V
S 3
Z Modify K H
3 3 3
E "
" P
6
S
Comm. Status
Devices and
Related
S1 S 3 3 3 3
S2 S 3 3 3 3
S3 S 3 3 3 3
S4 / D 3 3 S 3 S 3 3 3 3 7
Commands
Standard
MODBUS
S: Except special auxiliary relay (M) and special data register (D)
9
Command Node Command Parameters
input Address code
(normally ON)
Specification
Slave
FNC276 S S1 S2 S3 S4 / D
ADPRW
Command Parameters
depending on the
Command Code
(See Section 8.3)
Command Code
10
(See Section 8.3)
Programs
Creating
85
FX3G/FX3U/FX3UC Series Programmable Controllers 8 Master Specification
User’s Manual - MODBUS Serial Communication Edition 8.3 ADPRW Command Parameters
86
FX3G/FX3U/FX3UC Series Programmable Controllers 8 Master Specification
User’s Manual - MODBUS Serial Communication Edition 8.3 ADPRW Command Parameters
Outline
S2 : S3 :
S1 : Device Address/ Device Count/Sub-command S4 / D :Source Data /
Command Sub-command Code Data/AND Mask Destination PLC Device/OR Mask
Code
Applicable Devices: D • R • indexing • K • H
Sub-function: 1H
Restart
Sub-function Data: (Slave response: echo of S3 ) 2
Applicable
Communication 0x0000: Do Not Reset
Specifications
D • R • indexing
Devices
Event Log
Note: Resets Slave
Block Length 1 Point
Listen Only Mode 0xFF00: Reset Event Log
PLC Destination Device (head address)
Sub-function: 2H
Return 0 (fixed)
Applicable
D • R • indexing
3
Devices
Configuration
System
Diagnostic Register
Block Length 1 Point
Wiring
Sub-function: 4H 0 (fixed)
Force Listen Only Applicable
Mode D • R • indexing
Devices
Setup
Communication
command to reset
(1H)
(Slave response: echo of S3 )
8H Sub-function: AH
Diagnosis*1 Clear Counter and 0 (fixed) Applicable
Diagnostic Register Devices
D • R • indexing
6
Block Length 1 Point
Comm. Status
Devices and
Related
PLC Destination Device (head address)
Sub-function: BH
Applicable
Return Bus Message 0 (fixed) D • R • indexing
Devices
Counter
Block Length 1 Point
Sub-function: CH PLC Destination Device (head address)
7
Commands
Standard
MODBUS
Return Bus Applicable
0 (fixed) D • R • indexing
Communication Error Devices
Counter Block Length 1 Point
PLC Destination Device (head address)
Sub-function: DH
Return Bus Exception 0 (fixed)
Applicable
Devices
D • R • indexing 8
Error Counter
Specification
Master
Sub-function: FH
Applicable
Return Slave No 0 (fixed) D • R • indexing
Devices
Response Counter
Block Length 1 Point
10
Programs
Creating
87
FX3G/FX3U/FX3UC Series Programmable Controllers 8 Master Specification
User’s Manual - MODBUS Serial Communication Edition 8.3 ADPRW Command Parameters
S2 : S3 :
S1 : Device Address/ Device Count/Sub-command S4 / D :Source Data /
Command Sub-command Code Data/AND Mask Destination PLC Device/OR Mask
Code
Applicable Devices: D • R • indexing • K • H
PLC Destination Device (head address)
Sub-function: 10H Applicable
0 (fixed) D • R • indexing
Return NAK Counter Devices
Block Length 1 Point
PLC Destination Device (head address)
8H Sub-function: 11H
Applicable
Return Slave Busy 0 (fixed) D • R • indexing
Diagnosis*1 Counter
Devices
Block Length 1 Point
PLC Destination Device (head address)
Sub-function: 12H
Applicable
Return Character 0 (fixed) D • R • indexing
Devices
Overrun Counter
Block Length 1 Point
PLC Destination Device (head address)
D : Programming State
BH
D +1: Event Counter
Get Comm. 0 (fixed) 0 (fixed)
Event Counter *1 Applicable
D • R • indexing
Devices
Block Length 2 Point
PLC Destination Device (head address)
D : Programming State
D +1: Event Counter
D +2: Bus Message Counter
CH
Get Comm. D +3: Log Length
0 (fixed) 0 (fixed)
Event Log*1 D +4~35: Up to 64 Bytes Event Log
(2 log bytes/word)
Applicable
D • R • indexing
Devices
Block Length 4~36 Point
PLC Source Device (head address)
FH MODBUS Address: Device Count: Applicable D•R•K•H•M•X •
Write Multiple Devices Y • S • indexing
Coils 0000H~FFFFH 1~1968
Block Length ( S3 + 15)÷16
PLC Source Device (head address)
10H MODBUS Address: Applicable D•R•K•H•
Write Multiple Device Count:1~123 Devices indexing
Registers 0000H~FFFFH
Block Length S3
PLC Destination Device (head address)
D : Slave ID
D +1: RUN/STOP State
11H D +2: Additional Data Byte Count
Report Slave 0 (fixed) 0 (fixed) D +3~127: Up to 249 Bytes
ID*1 Additional Data (Vendor Specified)
Applicable
D • R • indexing
Devices
Block Length 3~128 Point
88
FX3G/FX3U/FX3UC Series Programmable Controllers 8 Master Specification
User’s Manual - MODBUS Serial Communication Edition 8.3 ADPRW Command Parameters
Outline
S2 : S3 :
S1 : Device Address/ Device Count/Sub-command S4 / D :Source Data /
Command Sub-command Code Data/AND Mask Destination PLC Device/OR Mask
Code
Applicable Devices: D • R • indexing • K • H
OR Mask:
2
16H MODBUS Address: AND Mask: 0000H~FFFFH
Specifications
Mask Write
Applicable D•R•K•H•
Register*1 0000H~FFFFH 0000H~FFFFH
Devices indexing
Block Length 1 Point
PLC Destination Device
(head address)
3
Configuration
System
S4 : Write Data 1
S4 +1: Write Data 2
MODBUS Address:
Device Count: S4 + (Write Count S3 ) -1: Write
Data ( S3 )
17H S2 : Write Address
Read/Write 0000H~FFFFH
S3
1~121
: Write Count S4 + S3 : Read Data 1 4
Multiple S4 +( S3 ) +1: Read Data 2
Wiring
Registers*1 S2 +1: Read S4 + S3 + (Read Count S3 +1) -1:
S3 +1: Read Count
Address Read Data ( S3 +1)
1~125
0000H~FFFFH
Applicable
D • R • indexing
Devices
Write Count S3 +
5
Block Length
Setup
Communication
Read Count S3 +1
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
89
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.1 MODBUS Slave Command Code List
9. Slave Specification
This chapter explains the configuration of the slave for MODBUS Serial Communication.
Subcommand
Command Code Command Name Details
Code
0x01 Read Coils Read binary (R/W) devices
0x02 Read Discrete Inputs Read binary (RO) devices
0x03 Read Holding Registers Read 16 bit (R/W) register
0x04 Read Input Registers Read 16 bit (RO) register
0x05 Write Single Coil Write single binary device
0x06 Write Single Register Write single 16 bit register device
Read 1 byte of vendor specified data
CH1: M8060 - M8067
0x07*1 Read Exception Status
CH2: M8060 - M8062, M8438,
M8064 - M8067
0x00 Return Query Data Loop back function
Restart communication
Restart Communication - Clear all counters
0x01
Option - Recover from listen only mode
- Reset event log (if requested)
Read 16 bit register of vendor specified data
CH1: M8060 - M8067
0x02 Return Diagnostic Register CH2: M8060 - M8062, M8438,
M8064 - M8067
Note: High byte is unused.
Change ASCII mode End of Message
Change ASCII Input
0x03 character. After response is mode slave will
Delimiter
change the delimiter.
Switch slave to Listen Only Mode
90
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.2 MODBUS device address allocation
1
Subcommand
Outline
Command Code Command Name Details
Code
Get Communication Event
0x0B*1 Counter
Read communication event counter
Specifications
0x10 Write Multiple Registers Write multiple 16 bit (R/W) registers
Slave ID details:
- PLC run/stop state
Configuration
System
- Slave ID F3H (FX3U/FX3UC - same as
computer link)
Wiring
Read/Write Multiple
0x17*1 Registers
Read/Write multiple 16 bit (R/W) registers
5
9.2 MODBUS device address allocation
Setup
Communication
The following information details device allocation when using default values and how to create user defined
device address allocation values.
Comm. Status
Devices and
Related
The following table provides the default values for MODBUS address allocation for Bit devices and word
devices.
Commands
Standard
MODBUS
MODBUS Binary Device Address
FX3U/FX3UC Device
Discrete Inputs (Read Only) Coils (Read / Write)
0x0000-0x1DFF 0x0000-0x1DFF M0-M7679
0x1E00-0x1FFF 0x1E00-0x1FFF M8000-M8511
0x2000-0x2FFF 0x2000-0x2FFF S0-S4095 8
Specification
Master
10
Programs
Creating
91
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.3 MODBUS device address allocation (Default Values)
Word device:
MODBUS Word Device Address
FX3U/FX3UC Device
Input-Register (Read Only) Holding-Register (Read / Write)
0x0000-0x1F3F 0x0000-0x1F3F D0-D7999
0x1F40-0x213F 0x1F40-0x213F D8000-D8511
0x2140-0xA13F 0x2140-0xA13F R0-R32767
0xA140-0xA33F 0xA140-0xA33F TN0-TN511
0xA340-0xA407 0xA340-0xA407 CN0-CN199
0xA408-0xA477 0xA408-0xA477 CN200-CN255*1
0xA478-0xA657 0xA478-0xA657 M0-M7679
0xA658-0xA677 0xA658-0xA677 M8000-M8511
0xA678-0xA777 0xA678-0xA777 S0-S4095
0xA778-0xA797 0xA778-0xA797 TS0-TS511
0xA798-0xA7A7 0xA798-0xA7A7 CS0-CS255
0xA7A8-0xA7B7 0xA7A8-0xA7B7 Y0-Y377
0xA7B8-0xA7C7 - X0-X377
92
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.3 MODBUS device address allocation (Default Values)
1
Word device:
Outline
MODBUS Word Device Address
FX3G Device
Input-Register (Read Only) Holding-Register (Read / Write)
0x0000-0x1F3F 0x0000-0x1F3F D0-D7999
0x1F40-0x213F 0x1F40-0x213F D8000-D8511
2
0x2140-0x7EFF 0x2140-0x7EFF R0-R23999
Specifications
0x7F00-0xA13F 0x7F00-0xA13F unused address*1
0xA140-0xA27F 0xA140-0xA27F TN0-TN319
0xA280-0xA33F 0xA280-0xA33F unused address*1
0xA340-0xA407 0xA340-0xA407 CN0-CN199
3
0xA408-0xA477 0xA408-0xA477 CN200-CN255*2
Configuration
System
0xA478-0xA657 0xA478-0xA657 M0-M7679
0xA658-0xA677 0xA658-0xA677 M8000-M8511
0xA678-0xA777 0xA678-0xA777 S0-S4095
0xA778-0xA78B 0xA778-0xA78B TS0-TS319
4
0xA78C-0xA797 0xA78C-0xA797 unused address*1
Wiring
0xA798-0xA7A7 0xA798-0xA7A7 CS0-CS255
0xA7A8-0xA7AF 0xA7A8-0xA7AF Y0-Y177
0xA7B0-0xA7B7 0xA7B0-0xA7B7 unused address*1
0xA7B8-0xA7BF - X0-X177
5
*1. If unused addresses are accessed an error will occur.
Setup
Communication
*2. CN200-255 are 32-bit counters.
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
93
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.4 User defined MODBUS Device Address Assignment
MODBUS Device Address Assignment is available only in FX3U and FX3UC PLCs.
Up to eight PLC device ranges can be mapped to the MODBUS Device Address range in a user defined
order. The procedure for creating user defined mapping can be seen in the program example below.
When user defined mapping is set-up by D-registers D8470 to D8485 in the MODBUS Configuration
Program, the default MODBUS device assignment becomes invalid and mapping according to the user's
program occurs.
Note
When changing the MODBUS configuration the user must reset the power in order that new parameters are
recognised.
MODBUS Serial
Communication Setup
M8411
MOV H1097 D8400 For more details on the Communication Setup
0 Parameters, refer to Section 5.2 of this manual.
MOV H1 D8414
94
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.4 User defined MODBUS Device Address Assignment
1
9.4.1 Format of the user defined device allocation
Outline
The user defined device allocation affects only the RW areas - "Coils" and "Holding Register". The mapping of
the Read Only (RO) areas "discrete inputs" and "Input Register" is fixed and cannot be changed from the
default setting.
One set of configuration information requires two registers where up to eight PLC device areas can be
2
Specifications
mapped into the MODBUS slave address area. The user defined devices are then mapped to the top of the
MODBUS address range of "coils" or "Holding Register". The PLC devices are mapped in the order given by
the device allocation data sets 1 to 8 (D8470/D8471 - D8484/D8485).
Note
3
The values set for D8470 - D8485 by the MOV command are checked at the initialisation phase after power
Configuration
System
ON. If the values are valid they will be moved into the special data registers D8470 - D8485. In the event that
an error is detected, the MOV command will not be executed and the corresponding D-Register and all
subsequent registers up to D8485 will be set to 0.
Wiring
Device 1 2 3
allocation Device code Size PLC head device address
data (4bit) (12bit) (16bit)
Where:
MSB - Most Significant Bit
LSB - Least Significant Bit
5
Setup
Communication
c Device code: defines which FX3U/FX3UC device type shall be mapped into "coils" or "Holding Register"
(4bit)
Comm. Status
Devices and
Related
3H : CS mapped into "Coils"
4H : Y mapped into "Coils"
5H : X mapped into "Coils"
6H : M (special M) mapped into "Holding Registers"
7H : S mapped into "Holding Registers"
8H : TS mapped into "Holding Registers" 7
9H : CS mapped into "Holding Registers"
Commands
Standard
MODBUS
AH : Y mapped into "Holding Registers"
BH : X mapped into "Holding Registers"
CH : D (special D) mapped into "Holding Registers"
DH : R mapped into "Holding Registers"
EH : TN mapped into "Holding Registers"
FH : CN mapped into "Holding Registers"
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
95
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.4 User defined MODBUS Device Address Assignment
Note
If the above range is exceeded, or the selected value exceeds the valid range for the PLC device defined in c
a MODBUS communication error will occur.
Valid values are 0-32767 although this is dependent on the PLC device defined in c.
Note
For the head device addresses 0H to 5H c must be a multiple of 8. For the head device 6H to BH c these
values must be multiples of 16. If a device address is selected that is not a multiple of 8 or 16 respectively a
MODBUS communication error will occur.
X and Y addressing should always be completed in octal. i.e. 00, 20, 40 etc.
If the selected head device address or its combination with the block length exceeds the valid range for the
selected PLC device a MODBUS communication error will occur.
If the setting of d and e is correct and the device mapping is valid, the values will be moved into the special
data registers D8470 - D8485. In the event that an error is detected, the MOV will not be executed and the
corresponding D-Register and all subsequent registers up to D8485 will be set to 0.
If an error occurs during the device allocation, mapping will be stopped at the first invalid mapping value.
However any mapping operations that have been successfully executed before the error occurrence will be
effective.
For Auxiliary Relays, Data Registers and Counters it is necessary to separate the mapping for standard and
special devices as well as 16 and 32-bit devices. According to this rule it is not possible to map standard
Auxiliary Relay (M0-M7679) and Special Auxiliary Relay (M8000-M8511) in the same mapping command.
(The same applies for Data Registers & Special Data Registers, 16-bit counters & 32-bit counters).
96
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.4 User defined MODBUS Device Address Assignment
1
9.4.2 Example of user defined device allocation
Outline
The following table provides an example of a valid user defined device allocation.
Device Block Size / Number of PLC Head Device
Allocation Device Codec PLC Mapping
Devicesd Addresse
Data set 2
Coil 0-31
Specifications
1 D8470(4bit) 5H(X) D8470(12bit) 2 D8471 0
→ X0-X37
Coil 32-95
2 D8472(4bit) 0H(M) D8472(12bit) 4 D8473 128
→ M128-M191
3 D8474(4bit) 8H(TS) D8474(12bit) 8 D8475 0
H-Register 0-7
→ TS0-TS127
3
Configuration
System
H-Register 8-9
4 D8476(4bit) 9H(CS) D8476(12bit) 2 D8477 128
→ CS128-CS159
H-Register 10-217
5 D8478(4bit) CH(D) D8478(12bit) 13 D8479 1000
→ D1000-D1207
H-Register 218-473 4
6 D8480(4bit) DH(R) D8480(12bit) 16 D8481 0
→ R0-R255
Wiring
H-Register 474-489
7 D8482(4bit) FH(CN) D8482(12bit) 8 D8483 200
→ CN200-CN207
8 D8484(4bit) 0 D8484(12bit) 0 D8485 0 Unused
The example program below shows the defined MODBUS defined device allocation for the table on the 5
previous page.
Setup
Communication
6
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
97
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.4 User defined MODBUS Device Address Assignment
MOV H1 D8414
98
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.4 User defined MODBUS Device Address Assignment
1
The following tables provide the values for MODBUS address allocation for Bit devices and word devices for
Outline
the example stated above:
Bit device:
Coils (Read / Write) FX3U/FX3UC Device
0x0000 - 0x001F X0 - X37 2
0x0020 - 0x005F M128 - M191
Specifications
Word device:
Holding-Register (Read / Write) FX3U/FX3UC Device
0x0000 - 0x0007 TS0 - TS127 3
Configuration
System
0x0008 - 0x0009 CS128 - CS159
0x000A - 0x00D9 D1000 - D1207
0x00DA - 0x01D9 R0 - R255
0x01DA - 0x01E9 CN200 - CN207*1
Wiring
The following table provides an example of an invalid user defined device allocation.
Device
Block size / Number PLC Head Device
Allocation Device Code PLC Mapping
of Devices Address
Data set
Coil 0-31
5
1 D8470(4bit) 5H(X) D8470(12bit) 2 D8471 0
→X0-X37
Setup
Communication
Coil 32-95
2 D8472(4bit) 0H(M) D8472(12bit) 4 D8473 128
→M128-M191
H-Register 0-7
3 D8474(4bit) 8H(TS) D8474(12bit) 8 D8475 0
→TS0-TS127 6
NOT MAPPED!
Comm. Status
Devices and
Related
CS240-CS271
exceeds the valid
4 D8476(4bit) 9H(CS)→0 D8476(12bit) 2→0 D8477 240→0
range for CS. Error has
occurred so the
assignment is stopped.
NOT MAPPED!
7
5 D8478(4bit) CH(D)→0 D8478(12bit) 13→0 D8479 1000→0
Commands
Standard
MODBUS
Skipped due to error.
NOT MAPPED!
6 D8480(4bit) DH(R)→0 D8480(12bit) 16→0 D8481 0→0
Skipped due to error.
NOT MAPPED!
7 D8482(4bit) FH(CN)→0 D8482(12bit) 16→0 D8483 200→0
9
Specification
Slave
10
Programs
Creating
99
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.4 User defined MODBUS Device Address Assignment
The following tables provide the default values for MODBUS address allocation for Bit devices and word
devices for the example stated above:
Bit device:
Coils (Read / Write) FX3U/FX3UC Device
0x0000 - 0x001F X0 - X37
0x0020 - 0x005F M128 - M191
Word device:
Holding-Register (Read / Write) FX3U/FX3UC Device
0x0000 - 0x0007 TS0 - TS127
100
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.5 Communication Event log
1
9.5 Communication Event log
Outline
This section details the communication event log details for the MODBUS slave device.
The communication event log is available only in FX3U and FX3UC PLCs.
Specifications
1. Communications event log information in the communication status area
If configured in D8415/D8435 and D8416/D8436 the event log data is displayed in the communication status
area. The events of the event log are stored to the communication status area as shown below. For more
information on Communication Status refer to Section 6.4.
D8415 = 11H - i.e. store event counter and event log into D devices 3
D8416 = 100 - i.e. head device is set to D100
Configuration
System
High byte Low byte
D100- Event and Error counter.
D109 For details refer to Section 6.4
D110
D111
event log length in bytes
event log byte 1 event log byte 0
New values 4
Wiring
D112 event log byte 3 event log byte 2
D113 event log byte 5 event log byte 4
…
Setup
Communication
Note
If the number of communications event logs exceeds 64, the oldest log is deleted and the latest log is stored
to Communications event log 0.
6
2. Communications event log response format if ADPRW command is used (For command
Comm. Status
Devices and
Related
code 0x0C "get communication event log")
When executing the ADPRW command (command code 0x0C "Get Communication Event Log") the slaves
response data is stored in the following format:
Example: Read event log from slave 4 7
ADPRW K4, H0C, K0, K0, D2000
Commands
Standard
MODBUS
High byte Low byte
Programming state
FFFFH = programming command in process
D2000
0000H = no program. Command in process
(always 0000H in case of FX3U/FX3UC slave) 8
D2001 Event counter
Specification
Master
Old values
D2034 event log byte 61 event log byte 60
D2035 event log byte 63 event log byte 62
Note 10
If the number of communications in the event log exceeds 64, the oldest log is deleted and the latest log is
Programs
Creating
101
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.5 Communication Event log
Note
As the FX-Series MODBUS Communication ADP will never be in a state that details exception code 05H to
07H. Therefore the bits 2, 3 & 4 will always read "0" when using a FX-Series MODBUS Communication ADP.
102
FX3G/FX3U/FX3UC Series Programmable Controllers 9 Slave Specification
User’s Manual - MODBUS Serial Communication Edition 9.5 Communication Event log
1
4) When processing restart communications option:
Outline
The slave (FX-Series MODBUS Communication ADP) stores this kind of event to the communications
event log when processing the restart communications option.
00H is stored to the communications event log.
b7 b6 b5 b4 b3 b2 b1 b0
0 0 0 0 0 0 0 0 2
Specifications
5) Clearing the communications event log
The communications event log can be cleared by either of the following:
Clear setting of the communications event log with the restart communications
option (Refer to Subsection 7.11.2).
Power OFF→ ON or PLC state is turned from OFF→ ON. 3
Configuration
System
4
Wiring
5
Setup
Communication
6
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
103
FX3G/FX3U/FX3UC Series Programmable Controllers 10 Creating Programs
User’s Manual - MODBUS Serial Communication Edition 10.1 Checking Contents of Related Devices
MOV H1 D8401
MOV K3 D8412
*1
MOV H101 D8415
104
FX3G/FX3U/FX3UC Series Programmable Controllers 10 Creating Programs
User’s Manual - MODBUS Serial Communication Edition 10.3 Creating Programs for the Slave Station
Outline
Restart Communication with Slave 0x0A Program for Restarting Communication
Specifications
Command Complete Flag (Reset Event Log)
Destination Device Head: R0
M8029 Communication is restarted between the
Master and Slave 0x0A, and the Slave
RST M10 Communication Event Log and Event and
Error Counter is reset.
3
Configuration
System
Read/Write Multiple Registers from/to Slave 0x05 Program for Reading/Writing Multiple Regtisters
M20
MOVP K90 D10 Command Parameters:
D10 = 90
D11 = 150
D12 = 27 4
MOVP K150 D11 D13 = 31
Wiring
MOVP K27 D12
Slave Address: 0x05
Command Code: 0x17
Write Address: 90 (D10)
5
MOVP K31 D13 Read Address: 150 (D11)
Setup
Communication
Write Count: 27 (D12)
Read Count: 31 (D13)
Source/Destination Device Head: D100
ADPRW H5 H17 D10 D12 D100 27 register device value starting at D100 of
the Master are written to MODBUS Address
90 and onward for Slave 5, and 31 register
Command Complete Flag
device values starting at MODBUS Address
150 of Slave 5 are read to D127 and onward
6
for the Master.
Comm. Status
Devices and
Related
M8029
RST M20
9
Specification
Slave
10
Programs
Creating
105
FX3G/FX3U/FX3UC Series Programmable Controllers 10 Creating Programs
User’s Manual - MODBUS Serial Communication Edition 10.4 Cautions on Program Creation
3. Reading Coils
When using the Read Coils command (Command Code 0x01) in the FX MODBUS Master with a word device
(i.e. D, or R) as the destination device, only the number of bits assigned in the device count of the ADPRW
command will be overwritten. The remaining bits of the word device will not be affected.
106
FX3G/FX3U/FX3UC Series Programmable Controllers 10 Creating Programs
User’s Manual - MODBUS Serial Communication Edition 10.4 Cautions on Program Creation
1
5. When the ASCII mode is used (Only in the FX3U/FX3UC PLC)
Outline
• When the FX series PLC is a Master
Set the waiting time for receiving a response after sending a command transmission from the PLC to
100µs or more.
Specifications
External equipment Response
(Slave) 100µs or more
Configuration
System
External equipment Command Next Command
(Master) sending sending
Wiring
5
Setup
Communication
6
Comm. Status
Devices and
Related
7
Commands
Standard
MODBUS
8
Specification
Master
9
Specification
Slave
10
Programs
Creating
107
FX3G/FX3U/FX3UC Series Programmable Controllers 11 Practical Program Examples
User’s Manual - MODBUS Serial Communication Edition 11.1 Setting Program for Master Station
M8411
MOV H1081 D8400 For more details on the Communication Setup
0 Parameters, refer to Section 5.2 of this manual.
MOV H1 D8401
MOV H1 D8415 *1
M8000
ADPRW H1 H2 K0 K4 M100 Read Discrete Inputs Command
Command Complete Processing
M8029 M8402
MOV K1M100 K1Y000 When Error Flag is OFF, move bit data
values into Y0- Y3
M8402
CALL P0 When Error Flag is ON, call Error Handling
Routine
M100 M101 M102 M103
SET M0 Start Command Sequence
M0
ADPRW H4 H1 K0 K32 M1000 Read Coils Commamd
108
FX3G/FX3U/FX3UC Series Programmable Controllers 11 Practical Program Examples
User’s Manual - MODBUS Serial Communication Edition 11.1 Setting Program for Master Station
11
Examples
Program
Practical
M1
ADPRW H4 H3 K10 K5 D20 Read Holding Registers Command
M8029 M8402
Command Complete Processing 12
Troubleshooting
CALL P0 When Error Flag is ON, call Error Handing
Routine
M2
ADPRW H4 H0F K32 K16 X000 Write Coils Command
M3
ADPRW H4 H10 K0 K4 D1000 Write Registers Command
Command Complete Processing
M8029 M8402
CALL P0 When Error Flag is ON, call Error Handing
Routine
109
FX3G/FX3U/FX3UC Series Programmable Controllers 11 Practical Program Examples
User’s Manual - MODBUS Serial Communication Edition 11.2 Setting Program for Slave Station
MOV K4 D8414
X000
27 Y000 User Program
110
FX3G/FX3U/FX3UC Series Programmable Controllers 12 Troubleshooting
User’s Manual - MODBUS Serial Communication Edition 12.1 Checking the FX3G/FX3U/FX3UC PLC Version
11
Examples
Program
Practical
12. Troubleshooting
This chapter explains troubleshooting. 12
Troubleshooting
12.1 Checking the FX3G/FX3U/FX3UC PLC Version Applicability
Verify that the FX3G/FX3U/FX3UC Series PLC main unit is an applicable version.
→ For the version applicability check, refer to Section 1.3.
While MODBUS serial communication is functioning normally, both LEDs flash brightly.
If they are not flashing, check the wiring, communication settings, and error statuses of the master and slave
stations.
1. Mounting status
Verify that the communication equipment is securely connected with the PLC. If the communication
equipment is not securely connected, communication will not function correctly.
→ For the mounting method, refer to the respective communication equipment manual.
2. Wiring
Verify that all communication equipment is correctly wired. If the wiring is incorrect, communication will not
function correctly.
→ For the wiring check method, refer to Chapter 4.
111
FX3G/FX3U/FX3UC Series Programmable Controllers 12 Troubleshooting
User’s Manual - MODBUS Serial Communication Edition 12.5 Checking Setting Contents and Errors
112
FX3G/FX3U/FX3UC Series Programmable Controllers 12 Troubleshooting
User’s Manual - MODBUS Serial Communication Edition 12.5 Checking Setting Contents and Errors
11
Device Name Description
Examples
Program
Practical
Channel 2 MODBUS
D8420
Communication Format
D8421 Channel 2 MODBUS Protocol
Channel 2 MODBUS
D8429
Slave Response Timeout 12
Troubleshooting
Channel 2 MODBUS
D8430
Turn Around Delay
Channel 2 MODBUS
D8431
Message to Message Delay
Channel 2 MODBUS For Descriptions, refer to Chapter 6.
D8432
Number of Retries
Channel 2 MODBUS
D8434
Slave Node Address
Channel 2 MODBUS
D8435 Communication Status
Information Setup*1
Channel 2 MODBUS
D8436 Communication Status
Device Range Setup*1
If the correct contents are not stored in the above devices, check the sequence program.
113
FX3G/FX3U/FX3UC Series Programmable Controllers 12 Troubleshooting
User’s Manual - MODBUS Serial Communication Edition 12.6 MODBUS Error Code List
2) Error codes
When a communication error occurs while using MODBUS communication, the corresponding
communication error flag turns ON, and the MODBUS error code is stored in the corresponding data
register.
Device Name Description
D8063 Serial Communication Error Code 1 (ch1) Set to 6321, representing MODBUS Error on ch1.
D8402 MODBUS Communication Error Code on ch1 Set to corresponding MODBUS Error Code on ch1.
MODBUS Communication Error Details on Set to Error Details for MODBUS Error Code in
D8403
ch1 D8402.
D8422 MODBUS Communication Error Code on ch2 Set to corresponding MODBUS Error Code on ch2.
MODBUS Communication Error Details on Set to Error Details for MODBUS Error Code in
D8423
ch2 D8422.
D8438 Serial Communication Error Code 2 (ch2) Set to 3821, representing MODBUS Error on ch2.
114
FX3G/FX3U/FX3UC Series Programmable Controllers 12 Troubleshooting
User’s Manual - MODBUS Serial Communication Edition 12.6 MODBUS Error Code List
11
MODBUS
Examples
Program
Practical
Master
Error Error Name and Details Related Devices:(M & D) Corrective Action
/ Slave
Code
Check
Bit-level Error Communication
Master
0204
Parity, overrun (rx register) or framing error
/ Slave
See above Format data register
D8400 or D8420 for
12
Troubleshooting
errors.
Check the
Communication
Format, Turn Around
CRC/LRC Error Delay, and Message
to Message Delay
Master
0205 Message CRC/LRC is invalid, or message See above data registers for
/ Slave
length ≤ 3 characters (RTU) or ≤ 8 characters errors;
(ASCII) D8400 and
D8410-D8411, or
D8420 and
D8430-D8431.
Check the Turn
Bus Character Overrun Around Delay and
Message to Message
- When more than 256 bytes are Delay data registers
received in RTU mode (more than 513 Master for errors;
0206 See above
bytes in ASCII mode) / Slave D8410-D8411, or
- (Slave only) When another telegram is D8430-D8431.
received while the former request is still Also verify that the
in process serial port settings
are correct.
Verify that the Slave
is using MODBUS
Serial
Communication and
that the correct
Data Length Mismatch
command was
received.
The received data does not match the byte Master
0207 See above Also verify that the
count value within the telegram, or the device / Slave
device count of the
count exceeds the maximum limit for the
command is within
command.
the limits of the Slave
and Master.
Protocol error may
occur if you don’t
program correctly.
Unconvertible Character Error
See Corrective
Master
0208*1 When in ASCII mode a byte code can not be
/ Slave
See above Actions for Error
converted Code 207.
(any character except '0'-'9' and 'A'-'F' ('a'-'f'))
Unsupported Command Code Error Verify that the
command used is
0209 Slave See above
The requested Command Code is invalid or within the Master and
not supported Slave specifications.
115
FX3G/FX3U/FX3UC Series Programmable Controllers 12 Troubleshooting
User’s Manual - MODBUS Serial Communication Edition 12.6 MODBUS Error Code List
MODBUS
Master
Error Error Name and Details Related Devices:(M & D) Corrective Action
/ Slave
Code
Verify that the
MODBUS Device
Address Allocation of
Invalid Device Address the Slave is set
correctly.
0210 The selected MODBUS Device Address or Slave See above Ensure master data is
the Device Address + Device Count exceeds in a valid range for a
the supported range of this slave selected command.
Confirm that the
master is accessing
valid device ranges.
Verify that the Slave
Communication Timeout
Node Address and
0211 Master See above communication
Timeout occurred after the set number of
parameters are setup
retries failed
correctly.
Exception Response Error
Verify that the
Slave answers by exception response
command and
(See Exception Code List at the end of this
command parameters
0212 Section) Master See above
used is within the
Master and Slave
Details:
specifications.
H-Byte: Abnormal function code
L-Byte: Exception code
Slave Node Address Mismatch
116
FX3G/FX3U/FX3UC Series Programmable Controllers 12 Troubleshooting
User’s Manual - MODBUS Serial Communication Edition 12.6 MODBUS Error Code List
11
MODBUS
Examples
Program
Practical
Master
Error Error Name and Details Related Devices:(M & D) Corrective Action
/ Slave
Code
Illegal Data Value
See Corrective
0216
Data value does not match MODBUS
specification
Slave See above Actions for Error 12
Code 207.
Troubleshooting
(i.e. Write Single Coil [5H] value other than
OFF [0000H] or ON [FF00H])
Illegal Instruction Use
Do not use the
0217 Slave See above ADPRW command in
ADPRW command used in Slave mode
the MODBUS Slave.
(D8401 or D8421 bit 4 ON)
ADPRW User Command Error
117
FX3G/FX3U/FX3UC Series Programmable Controllers 12 Troubleshooting
User’s Manual - MODBUS Serial Communication Edition 12.6 MODBUS Error Code List
118
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition Warranty
Warranty
Please confirm the following product warranty details before using this product.
1. Gratis Warranty Term and Gratis Warranty Range 2. Onerous repair term after discontinuation of
If any faults or defects (hereinafter "Failure") found to be production
the responsibility of Mitsubishi occurs during use of the 1) Mitsubishi shall accept onerous product repairs for
product within the gratis warranty term, the product shall be seven (7) years after production of the product is
repaired at no cost via the sales representative or discontinued.
Mitsubishi Service Company. However, if repairs are Discontinuation of production shall be notified with
required onsite at domestic or overseas location, expenses Mitsubishi Technical Bulletins, etc.
to send an engineer will be solely at the customer's
discretion. Mitsubishi shall not be held responsible for any 2) Product supply (including repair parts) is not available
re-commissioning, maintenance, or testing on-site that after production is discontinued.
involves replacement of the failed module. 3. Overseas service
Overseas, repairs shall be accepted by Mitsubishi's local
[Gratis Warranty Term]
overseas FA Center. Note that the repair conditions at
The gratis warranty term of the product shall be for one
each FA Center may differ.
year after the date of purchase or delivery to a designated
place. Note that after manufacture and shipment from 4. Exclusion of loss in opportunity and secondary
Mitsubishi, the maximum distribution period shall be six (6) loss from warranty liability
months, and the longest gratis warranty term after Regardless of the gratis warranty term, Mitsubishi shall not
manufacturing shall be eighteen (18) months. The gratis be liable for compensation of damages caused by any
warranty term of repair parts shall not exceed the gratis cause found not to be the responsibility of Mitsubishi, loss
warranty term before repairs. in opportunity, lost profits incurred to the user or third
person by Failures of Mitsubishi products, special
[Gratis Warranty Range]
damages and secondary damages whether foreseeable or
1) The range shall be limited to normal use within the not , compensation for accidents, and compensation for
usage state, usage methods and usage environment, damages to products other than Mitsubishi products,
etc., which follow the conditions and precautions, etc., replacement by the user, maintenance of on-site
given in the instruction manual, user's manual and equipment, start-up test run and other tasks.
caution labels on the product.
5. Changes in product specifications
2) Even within the gratis warranty term, repairs shall be
The specifications given in the catalogs, manuals or
charged for in the following cases.
technical documents are subject to change without prior
a) Failure occurring from inappropriate storage or
notice.
handling, carelessness or negligence by the user.
Failure caused by the user's hardware or software 6. Product application
design. 1) In using the Mitsubishi MELSEC programmable logic
b) Failure caused by unapproved modifications, etc., controller, the usage conditions shall be that the
to the product by the user. application will not lead to a major accident even if any
c) When the Mitsubishi product is assembled into a problem or fault should occur in the programmable
user's device, Failure that could have been logic controller device, and that backup and fail-safe
avoided if functions or structures, judged as functions are systematically provided outside of the
necessary in the legal safety measures the user's device for any problem or fault.
device is subject to or as necessary by industry
2) The Mitsubishi programmable logic controller has
standards, had been provided.
been designed and manufactured for applications in
d) Failure that could have been avoided if
general industries, etc. Thus, applications in which the
consumable parts (battery, backlight, fuse, etc.)
public could be affected such as in nuclear power
designated in the instruction manual had been
plants and other power plants operated by respective
correctly serviced or replaced.
power companies, and applications in which a special
e) Relay failure or output contact failure caused by
quality assurance system is required, such as for
usage beyond the specified Life of contact
Railway companies or Public service purposes shall
(cycles).
be excluded from the programmable logic controller
f) Failure caused by external irresistible forces such
applications.
as fires or abnormal voltages, and Failure caused
In addition, applications in which human life or
by force majeure such as earthquakes, lightning,
property that could be greatly affected, such as in
wind and water damage.
aircraft, medical applications, incineration and fuel
g) Failure caused by reasons unpredictable by
devices, manned transportation, equipment for
scientific technology standards at time of
recreation and amusement, and safety devices, shall
shipment from Mitsubishi.
also be excluded from the programmable logic
h) Anyother failure found not to be the responsibility
controller range of applications.
of Mitsubishi or that admitted not to be so by the
However, in certain cases, some applications may be
user.
possible, providing the user consults their local
Mitsubishi representative outlining the special
requirements of the project, and providing that all
parties concerned agree to the special circumstances,
solely at the users discretion.
119
FX3G/FX3U/FX3UC Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition Revised History
Revised History
Date Revision Discription
4/2007 A First Edition
12/2009 B • FX3G/FX3UC Series are added.
• Errors are corrected.
10/2010 C • Caution on setup of MODBUS communication parameters is added.
• Caution on using ASCII mode is added.
• GX Works2 is added.
• Errors are corrected.
120
FX3G/FX3U/FX3UC SERIES PROGRAMMABLE CONTROLLERS
USER’S MANUAL
HEAD OFFICE: TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN
HIMEJI WORKS: 840, CHIYODA CHO, HIMEJI, JAPAN