w421 Cj1w-Etn21 Cs1w-Etn21 Ethernet Units - Construction of Applications Operation Manual en
w421 Cj1w-Etn21 Cs1w-Etn21 Ethernet Units - Construction of Applications Operation Manual en
w421 Cj1w-Etn21 Cs1w-Etn21 Ethernet Units - Construction of Applications Operation Manual en
W421-E1-04
OPERATION MANUAL
CS1W-ETN21 (100Base-TX)
CJ1W-ETN21 (100Base-TX)
Ethernet Units
Construction of Applications
Operation Manual
Revised April 2009
iv
Notice:
OMRON products are manufactured for use according to proper procedures by a qualified operator
and only for the purposes described in this manual.
The following conventions are used to indicate and classify precautions in this manual. Always heed
the information provided with them. Failure to heed precautions can result in injury to people or dam-
age to property.
!DANGER Indicates an imminently hazardous situation which, if not avoided, will result in death or
serious injury. Additionally, there may be severe property damage.
!WARNING Indicates a potentially hazardous situation which, if not avoided, could result in death or
serious injury. Additionally, there may be severe property damage.
!Caution Indicates a potentially hazardous situation which, if not avoided, may result in minor or
moderate injury, or property damage.
Visual Aids
The following headings appear in the left column of the manual to help you locate different types of
information.
Note Indicates information of particular interest for efficient and convenient opera-
tion of the product.
1,2,3... 1. Indicates lists of one sort or another, such as procedures, checklists, etc.
OMRON, 2003
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or
by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission of
OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is con-
stantly striving to improve its high-quality products, the information contained in this manual is subject to change without
notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility
for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained in
this publication.
v
vi
TABLE OF CONTENTS
PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
1 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
2 General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
3 Safety Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
4 Operating Environment Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv
5 Application Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv
6 Conformance to EC Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvi
SECTION 1
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1-1 Ethernet Unit Communications Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1-2 Functions Listed by Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1-3 Table of Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1-4 Common Protocol Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
SECTION 2
Mail Send Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2-1 Mail Send Function Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2-2 Mail Send Function Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2-3 Mail Send Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2-4 Using the Mail Send Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2-5 Mail Send Function Status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2-6 I/O Memory Data Formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2-7 Attached File Transfer Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2-8 Mail Send Function Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2-9 Example Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
SECTION 3
Receive Mail Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3-1 Mail Receive Function Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3-2 Mail Receive Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3-3 Using the Mail Receive Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3-4 Remote Mail Command Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3-5 Mail Receive Function Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3-6 I/O Memory Data Formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3-7 Attached File Transfer Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
3-8 Mail Receive Function Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3-9 Example Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
vii
TABLE OF CONTENTS
SECTION 4
FTP Server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4-2 FTP Server Function Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4-3 Using the FTP Server Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4-4 FTP Server Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4-5 Using FTP Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4-6 Checking FTP Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4-7 Using File Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4-8 FTP File Transfer Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4-9 UNIX Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
SECTION 5
Automatic Clock Adjustment Function . . . . . . . . . . . . . . . . 89
5-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5-2 Using the Automatic Clock Adjustment Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5-3 Automatic Clock Adjustment Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5-4 Automatic Clock Adjustment Error Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
SECTION 6
Socket Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
6-1 Overview of Socket Communications from Ethernet Units . . . . . . . . . . . . . . . . . . . . . . . . . 99
6-2 Protocol Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6-3 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
6-4 Socket Service Function Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6-5 Using Socket Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6-6 Socket Service Status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
6-7 Using Socket Services by Manipulating Dedicated Control Bits . . . . . . . . . . . . . . . . . . . . . 113
6-8 Using Socket Services with CMND(490) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6-9 Precautions in Using Socket Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
SECTION 7
Using FINS Communications to Create Host Applications 159
7-1 Overview of FINS Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
7-2 FINS Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
7-3 FINS/UDP Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7-4 FINS/TCP Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
7-5 Maximum Transmission Delays: Writing/Reading to CPU Unit . . . . . . . . . . . . . . . . . . . . . 192
viii
TABLE OF CONTENTS
Appendices
A Ethernet Network Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
B Buffer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
C TCP Status Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
D ASCII Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
E Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
F Inspections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
ix
x
About this Manual:
This manual describes the operation of the CS1W-ETN21 and CJ1W-ETN21 Ethernet Units (100Base-
TX) for constructing applications and includes the sections described below.
Please read this manual carefully and be sure you understand the information provided before
attempting to install or operate the Ethernet Unit. Be sure to read the precautions provided in the fol-
lowing section.
Precautions
Section 1 introduces the Ethernet Unit’s communications services, including information on functions
and protocols.
Section 2 describes how to use the Ethernet Unit’s Mail Send Function, including specifications, sta-
tus details, application examples, and troubleshooting information.
Section 3 describes how to use the Ethernet Unit’s Mail Receive Function, including specifications,
status details, I/O memory data formats, file transfer timing, application examples, and troubleshooting
information.
Section 4 describes the functions provided by the FTP server.
Section 5 provides an overview of the automatic clock adjustment function, including details on speci-
fications, required settings, operations from CX-Programmer, and troubleshooting.
Section 6 describes the functionality provided by the Ethernet Unit via the socket services.
Section 7 provides information on communicating on Ethernet Systems and interconnected networks
using FINS commands. The information provided in the section deals only with FINS communications
in reference to Ethernet Units.
Appendices provide information on Ethernet network parameters, the buffer configuration, TCP status
transitions, ASCII characters, maintenance, and inspections.
The related Operation Manual Construction of Networks (W420) provides the following information.
Section Contents
Section 1 Overview of Ethernet Unit features, specifications, and description of the Unit parts and system configura-
tion for constructing Networks.
Section 2 Information on Ethernet Unit’s installation and initial settings required for operation.
Section 3 Information on setting communications using CX-Programmer.
Section 4 Information on words allocated in the CIO Area and DM Area for Ethernet Units.
Section 5 Information on how to manage and use IP addresses.
Section 6 Information on communicating on Ethernet Systems and interconnected networks using FINS
commands.
Section 7 Information on the FINS commands that can be sent to an Ethernet Unit and the responses that
are returned by the Ethernet Unit.
Section 8 Information on troubleshooting.
xi
Relevant Manuals
The following table lists CS- and CJ-series manuals that contain information relevant to Ethernet Units.
Manual Model Name Contents
number
W420 CS1W-ETN21 Ethernet Units Oper- Provides information on operating and installing
CJ1W-ETN21 ation Manual 100Base-TX Ethernet Units, including details on basic
Construction of Net- settings and FINS communications.
works Refer to the Communications Commands Reference
Manual (W342) for details on FINS commands that can
be sent to CS-series and CJ-series CPU Units when
using the FINS communications service.
W421 CS1W-ETN21 Ethernet Units Oper- Provides information on constructing host applications for
CJ1W-ETN21 ation Manual 100Base-TX Ethernet Units, including functions for send-
Construction of ing/receiving mail, socket service, automatic clock adjust-
Applications ment, FTP server functions, and FINS communications.
(this manual)
W343 CS1W-ETN01 Ethernet Units Oper- Describes the installation and operation of the 10Base-5
CS1W-ETN11 ation Manual and 10Base-T Ethernet Units.
CJ1W-ETN11
W342 CS1G/H-CPU@@H Communications Describes the C-series (Host Link) and FINS communi-
CS1G/H-CPU-@@V1 Commands Refer- cations commands used when sending communications
CS1W-SCU21 ence Manual commands to CS-series and CJ-series CPU Units.
CS1W-SCB21/41
CJ1G/H-CPU@@H
CJ1G-CPU@@
CJ1W-SCU41
W339 CS1G/H-CPU@@H Programmable Con- Provides an outline of, and describes the design, installa-
CS1G/H-CPU-@@V1 trollers Operation tion, maintenance, and other basic operations for the CS-
Manual series PLCs. Information is also included on features,
system configuration, wiring, I/O memory allocations, and
troubleshooting.
Use together with the Programmable Controllers Pro-
gramming Manual (W394).
W393 CJ1G/H-CPU@@H Programmable Con- Provides an outline of, and describes the design, installa-
CJ1G-CPU@@ trollers Operation tion, maintenance, and other basic operations for the CJ-
Manual series PLCs. Information is also included on features,
system configuration, wiring, I/O memory allocations, and
troubleshooting.
Use together with the Programmable Controllers Pro-
gramming Manual (W394).
W394 CS1G/H-CPU@@H Programmable Con- Describes programming, tasks, file memory, and other
CS1G/H-CPU-@@V1 trollers Program- functions for the CS-series and CJ-series PLCs.
CJ1G/H-CPU@@H ming Manual Use together with the Programmable Controllers Opera-
CJ1G-CPU@@ tion Manual (W339 for CS-series PLCs and W393 for CJ-
series PLCs).
W340 CS1G/H-CPU@@H Programmable Con- Describes the ladder diagram programming instructions
CS1G/H-CPU-@@V1 trollers Instructions supported by CS-series and CJ-series PCs. Use together
CJ1G/H-CPU@@H Reference Manual with the Programmable Controllers Operation Manual
CJ1G-CPU@@ (W339 for CS-series PLCs and W393 for CJ-series
PLCs), and Programmable Controllers Programming
Manual (W394).
xii
Manual Model Name Contents
number
W414 WS02-CX-@@JV3 CX-Programmer Provides information on how to use the CX-Programmer,
Ver.3.@ Operation a Windows-based programming device, and CX-Net, a
Manual Windows-based network configuration tool.
Use together with the Programmable Controllers Opera-
tion Manual (W339 for CS-series PLCs and W393 for CJ-
series PLCs), Programmable Controllers Programming
Manual (W394) and the Programmable Controllers
Instructions Reference Manual (W340) to perform pro-
gramming.
W341 CQM1H-PRO01 Programming Con- Provides information on how to operate the Programming
CQM1-PRO01 soles Operation Console.
C200H-PRO27 + Manual Use together with the Programmable Controllers Opera-
CS1W-KS001 tion Manual (W339 for CS-series PLCs and W393 for CJ-
series PLCs), Programmable Controllers Programming
Manual (W394) and the Programmable Controllers
Instructions Reference Manual (W340) to perform pro-
gramming.
W336 CS1W-SCB21/41 Serial Communica- Accessing the PLC connected to the CX-Programmer via
CS1W-SCU21 tions Boards and Ethernet or the host computer or other device connected
CJ1W-SCU41 Serial Communica- to the Serial Communications Board or Unit.
tions Units Operation Describes the use of Serial Communications Units and
Manual Boards, including details on hardware, software, and
standard system protocols.
W464 CXONE-AL@@C-V3 CX-Integrator Opera- Describes CX-Integrator operating methods, e.g., for set-
CXONE-AL@@D-V3 tion Manual ting up and monitoring networks.
W463 CXONE-AL@@C-V3 CX-One Setup Man- Describes installation and provides an overview of the
CXONE-AL@@D-V3 ual CX-One FA Integrated Tool Package.
!WARNING Failure to read and understand the information provided in this manual may result in per-
sonal injury or death, damage to the product, or product failure. Please read each section
in its entirety and be sure you understand the information provided in the section and
related sections before attempting any of the procedures or operations given.
xiii
xiv
Read and Understand this Manual
Please read and understand this manual before using the product. Please consult your OMRON
representative if you have any questions or comments.
LIMITATIONS OF LIABILITY
OMRON SHALL NOT BE RESPONSIBLE FOR SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES,
LOSS OF PROFITS OR COMMERCIAL LOSS IN ANY WAY CONNECTED WITH THE PRODUCTS,
WHETHER SUCH CLAIM IS BASED ON CONTRACT, WARRANTY, NEGLIGENCE, OR STRICT
LIABILITY.
In no event shall the responsibility of OMRON for any act exceed the individual price of the product on which
liability is asserted.
xv
Application Considerations
SUITABILITY FOR USE
OMRON shall not be responsible for conformity with any standards, codes, or regulations that apply to the
combination of products in the customer's application or use of the products.
At the customer's request, OMRON will provide applicable third party certification documents identifying
ratings and limitations of use that apply to the products. This information by itself is not sufficient for a
complete determination of the suitability of the products in combination with the end product, machine,
system, or other application or use.
The following are some examples of applications for which particular attention must be given. This is not
intended to be an exhaustive list of all possible uses of the products, nor is it intended to imply that the uses
listed may be suitable for the products:
• Outdoor use, uses involving potential chemical contamination or electrical interference, or conditions or
uses not described in this manual.
• Nuclear energy control systems, combustion systems, railroad systems, aviation systems, medical
equipment, amusement machines, vehicles, safety equipment, and installations subject to separate
industry or government regulations.
• Systems, machines, and equipment that could present a risk to life or property.
Please know and observe all prohibitions of use applicable to the products.
NEVER USE THE PRODUCTS FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR
PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO
ADDRESS THE RISKS, AND THAT THE OMRON PRODUCTS ARE PROPERLY RATED AND
INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.
PROGRAMMABLE PRODUCTS
OMRON shall not be responsible for the user's programming of a programmable product, or any
consequence thereof.
xvi
Disclaimers
CHANGE IN SPECIFICATIONS
Product specifications and accessories may be changed at any time based on improvements and other
reasons.
It is our practice to change model numbers when published ratings or features are changed, or when
significant construction changes are made. However, some specifications of the products may be changed
without any notice. When in doubt, special model numbers may be assigned to fix or establish key
specifications for your application on your request. Please consult with your OMRON representative at any
time to confirm actual specifications of purchased products.
PERFORMANCE DATA
Performance data given in this manual is provided as a guide for the user in determining suitability and does
not constitute a warranty. It may represent the result of OMRON's test conditions, and the users must
correlate it to actual application requirements. Actual performance is subject to the OMRON Warranty and
Limitations of Liability.
xvii
xviii
Unit Versions of CS/CJ-series
Unit Versions A “unit version” has been introduced to manage Units in the CS/CJ Series
according to differences in functionality accompanying Unit upgrades.
Notation of Unit Versions The unit version is given to the right of the lot number on the nameplate of the
on Products products for which unit versions are being managed, as shown below.
Product nameplate
CS1W-
UNIT
Unit version
Lot No.
Example for unit version 1.3
Confirming Unit Versions CX-Programmer version 4.0 can be used to confirm the unit version using the
with Support Software Unit Manufacturing Information.
Note The unit versions of Pre-Ver.2.0 Units cannot be confirmed in Unit Manufac-
turing Information. The following dialog box is displayed.
Unit version
Use the above display to confirm the unit version of the Unit connected online.
xix
Using Unit Version Label The following unit version label is provided with the Ethernet Unit.
This label can be attached to the front of the Ethernet Unit to differentiate
between Ethernet Units with different unit versions.
Unit Version Notation In this manual, the unit version of a Ethernet Unit is given as shown in the fol-
lowing table.
Product nameplate Notation used in this manual Special remarks
Ver. 1.3 or later number Ethernet Unit Ver. 1.3 or later Information without reference to specific Unit
shown to right of the lot Versions applies to all versions of the Unit.
number
Blank to the right of lot Pre-Ver. 1.3 Ethernet Units
number
xx
PRECAUTIONS
This section provides general precautions for using the CS1W-ETN21 and CJ1W-ETN21 Ethernet Units (100Base-TX).
The information contained in this section is important for the safe and reliable application of Ethernet Units. You
must read this section and understand the information contained before attempting to set up or operate an Ethernet
Unit.
xxi
Intended Audience 1
1 Intended Audience
This manual is intended for the following personnel, who must also have
knowledge of electrical systems (an electrical engineer or the equivalent).
• Personnel in charge of installing FA systems.
• Personnel in charge of designing FA systems.
• Personnel in charge of managing FA systems and facilities.
2 General Precautions
The user must operate the product according to the performance specifica-
tions described in the operation manuals.
Before using the product under conditions which are not described in the
manual or applying the product to nuclear control systems, railroad systems,
aviation systems, vehicles, combustion systems, medical equipment, amuse-
ment machines, safety equipment, and other systems, machines, and equip-
ment that may have a serious influence on lives and property if used
improperly, consult your OMRON representative.
Make sure that the ratings and performance characteristics of the product are
sufficient for the systems, machines, and equipment, and be sure to provide
the systems, machines, and equipment with double safety mechanisms.
This manual provides information for programming and operating the Unit. Be
sure to read this manual before attempting to use the Unit and keep this man-
ual close at hand for reference during operation.
!WARNING It is extremely important that a PLC and all PLC Units be used for the speci-
fied purpose and under the specified conditions, especially in applications that
can directly or indirectly affect human life. You must consult with your
OMRON representative before applying a PLC System to the above-men-
tioned applications.
3 Safety Precautions
!WARNING Do not attempt to take any Unit apart while the power is being supplied. Doing
so may result in electric shock.
!WARNING Do not touch any of the terminals or terminal blocks while the power is being
supplied. Doing so may result in electric shock.
!WARNING Do not attempt to disassemble, repair, or modify any Units. Any attempt to do
so may result in malfunction, fire, or electric shock.
xxii
Safety Precautions 3
!WARNING Provide safety measures in external circuits (i.e., not in the Programmable
Controller), including the following items, to ensure safety in the system if an
abnormality occurs due to malfunction of the PLC or another external factor
affecting the PLC operation. Not doing so may result in serious accidents.
• Emergency stop circuits, interlock circuits, limit circuits, and similar safety
measures must be provided in external control circuits.
• The PLC will turn OFF all outputs when its self-diagnosis function detects
any error or when a severe failure alarm (FALS) instruction is executed.
As a countermeasure for such errors, external safety measures must be
provided to ensure safety in the system.
• The PLC outputs may remain ON or OFF due to deposits on or burning of
the output relays, or destruction of the output transistors. As a counter-
measure for such problems, external safety measures must be provided
to ensure safety in the system.
• When the 24-V DC output (service power supply to the PLC) is over-
loaded or short-circuited, the voltage may drop and result in the outputs
being turned OFF. As a countermeasure for such problems, external
safety measures must be provided to ensure safety in the system.
!Caution Execute online editing only after confirming that no adverse effects will be
caused by extending the cycle time. Otherwise, the input signals may not be
readable.
• Emergency stop circuits, interlock circuits, limit circuits, and similar safety
measures must be provided in external control circuits.
!Caution Fail-safe measures must be taken by the customer to ensure safety in the
event of incorrect, missing, or abnormal signals caused by broken signal lines,
momentary power interruptions, or other causes. Serious accidents may
result from abnormal operation if proper measures are not provided.
!Caution Tighten the screws on the terminal block of the AC Power Supply Unit to the
torque specified in the operation manual. The loose screws may result in
burning or malfunction.
xxiii
Operating Environment Precautions 4
5 Application Precautions
Observe the following precautions when using the Ethernet Unit.
!WARNING Always heed these precautions. Failure to abide by the following precautions
could lead to serious or possibly fatal injury.
• Always connect to a ground of 100 Ω or less when installing the Units. Not
connecting to a ground of 100 Ω or less may result in electric shock.
• Always turn OFF the power supply to the CPU Unit and Slaves before
attempting any of the following. Not turning OFF the power supply may
result in malfunction or electric shock.
• Mounting or dismounting I/O Units, CPU Units, Memory Packs, or
Master Units.
• Assembling the Units.
• Setting DIP switches or rotary switches.
• Connecting cables or wiring the system.
• Connecting or disconnecting the connectors.
!Caution Failure to abide by the following precautions could lead to faulty operation of
the Ethernet Unit or the system, or could damage the Ethernet Unit. Always
heed these precautions.
• Interlock circuits, limit circuits, and similar safety measures in external cir-
cuits (i.e., not in the Programmable Controller) must be provided by the
customer.
xxiv
Application Precautions 5
• Always use the power supply voltages specified in the operation manuals.
An incorrect voltage may result in malfunction or burning.
• Take appropriate measures to ensure that the specified power with the
rated voltage and frequency is supplied. Be particularly careful in places
where the power supply is unstable. An incorrect power supply may result
in malfunction.
• Install external breakers and take other safety measures against short-cir-
cuiting in external wiring. Insufficient safety measures
• Make sure that all the Backplane mounting screws, terminal block screws,
and cable connector screws are tightened to the torque specified in the
relevant manuals. Incorrect tightening torque may result in malfunction.
• Leave the label attached to the Unit when wiring. Removing the label may
result in malfunction if foreign matter enters the Unit.
• Remove the label after the completion of wiring to ensure proper heat dis-
sipation. Leaving the label attached may result in malfunction.
• Use crimp terminals for wiring. Do not connect bare stranded wires
directly to terminals. Connection of bare stranded wires may result in
burning.
• Observe the following precautions when wiring the communications
cable.
• Separate the communications cables from the power lines or high-volt-
age lines.
• Do not bend the communications cables past their natural bending ra-
dius.
• Do not pull on the communications cables.
• Do not place heavy objects on top of the communications cables.
• Always lay communications cable inside ducts.
• Use appropriate communications cables.
• Make sure that the terminal blocks, expansion cable connectors, and
other items with locking devices are locked in place.
• Wire all connections correctly according to instructions in this manual.
• Double-check all wiring and switch settings before turning ON the power
supply. Incorrect wiring may result in burning.
• Mount Units only after checking terminal blocks and connectors com-
pletely.
• Check the user program for proper execution before actually running it on
the Unit. Not checking the program may result in unexpected operation.
• Confirm that no adverse effect will occur in the system before attempting
any of the following. Not doing so may result in an unexpected operation.
• Changing the operating mode of the PLC.
• Force-setting/force-resetting any bit in memory.
• Changing the present value of any word or any set value in memory.
• After replacing Units, resume operation only after transferring to the new
CPU Unit and/or Special I/O Units the contents of the DM Area, HR Area,
programs, parameters, and other data required for resuming operation.
Not doing so may result in an unexpected operation.
• Before touching a Unit, be sure to first touch a grounded metallic object in
order to discharge any static build-up. Not doing so may result in malfunc-
tion or damage.
xxv
Conformance to EC Directives 6
• When transporting the Unit, use special packing boxes and protect it from
being exposed to excessive vibration or impacts during transportation.
• CPU Bus Units will be restarted when routing tables are transferred from
a Programming Device to the CPU Unit. Restarting these Units is required
to read and enable the new routing tables. Confirm that the system will
not be adversely affected before allowing the CPU Bus Units to be reset.
6 Conformance to EC Directives
6-1 Applicable Directives
• EMC Directives
• Low Voltage Directive
6-2 Concepts
EMC Directives
OMRON devices that comply with EC Directives also conform to the related
EMC standards so that they can be more easily built into other devices or the
overall machine. The actual products have been checked for conformity to
EMC standards (see the following note). Whether the products conform to the
standards in the system used by the customer, however, must be checked by
the customer.
EMC-related performance of the OMRON devices that comply with EC Direc-
tives will vary depending on the configuration, wiring, and other conditions of
the equipment or control panel on which the OMRON devices are installed.
The customer must, therefore, perform the final check to confirm that devices
and the overall machine conform to EMC standards.
Note Applicable EMS (Electromagnetic Susceptibility) and EMI (Electromagnetic
Interference) Standards in the EMC (Electromagnetic Compatibility) stan-
dards are as follows:
Ethernet Unit EMS EMI
CS1W-ETN21 EN61000-6-2 EN61000-6-4
CJ1W-ETN21 (Radiated emission: 10-m
regulations)
xxvi
SECTION 1
Introduction
This section introduces the functions and protocols used in Ethernet Unit communications services.
1
Ethernet Unit Communications Services Section 1-1
Note When transferring data through the internet, a global IP address must be
acquired for the Ethernet Unit.
2
Table of Protocols Section 1-3
Note Any one of the following conditions can be specified to send e-mail automati-
cally:
A periodic timer times out, the Mail Send Switch is turned from OFF to ON, a
specified word contains a particular value, a specified bit turns from OFF to
ON, the CPU Unit's operating mode changes, a fatal error occurs, or an event
is stored in the error log.
3
Common Protocol Settings Section 1-4
4
Common Protocol Settings Section 1-4
Note The “POP before SMTP” is an authentication function required when sending
mail (using the SMTP server). Normally, account name and password authen-
tication is performed with the POP server because there isn't an authentica-
tion process in the SMTP server. Most ISPs (Internet Service Providers) use
the “POP before SMTP” authentication method to verify users sending e-mail.
1-4-2 POP
Always enter the POP server settings when using the Mail Receive Function.
Also, set the POP server settings when using “POP before SMTP” in the Mail
Send Function.
5
Common Protocol Settings Section 1-4
6
Common Protocol Settings Section 1-4
1-4-3 DNS
The DNS server's settings must be entered when the POP3 server, SMTP
server, and SNTP server are specified with host names.
The DNS server manages the IP addresses and host names of the nodes that
communicate in the network. The Ethernet Unit automatically acquires each
server's IP address from the DNS server and uses those acquired IP
addresses.
7
Common Protocol Settings Section 1-4
8
SECTION 2
Mail Send Function
This section provides an overview and describes how to use the Ethernet Unit’s Mail Send Function, including application
examples and troubleshooting information.
9
Mail Send Function Overview Section 2-1
Internet or E-mail
intranet E-mail reception
Router
Advantages A specific range of I/O memory data in the CPU Unit can be sent automati-
cally as an attached file (through the internet or intranet) when a particular
condition occurs. Some conditions that can be used are a bit turning ON to
indicate an error, a specified word containing a given value, or a periodic time
being reached.
E-mails can be sent when various conditions in the existing ladder program
are met. It is not necessary to modify the existing ladder program.
The Mail Send Function can be used to create various applications such as
error monitoring of remote equipment, periodic monitoring of equipment, and
quality control applications.
Description When a specified sending condition is met, the following e-mail body data and
attached files can be sent automatically as an e-mail to the e-mail address
specified in the CPU Bus Unit System Setup.
■ Body Data
Any desired combination of user-set information (any ASCII character string),
error log information, and status information can be sent.
10
Mail Send Function Details Section 2-2
■ Attached Files
An I/O memory data file created automatically by the Ethernet Unit (a speci-
fied range of the CPU Unit's I/O memory data converted to a .IOM, .TXT, or
.CSV file) or any file in file memory (in the CPU Unit's Memory Card) can be
sent as an attached file.
■ Send Timing
An e-mail can be sent automatically when a dedicated control bit goes from
OFF to ON, a specified word's value meets a preset condition, a specified bit's
status changes, an entry is recorded in the Ethernet Unit's error log, the CPU
Unit's status changes (a non-fatal error occurs, a fatal error occurs, or the
operating mode changes), or at periodic intervals.
■ Send Mail Conditions
Up to 8 send mail conditions can be preset to send an e-mail automatically
when the specified conditions are met. Conditions include the send destina-
tion, trigger type, I/O memory addresses to be converted to a data file or the
name of the file to be read from file memory, and periodic sending interval.
11
Mail Send Function Details Section 2-2
Subject: OMRON Ethernet Unit Mail Service (posted at regular intervals) Title (depends on trigger condition)
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit Content-Type (fixed)
Trigger Setting Number = 1
This is OMRON ethernet unit mail posting service. Trigger number (required)
This mail have been posted at regular intervals.
Trigger information (required)
======================================================================
Ethernet Unit Identification
====================================================================== Ethernet Unit model (required)
Model : CS1W-ETN21
Version : VX.XX Unit version (required)
IP address : XXX.XXX.XXX.XXX
Subnet mask : XXX.XXX.XXX.XXX Ethernet Unit IP address (required)
IP conversion : Table used
======================================================================
User Message
====================================================================== User-set information (optional)
TEST MAIL.
======================================================================
Error Log Information
======================================================================
MM/DD/YY HH:MM:SS Error Detail Description Error log information (optional)
-------- -------- ---- ---- ------------------------------------
03/05/29 12:00:00 0006 0000 CPU unit error
03/05/29 12:30:00 0121 0101 Destination IP address not registered
======================================================================
Status Information
======================================================================
*Error Status
IP router table error : OFF
IP address setting error : OFF
IP address table error : OFF
Routing table error : OFF
Body
12
Mail Send Function Details Section 2-2
13
Mail Send Function Details Section 2-2
Note (a) The user-set message sent in each e-mail can be changed just
by changing the contents of the relevant words in the CPU Bus
Unit Area. To change the user-set message easily, prepare sev-
eral messages in advance and copy the desired message to the
CPU Bus Unit Area when it is required.
The data set by the user is sent just as it is, and the code is not
converted.
(b) If there is a null code character (00 Hex) in the data, only the data
up to that point will be sent.
(c) The user-set data is sent as-is and the codes are not converted.
14
Mail Send Function Details Section 2-2
Example
I/O memory D00100 1234
D00101 5678
One area (Example: DM) D00102 9ABC
Sends e-mail. to to
15
Mail Send Function Details Section 2-2
• Since the Ethernet Unit creates the data file automatically, the Accessing
Memory/Sending Mail Flag (bit 01 of n+17 in the allocated CPU Bus Unit
Area) will be ON while the CPU Unit's I/O memory is being accessed.
• To maintain the integrity of the data, write-protect the region of I/O mem-
ory being converted to a data file by preventing the region from being writ-
ten from the ladder program while this flag is ON.
File Data (1 MB Max.) Any file stored in the Memory Card installed in the CPU Unit (root directory
MEMCARD) can be sent with the e-mail as an attached file.
Sends e-mail.
Ethernet
Any file in the
Memory Card
• Generally, CS/CJ file memory files are attached, such as program files
(.OBJ), parameter files (.STD), and data files stored in the Memory Card
(.IOM, .TXT, or .CSV).
16
Mail Send Function Specifications Section 2-3
17
Using the Mail Send Function Section 2-4
Note The Ethernet Unit will be restarted when the settings data is transferred to the
CPU Bus Unit System Setup Area, so that the new settings are read and
18
Using the Mail Send Function Section 2-4
become effective. Verify that it is safe for the Ethernet Unit to restart before
transferring the settings data.
19
Using the Mail Send Function Section 2-4
Note (1) Make POP settings when the Use POP before SMTP Option was select-
ed in the SMTP Tab.
(2) Make DNS settings when the Server specification type is set to Host
name in the SMTP or POP Tab.
20
Using the Mail Send Function Section 2-4
21
Using the Mail Send Function Section 2-4
22
Using the Mail Send Function Section 2-4
Send Mail Trigger Type Specifies the type send mail condition that will be used by the Ethernet Unit to
Setting (Required) automatically send e-mail.
When the Mail Send Function is not being used, disable the send mail upon
trigger setting.
23
Using the Mail Send Function Section 2-4
Note The same trigger type can be set for two or more trigger numbers (1 to 8).
Item Contents Default
Software switch If this option is selected, an e-mail is sent when- Selected
ever the Mail Send Switch goes from OFF to
ON.
The Mail Send Switch is bit 03 of word n in the
CIO Area words allocated to the Ethernet Unit
as a CPU Bus Unit. (n = 1500 + 25 × unit num-
ber)
Word value If this option is selected, the value of a specified Not selected
change word is compared with a set value with the
selected comparison function (=, <>, <, <=, >=,
or >), and an e-mail is sent whenever the condi-
tion is satisfied.
Specify the desired word address in the drop-
down lists.
Bit value change If this option is selected, an e-mail is sent when- Not selected
ever the specified bit goes from OFF-to-ON or
ON-to-OFF. Specify the desired bit address in
the drop-down lists.
ETN condition If this option is selected, an e-mail is sent when- Not selected
ever a new error is stored in the Ethernet Unit's
error log.
CPU condition If this option is selected, mail is sent whenever Not selected
any of the following conditions occur at the CPU
Unit.
Use the drop-down list at the right to select one
of the following three conditions as the mail trig-
ger.
• When a non-fatal error occurs
• When a fatal error occurs
• When the operating mode is changed
Periodic timer If this option is selected, an e-mail is sent at Not selected
fixed time intervals. The time interval is set in 10-
minute units in the Interval time box. (The mini-
mum interval is 10 minutes.)
24
Mail Send Function Status Section 2-5
0: OFF, 1: ON
While mail is being sent, the status of the three bits for the send condition will
be 001. (For example, word m bits 02, 01, and 00 will be 001 when mail is
being sent for send condition setting 1). If the transmission ends normally, the
status of the three bits becomes 010. If the transmission ends with an error,
the status becomes 110.
25
I/O Memory Data Formats Section 2-6
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
n - - - - - - - - - - - - - - -
n+17 - - - - - - - - - - - - - - -
To maintain the uniformity of the data in the data file, use this flag as a condi-
tion for write operations in the ladder program to prevent the ladder program
from overwriting the data while it is being converted to a data file.
48 bytes
(Reserved for system)
26
I/O Memory Data Formats Section 2-6
Note The IOM file format is compatible with the CPU Unit's READ DATA FILE and
WRITE DATA FILE instructions (FREAD and FWRIT) set to binary data for-
mat.
TXT Format When hexadecimal I/O memory data (1234, 5678, 9ABC, etc.) is being sent
as an attached file in TXT format, the data is stored with the following proce-
dure.
1. The word data is converted to ASCII.
2. The word data is delimited by hard tabs ([HT]: 09).
3. A return and line feed ([CR][LF]: 0D0A) are inserted after every 10 words.
I/O memory contents
+0 +1 +2 +3 +4 +5 +6 +7 +8 +9
+0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678
+10 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0
The @ character represents a hard tab and displayed as a tab in text displays.
Note The TXT file format is compatible with the CPU Unit's READ DATA FILE and
WRITE DATA FILE instructions (FREAD and FWRIT) set to tab-delimited
word format with a carriage return every 10 words.
CSV Format When hexadecimal I/O memory data (1234, 5678, 9ABC, etc.) is being sent
as an attached file in CSV format, the data is stored with the following proce-
dure.
1. The word data is converted to ASCII.
2. The word data is delimited by commas (“,”: 2C).
3. A return and line feed ([CR][LF]: 0D0A) are inserted after every 10 words.
I/O memory contents
+0 +1 +2 +3 +4 +5 +6 +7 +8 +9
+0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678
+10 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0
Note The CSV file format is compatible with the CPU Unit's READ DATA FILE and
WRITE DATA FILE instructions (FREAD and FWRIT) set to comma-delimited
word format with a carriage return every 10 words.
27
Attached File Transfer Times Section 2-7
Note (1) The access times for file data indicate Memory Card access times.
(2) The access times in the table above are standard times when the PLC
Setup's “Fixed Peripheral Servicing Time” setting is set to the default val-
ue of 4% of the cycle time.
(3) The attached file transfer time can be reduced by increasing the time al-
lowed for peripheral servicing in the PLC Setup's “Fixed Peripheral Ser-
vicing Time” setting.
28
Mail Send Function Errors Section 2-8
Cause Correction
Destination mail address has not been Correctly set the destination mail
set. address.
The trigger is set and the user-set data, Correctly set the data to be sent.
error log, status, and file data/I/O data
settings are all zero.
Trigger type setting error Correctly set the trigger type setting.
Details of trigger setting error Correctly set the trigger type setting.
Specified word or specified bit data area/ Correctly set the data area and address
address error for the specified word or bit.
Note For more details on the error log, refer to 8-3 Error Log in the Operation Man-
ual Construction of Networks (W420).
2-8-3 Error Log Error Codes for the Mail Send Function
When an error occurs while the Ethernet Unit is operating, the error code,
detailed error code, and time the error occurred are saved in the error log. The
following table provides a list of the error codes.
The error log can be read by sending FINS commands to the Ethernet Unit or
by using the mail receive function and specifying the ErrorLogRead com-
mand.
Error Meaning Detailed error code Correction EEPROM
code 1st byte 2nd byte
021A Logic error 00 01: Data link Recreate the data Saved
in setting table specified by the
table 02: Network 2nd byte of the
parameters detailed error
code.
03: Routing
tables
04: Setup
05: CPU Bus
Unit Words
(CIO/DM)
29
Example Application Section 2-9
Note For more details on the error log, refer to 8-3 Error Log in the Operation Man-
ual Construction of Networks (W420).
2-9-2 Step 2. Make the Unit Setup Settings from the CX-Programmer
With the CX-Programmer connected online, select the Ethernet Unit in the
CX-Programmer's PLC I/O Table Window, right-click and select Unit Setup
from the popup menu. Make the following settings in the CPU Bus Unit Setup
Area from the CPU Bus Unit Setup Window.
30
Example Application Section 2-9
Mail Trigger Condition • Send on the Rising Edge of the Dedicated Control Bit (Mail Send Switch)
Settings
Tab Item Setting
Send Mail Mail trigger type Bit value change
Note The Mail Send Switch is bit 03 of word n in the CIO Area words allocated to
the Ethernet Unit as a CPU Bus Unit. (n = 1500 + 25 × unit number)
• Send when a Specified Word's Value meets a Preset Condition
Example: Send e-mail when the content of D00300 is 500.
Tab Item Setting
Send Mail Mail trigger type Word value change
Area: D
Address: 300
Value: 500
State: =
31
Example Application Section 2-9
Example: Send e-mail when W300 bit 00 goes from OFF to ON.
Tab Item Setting
Send Mail Mail trigger type Word value change
Area: W
Address: 300
Bit: 00
State: Rising
32
SECTION 3
Receive Mail Function
This section describes how to use the Ethernet Unit’s Mail Receive Function, including specifications, status details, I/O
memory data formats, file transfer timing, application examples, and troubleshooting information.
33
Mail Receive Function Overview Section 3-1
1,2,3... 1. The user can enter a command in the e-mail and send that e-mail to the
Ethernet Unit.
2. A command written in the e-mail subject can be executed when the e-mail
is received. (The Ethernet Unit periodically checks the mail server to de-
termine whether mail has been delivered.)
3. The Ethernet Unit is equipped with a function that sends a reply e-mail in-
dicating the results of the command execution.
User
POP3 server
Sends mail.
E-mail
Internet or
intranet
Router
Ethernet
Ethernet Unit
Reply e-mail
Attached file:
Command
DATA0.CSV Command entered. execution
Example:
IOM Read
D_0
5
DATA0.CSV
Advantages The mail receive function can be used to perform a variety of operations in the
CPU Unit (such as reading/writing I/O memory, changing the operating mode,
and executing file memory operations) through the internet or intranet without
acquiring a fixed global address for the Ethernet Unit.
Description
Configuration of the Mail The user sends specific remote mail commands to the Ethernet Unit's e-mail
Receive Function address specified in the Unit Setup.
34
Mail Receive Function Overview Section 3-1
■ Command Parameters
Enter the parameters (for example, Para1:Overwrite=OK) in ASCII in the e-
mail body.
■ Reception Timing
Mail is checked at the check-mail interval (Server access interval time) set in
the POP Tab. The Server access interval time is set in minutes and the default
setting is 5 minutes.
Response to the Remote A response e-mail is automatically sent to the e-mail address from which the
Mail Command remote mail command was sent. The response e-mail contains the results of
the remote mail command execution.
35
Mail Receive Function Specifications Section 3-2
36
Mail Receive Function Specifications Section 3-2
Item Specification
Attached Data format • IOM Write command:
file Writes an I/O memory data file (IOM, TXT, or CSV) to the CPU Unit.
• File Write command:
Any type of file (a file with any filename extension) can be written to EM file memory or a
Memory Card mounted in the CPU Unit.
Data size • IOM Write command: 6,000 words max. (same limit for all file types)
• File Write command: 1 MB max.
Format MIME (version 1.0) format
Number of Only one file
attachments If more than one file is received, only the first file will be received and the remaining files will be
discarded.
Reception Subject: Us ASCII
(decoding) Body: Us ASCII
Attached file: Base64, quoted printable, 7 bit
Note Only one attached file is allowed. The filename must be ASCII and up to 8 + 3 charac-
ters long.
Encryption None
Compression None
Command line Body: Data can be entered. (Lines other than the parameter line are comment lines.)
Attached file: Cannot be entered.
Protection Protections when reading mail:
Authentication by password.
Protections when receiving remote mail commands:
The following protections can be used.
1. Receive from specified mail address only.
2. Receive attached files with the specified filename extensions only.
3. Restrict the remote mail commands that will be accepted.
Response E-mail
Item Specification
Protocol used SMTP (Port number: 25/TCP; can be changed in the CPU Bus Unit Setup using the CX-
Programmer.)
(The Use POP before SMTP Option can be selected to authenticate account and pass-
word information with the “POP before SMTP” method.)
Subject The remote mail command is automatically entered after “Re:”.
Example: Re: FileRead
E-mail body Contains the response code and response status (fixed text associated with the response
code).
Attached Data format • IOM Read command:
file Reads data from the CPU Unit and creates an I/O memory data file (IOM, TXT, or CSV).
• File Read command:
Any type of file (a file with any filename extension) can be read from EM file memory or a
Memory Card mounted in the CPU Unit.
Data size • IOM Read command: 6,000 words max. (same limit for all file types)
• File Read command: 1 MB max.
Format MIME (version 1.0) format
Number of attach- Only one file
ments
Response Subject: Us ASCII
(encoding) Body: Us ASCII
Attached file: Base64
Encryption None
Compression None
37
Using the Mail Receive Function Section 3-3
Note The Ethernet Unit will be restarted when the settings data is transferred to the
CPU Bus Unit System Setup Area, so that the new settings are read and
become effective. Verify that it is safe for the Ethernet Unit to restart before
transferring the settings data.
38
Using the Mail Receive Function Section 3-3
Note Make DNS settings when the Server specification type is set to Host name in
the SMTP or POP Tab.
39
Using the Mail Receive Function Section 3-3
40
Using the Mail Receive Function Section 3-3
41
Remote Mail Command Details Section 3-4
Response Format
To: [email protected] Returns response to the originating e-mail address.
CC:
42
Remote Mail Command Details Section 3-4
Subject: FileWrite
Notation Description Omission
Body: Para1:Destination folder Specifies the destination folder. Can be omitted.
name • MEMCARD specifies the Memory
Example) Card's root directory.
Specifying subdirectory OMRON in • EM specifies the EM file memory's
the Memory Card: root directory.
Para1:MEMCARD\OMRON Note If this parameter is omitted,
the default write destination is
the Memory Card's root direc-
tory.
Para2:Overwrite=OK or NG Specifies whether or not an existing Can be omitted.
Example) file may be overwritten.
Allowing existing file to be overwrit- • To allow an existing file with the
ten: same filename to be overwritten,
enter “Overwrite=OK.”
Para2:Overwrite=OK
• To prevent an existing file with the
same filename from being overwrit-
ten, enter “Overwrite=NG.”
Note If this parameter is omitted,
overwriting is prohibited.
Attached file: Any file Any file (up to 1 MB) can be Cannot be omitted.
attached.
Note The file can be up to 1 MB in
size.
Note If the Receive file with speci-
fied extension only Option is
selected in the Receive Mail
Tab, only files with the speci-
fied filename extensions can
be written.
Response Format
43
Remote Mail Command Details Section 3-4
Subject: FileRead
Notation Description Omission
Body: Para1:Source folder name Specifies the source folder. Can be omitted.
• MEMCARD specifies the Memory
Example) Card's root directory.
Specifying subdirectory OMRON in • EM specifies the EM file memory's
the Memory Card: root directory.
Para1:MEMCARD\OMRON Note If this parameter is omitted,
the default read source is the
Memory Card's root directory.
Para2:File name Specifies the name of the file Cannot be omitted.
(including the filename extension) to
be read.
Example)
Note If this parameter is omitted, a
Specifying AUTOEXEC.STD:
parameter error will occur.
Para2:AUTOEXEC.STD
Response Format
Subject: Re:FileRead
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
> Para1:Source folder name Included only if this parameter was specified.
> Para2:File name
44
Remote Mail Command Details Section 3-4
Subject: FileDelete
Notation Description Omission
Body: Para1:Folder name Specifies the folder containing the Can be omitted.
file to be deleted.
Example) • MEMCARD specifies the Memory
Card's root directory.
Specifying subdirectory OMRON in
the Memory Card: • EM specifies the EM file memory's
root directory.
Para1:MEMCARD\OMRON
Note If this parameter is omitted,
the default directory is the
Memory Card's root directory.
Para2:File name Specifies the name of the file Cannot be omitted.
(including the filename extension) to
be deleted.
Example)
Note If this parameter is omitted, a
Specifying AUTOEXEC.STD:
parameter error will occur.
Para2:AUTOEXEC.STD
Note If the Receive file with speci-
fied extension only Option is
selected in the Receive Mail
Tab, only files with the speci-
fied filename extensions can
be deleted.
Response Format
Subject: Re:FileDelete
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
> Para1:Folder name Included only if this parameter was specified.
> Para2:File name
45
Remote Mail Command Details Section 3-4
Subject: FileList
Notation Description Omission
Body: Para1:Source folder name Specifies the source folder contain- Can be omitted.
ing the files that will be listed.
Example) Note If this parameter is omitted,
the default source directory is
Specifying subdirectory OMRON in
the Memory Card's root direc-
the Memory Card:
tory.
Para1:MEMCARD\OMRON
Subject: Re:FileList
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
-------------------------------------------------------- File list
Directory Path: \omron
[A = Archive file , D = sub -Directory ]
• Directory Path:
[V = Volume label , S = System file ] Name of folder containing listed files
[H = Hidden file , R = Read -only file]
(FILENAME) (DATE) (FILESIZE) (ATTRI B)
• (FILENAME)
. 2003/06/12 17:15:17 0 _D____ File name
.. 2003/06/12 17:15:17 0 _D____
AUTOEXEC.OBJ 2003/06/12 17:19:07 2672 A_____
• (DATE)
AUTOEXEC.STD 2003/06/12 17:19:10 16048 A_____ Date that file was last updated
---- End of File List ----------------------------------
• (FILESIZE)
File size in bytes
• (ATTRIB)
File attributes
A: Archive file
D: Directory (folder)
V: Volume label
S: System file
H: Hidden file
R: Read-only file
> Para1:Source folder name Included only if this parameter was specified.
46
Remote Mail Command Details Section 3-4
Subject: UMBackup
Notation Description Omission
Body: Para1:Destination folder Specifies the destination folder in Can be omitted.
name which the user program will be
saved.
Example) • MEMCARD specifies the Memory
Card's root directory.
Specifying subdirectory OMRON in
the Memory Card: • EM specifies the EM file memory's
root directory.
Para1:MEMCARD\OMRON
Note If this parameter is omitted,
the default destination is the
Memory Card's root directory.
Para2:File name Specifies the name of the file in Can be omitted.
which the user program data will be
saved.
Example)
Note If this parameter is omitted,
Specifying USER.OBJ:
the default file name is
Para2:USER.OBJ AUTOEXEC.OBJ.
Para3:Overwrite=OK or NG Specifies whether or not an existing Can be omitted.
file may be overwritten.
Example) • To allow an existing file with the
same filename to be overwritten,
Allowing existing file to be overwrit- enter “Overwrite=OK”.
ten:
• To prevent an existing file with the
Para3:Overwrite=OK same filename from being overwrit-
ten, enter “Overwrite=NG”.
Note If this parameter is omitted,
overwriting is prohibited.
Response Format
Subject: Re:UMBackup
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
> Para1:Destination folder name Included only if this parameter was specified.
> Para2:File name Included only if this parameter was specified.
> Para3:Overwrite=OK or NG Included only if this parameter was specified.
47
Remote Mail Command Details Section 3-4
Subject: PARAMBackup
Notation Description Omission
Body: Para1:Destination folder Specifies the destination folder in Can be omitted.
name which the user program will be
saved
Example) • MEMCARD specifies the Memory
Card's root directory.
Specifying subdirectory OMRON in
the Memory Card: • EM specifies the EM file memory's
root directory.
Para1:MEMCARD\OMRON
Note If this parameter is omitted,
the default destination is the
Memory Card's root directory.
Para2:File name Specifies the name of the file in Can be omitted.
which the parameter area data will
be saved.
Example)
Note If this parameter is omitted,
Specifying USER.STD:
the default file name is
Para2:USER.STD AUTOEXEC.STD.
Para3:Overwrite=OK or NG Specifies whether or not an existing Can be omitted.
file may be overwritten.
Example) • To allow an existing file with the
same filename to be overwritten,
Allowing existing file to be overwrit- enter “Overwrite=OK”.
ten:
• To prevent an existing file with the
Para3:Overwrite=OK same filename from being overwrit-
ten, enter “Overwrite=NG”.
Note If this parameter is omitted,
overwriting is prohibited.
Response Format
Subject: Re:PARAMBackup
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
> Para1:Destination folder name Included only if this parameter was specified.
> Para2:File name Included only if this parameter was specified.
> Para3:Overwrite=OK or NG Included only if this parameter was specified.
48
Remote Mail Command Details Section 3-4
Subject: IOMWrite
Notation Description Omission
Body: Para1:File format The file format is specified with two digits, as follows: Cannot be omit-
Para1: AB ted.
Example) A Data format
Specifying a file of comma-delimited 0: Binary (.IOM)
word data with returns every 16 fields: 1: Non-delimited words (.TXT)
Para1:3D 2: Non-delimited double words (.TXT)
3: Comma-delimited words (.CSV)
4: Comma-delimited double words (.CSV)
5: Tab-delimited words (.TXT)
6: Tab-delimited double words (.TXT)
B Carriage returns
0: No returns
8: Return every 10 fields
9: Return every 1 field
A: Return every 2 fields
B: Return every 4 fields
C: Return every 5 fields
D: Return every 16 fields
Note If this parameter is omitted, a parameter error
will occur.
Para2:Starting write address Specify the data area and address as follows: Cannot be omit-
• CIO Area: CH_0 to CH_6143 ted.
Example) • Work Area: W_0 to W_511
Specifying D00100 as the starting • Holding Area: H_0 to H_511
address: • Auxiliary Area: A_0 to A_447
Para2:D_100 • Timer Area: T_0 to T_4095
• Counter Area: C_0 to C_4095
• DM Area: D_0 to D_32767
• EM Area (current EM bank): E_0 to E_32767
• EM Area (EM bank 0): E0_0 to E0_32767
• EM Area (EM bank 1): E1_0 to E1_32767
• EM Area (EM bank 2): E2_0 to E2_32767
• EM Area (EM bank 3): E3_0 to E3_32767
• EM Area (EM bank 4): E4_0 to E4_32767
• EM Area (EM bank 5): E5_0 to E5_32767
• EM Area (EM bank 6): E6_0 to E6_32767
• EM Area (EM bank 7): E7_0 to E7_32767
• EM Area (EM bank 8): E8_0 to E8_32767
• EM Area (EM bank 9): E9_0 to E9_32767
• EM Area (EM bank A): EA_0 to EA_32767
• EM Area (EM bank B): EB_0 to EB_32767
• EM Area (EM bank C): EC_0 to EC_32767
Note If this parameter is omitted, a parameter error
will occur.
Attached file: Yes Attach an I/O data file (IOM, CSV, or TXT format). Cannot be omit-
Note Up to 6,000 words can be written from the ted.
data file. Attach a file with 6,000 or fewer
words of data.
Note Only a file with the IOM, CSV, or TXT can be
written to I/O memory. Files with any other file-
name extension cannot be written to I/O mem-
ory regardless of the allowed file settings set in
the Receive Mail Tab.
49
Remote Mail Command Details Section 3-4
Response Format
Subject: Re:IOMWrite
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
> Para1:File format
> Para2:Starting write address
> Para3:Overwrite=OK or NG Included only if this parameter was specified.
50
Remote Mail Command Details Section 3-4
Subject: IOMRead
Notation Description Omission
Body: Para1:File format The file format is specified with two digits, as fol- Cannot be omit-
lows: ted.
Example) Para1: AB
Specifying a file of comma-delimited A Data format
word data with returns every 16 fields: 0: Binary (.IOM)
Para1:3D 1: Non-delimited words (.TXT)
2: Non-delimited double words (.TXT)
3: Comma-delimited words (.CSV)
4: Comma-delimited double words (.CSV)
5: Tab-delimited words (.TXT)
6: Tab-delimited double words (.TXT)
B Carriage returns
0: No returns
8: Return every 10 fields
9: Return every 1 field
A: Return every 2 fields
B: Return every 4 fields
C: Return every 5 fields
D: Return every 16 fields
Note If this parameter is omitted, a parameter
error will occur.
Para2:Starting read address Specify the data area and address as follows: Cannot be omit-
• CIO Area: CH_0 to CH_6143 ted.
Example) • Work Area: W_0 to W_511
Specifying D00100 as the starting • Holding Area: H_0 to H_511
address: • Auxiliary Area: A_0 to A_447
Para2:D_100 • Timer Area: T_0 to T_4095
• Counter Area: C_0 to C_4095
• DM Area: D_0 to D_32767
• EM Area (current EM bank): E_0 to E_32767
• EM Area (EM bank 0): E0_0 to E0_32767
• EM Area (EM bank 1): E1_0 to E1_32767
• EM Area (EM bank 2): E2_0 to E2_32767
• EM Area (EM bank 3): E3_0 to E3_32767
• EM Area (EM bank 4): E4_0 to E4_32767
• EM Area (EM bank 5): E5_0 to E5_32767
• EM Area (EM bank 6): E6_0 to E6_32767
• EM Area (EM bank 7): E7_0 to E7_32767
• EM Area (EM bank 8): E8_0 to E8_32767
• EM Area (EM bank 9): E9_0 to E9_32767
• EM Area (EM bank A): EA_0 to EA_32767
• EM Area (EM bank B): EB_0 to EB_32767
• EM Area (EM bank C): EC_0 to EC_32767
Note If this parameter is omitted, a parameter
error will occur.
Para3:Number of words Specifies the number of words (1 to 6,000) to read. Cannot be omit-
Note Up to 6,000 words can be read to the ted.
Example) attached file. Specify 6,000 or fewer words
Specifying 50 words: for the number of words to read.
Para3:50 Note If this parameter is omitted, a parameter
error will occur.
51
Remote Mail Command Details Section 3-4
Para4:File name Specifies the name of the file (including the file- Can be omitted.
name extension) in which the read data will be
stored.
Example)
Specifying MEMORY.TXT: Note Only filename extensions IOM, CSV, and
TXT can be used. Other filename exten-
Para4:MEMORY.TXT sions cannot be specified.
Note If this parameter is omitted, the file will be
saved as BACKUP.IOM, BACKUP.TXT, or
BACKUP.CSV.
Response Format
Subject: Re:IOMRead
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
> Para1:File format
> Para2:Starting read address
> Para3:Number of words
> Para4:File name Included only if this parameter was specified.
52
Remote Mail Command Details Section 3-4
Subject: ChangeMode
Notation Description Omission
Body: Para1:RUN (or MON or PRG) Changes the CPU Unit's operating Cannot be omitted.
mode.
Example) • To change to RUN mode, enter
RUN.
Changing to RUN mode:
• To change to MONITOR mode,
Para1:RUN enter MON.
• To change to PROGRAM mode,
enter PRG.
Note If this parameter is omitted, a
parameter error will occur.
Response Format
Subject: Re:ChangeMode
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
> Para1:RUN (or MON or PRG)
53
Remote Mail Command Details Section 3-4
Subject: ErrorLogRead
Notation Description Omission
Body: Para1:Unit address Specifies the unit address of the Cannot be omitted.
Unit from which the error log will be
read.
Example)
Note If this parameter is omitted, a
Specifying a CPU Bus Unit (unit
parameter error will occur.
number 0):
Para1:10
Response Format
Subject: Re:ErrorLogRead
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
> Para1:Unit address
54
Remote Mail Command Details Section 3-4
Subject: ErrorLogClear
Notation Description Omission
Body: Para1:Unit address Specifies the unit address of the Cannot be omitted.
Unit from which the error log will be
cleared.
Example)
Note If this parameter is omitted, a
Specifying a CPU Bus Unit (unit
parameter error will occur.
number 0):
Para1:10
Response Format
Subject: Re:ErrorLogClear
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
> Para1:Unit address
55
Remote Mail Command Details Section 3-4
Subject: MailLogRead
Notation Description Omission
Body: None --- ---
Response Format
Subject: Re:MailLogRead
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
-- (Mail Log List) -- The mail log list read from the Ethernet Unit is
returned in the body of the response e-mail. The
mail log entries contain the following information:
• Source e-mail address
• Received command
• Date/time of reception
56
Remote Mail Command Details Section 3-4
Subject: MailLogClear
Notation Description Omission
Body: None --- ---
Response Format
Subject: Re:MailLogClear
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
57
Remote Mail Command Details Section 3-4
Subject: Test
Notation Description Omission
Body: None --- ---
Response Format
Subject: Re:Test
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
58
Remote Mail Command Details Section 3-4
Subject: FinsSend
Notation Description Omission
Body: Para1:FINS header Enter the desired FINS header val- Cannot be omitted.
ues for DNA, DA1, and DA2.
Example) Note If this parameter is omitted, a
parameter error will occur.
Specifying DNA=01, DA1=02, and
DA2=00:
Para1:010200
Para2:Command code and Enter the command code and Cannot be omitted.
parameter parameter.
*: Always specify this as a termina-
Example) tor.
Specifying 0501: Note If this parameter is omitted, a
parameter error will occur.
Para2:0501*
Response Format
Subject: Re:FinsSend
Response contents Description
Body: Response Code:@@@@ Refer to 3-4-2 Response List.
Response Status:@@@@ Refer to 3-4-2 Response List.
-- (FINS header) -- The FINS response is entered in the e-mail body.
-- (Response data) -- The FINS response is entered in the e-mail body.
59
Mail Receive Function Status Section 3-5
n+17 - - - - - - - - - - - - - - -
To maintain the uniformity of the data in the data file, use this flag as a condi-
tion for write operations in the ladder program to prevent the ladder program
from overwriting the data while it is being converted to a data file.
Note The IOM file format is compatible with the CPU Unit's READ DATA FILE and
WRITE DATA FILE instructions (FREAD and FWRIT) set to binary data for-
mat.
60
I/O Memory Data Formats Section 3-6
TXT Format When hexadecimal I/O memory data (1234, 5678, 9ABC, etc.) is being copied
to an attached file in TXT format, the data is converted to ASCII in one-word
fields or two-word fields. The fields (one-word or two-word) are delimited by
tabs ([HT]: 09) and a return and line feed ([CR][LF]: 0D0A) are inserted after
the specified number of fields.
Example: Tab-delimited words with a return every 10 fields
I/O memory contents
+0 +1 +2 +3 +4 +5 +6 +7 +8 +9
+0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678
+10 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0
The @ character represents a hard tab and is displayed as a tab in text displays.
Note The TXT file format is compatible with the CPU Unit's READ DATA FILE and
WRITE DATA FILE instructions (FREAD and FWRIT) set to tab-delimited
data.
CSV Format When hexadecimal I/O memory data (1234, 5678, 9ABC, etc.) is being copied
to an attached file in CSV format, the data is converted to ASCII in one-word
fields or two-word fields. The fields (one-word or two-word) are delimited by
commas (",": 2C) and a return and line feed ([CR][LF]: 0D0A) are inserted
after the specified number of fields.
Example: Comma-delimited words with a return every 10 fields
I/O memory contents
+0 +1 +2 +3 +4 +5 +6 +7 +8 +9
+0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678
+10 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0
Note The CSV file format is compatible with the CPU Unit's READ DATA FILE and
WRITE DATA FILE instructions (FREAD and FWRIT) set to comma-delimited
data.
61
Attached File Transfer Times Section 3-7
Note (1) The access times for FileWrite and FileRead commands indicate Memo-
ry Card access times.
(2) The access times in the tables above are standard times when the PLC
Setup's “Fixed Peripheral Servicing Time” setting is set to the default val-
ue of 4% of the cycle time.
(3) The attached file transfer time can be reduced by increasing the time al-
lowed for peripheral servicing in the PLC Setup's “Fixed Peripheral Ser-
vicing Time” setting.
62
Mail Receive Function Errors Section 3-8
Note For more details on the error log, refer to 8-3 Error Log in the Operation Man-
ual Construction of Networks.
63
Mail Receive Function Errors Section 3-8
Note For more details on the error log, refer to 8-3 Error Log in the Operation Man-
ual Construction of Networks (W420).
64
Example Application Section 3-9
3-9-2 Step 2. Make the Unit Setup Settings from the CX-Programmer
With the CX-Programmer connected online, select the Ethernet Unit in the
CX-Programmer's PLC I/O Table Window, right-click and select Unit Setup
from the popup menu. Make the following settings in the CPU Bus Unit Setup
Area from the CPU Bus Unit Setup Window.
Local Mail Address (SMTP
Tab)
Item name Example
Local mail address [email protected]
65
Example Application Section 3-9
Subject: IOMRead
Body: Para1:38
Para2:D_100
Para3:10
Para4: D00100.CSV
Subject: UMBackup
Body: Para2:USER.OBJ
66
SECTION 4
FTP Server
4-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4-1-1 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4-2 FTP Server Function Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4-2-1 File Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4-2-2 Connecting to the FTP Server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4-3 Using the FTP Server Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4-3-1 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4-3-2 List of Settings Required for the FTP Server Function . . . . . . . . . . 71
4-3-3 Setup Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4-4 FTP Server Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4-5 Using FTP Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4-5-1 Table of Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4-5-2 Using the Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4-5-3 Error Messages and FTP Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4-6 Checking FTP Status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4-6-1 FTP Status Flag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4-7 Using File Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4-7-1 File Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4-7-2 File Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4-7-3 Initializing File Memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4-7-4 I/O Memory Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4-8 FTP File Transfer Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4-9 UNIX Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
67
Overview Section 4-1
4-1 Overview
The Ethernet Unit has a built-in FTP (File Transfer Protocol) server function,
so other computers on the Ethernet can read or write (upload/download) large
files in the EM file memory by executing FTP commands from the FTP client
software.
Intranet FTP client
Ethernet
Upload
Large file
Files in the EM File Memory or the
Memory Card mounted to the CPU
Unit.
Note Only one FTP client can connect at the same time.
4-1-1 Specifications
Item Specification
Executable com- open: Connects the specified host FTP server.
mands user: Specifies user name for the remote FTP server.
ls: Displays the Memory Card file names.
dir: Display the Memory Card file names and details.
rename: Changes a file name.
mkdir: Creates a new directory in the working directory in the remote host.
rmdir: Deletes a new directory from the working directory in the remote host.
cd: Changes the Ethernet Unit work directory to the specified directory.
cdup: Changes the working directory at the remote host to the parent directory.
pwd: Displays the Ethernet Unit work directory.
type: Specifies the data type of transferred files.
get: Transfers the specified file from the Memory Card to the local host.
mget: Transfers multiple files from the Memory Card to the local host.
put: Transfers the specified local file to the Memory Card.
mput: Transfers multiple local files to the Memory Card.
delete: Deletes the specified file from the Memory Card.
mdelete: Deletes multiple files from the Memory Card.
close: Disconnects the FTP server.
bye: Closes the FTP (client).
quit: Closes the FTP (client).
Protection FTP login name consists of 12 letters max. CONFIDENTIAL is the default login name.
Password consists of 8 characters max.
Protocol FTP (port number: 21/TCP)
Number of connec- 1
tions
Note The PLC, however, is unable to read or write files at other nodes using FTP
because the Ethernet Unit does not support FTP client functions.
68
FTP Server Function Details Section 4-2
Note 1. The date of the MEMCARD directory displayed for ls or dir commands in
the root directory will be the date of the file system volume label.
2. The login date will be displayed for EM files and for MEMCARD if a volume
label has not been created.
Setting Restrictions
The following restrictions apply to login names and passwords.
• The login name and password must consist of alphanumeric characters,
hyphens, and/or underscores. They are not case sensitive.
• A login name consists of 12 characters.
• A password consists of 8 characters.
• Always set a password when setting a new login name. The login name
will not be valid unless a password is set for it.
69
Using the FTP Server Function Section 4-3
• If a login name is not set or contains illegal characters, the default login
name, CONFIDENTIAL, must be used. No password is required and any
password that is set will be ignored.
FTP File Transfer Mode
FTP has two file transfer modes: ASCII mode and binary mode. Before start-
ing to transfer files, use the type command (specifies the data type of
transferred files) to select the required mode.
Always select binary mode for binary files (extensions .IOM, .STD, or .OBJ) in
the CS/CJ-series file memory and other program files (with extensions such
as .CXP).
Note The Ethernet Unit will be restarted when the settings data is transferred to the
CPU Bus Unit System Setup Area, so that the new settings are read and
70
Using the FTP Server Function Section 4-3
become effective. Verify that it is safe for the Ethernet Unit to restart before
transferring the settings data.
■ Settings
Setting Details Default value
Login Set the login name to externally connect to None
the Ethernet Unit via FTP. (CONFIDENTIAL is
used.)
Password Set the password to externally connect to the None
Ethernet Unit via FTP.
Port No. This setting does not normally need to be 0
changed. (21 is used.)
FTP uses two ports: a port for control and a
port for data transfer. Set the control port
only. The data transfer port uses the value
set for the control port –1.
71
FTP Server Application Example Section 4-4
1,2,3... 1. Make sure that a Memory Card is inserted in the CPU Unit and turn ON
the power supply to the PLC. If EM File Memory is to be used, create the
EM File Memory.
2. Connect to the FTP server from a computer on the Ethernet by entering
the text that is underlined in the following diagram.
IP address of the Ethernet Unit
$ ftp 150.31.2.83
connected to 150.31.2.83
Results
220 **IPaddress** CS1W-ETN21 FTP server(FTP**version**)ready
Name:CONFIDENTIAL Login name
230 Guest logged in.
ABC (subdirectory)
DEF.IOM (file)
Results
Results
72
Using FTP Commands Section 4-5
Function
Connects the FTP server. Normally when the FTP client is booted, the FTP
server IP address is specified to execute this command automatically.
73
Using FTP Commands Section 4-5
user
Format
user [user_name]
Function
Specifies the user name. Specify the FTP login name set in the Ethernet Unit
system setup. The default FTP login name is “CONFIDENTIAL.”
If a non-default login name is used, it must be followed by the password. In
this case, enter the FTP password set in the system setup.
The user name is automatically requested immediately after connection to the
FTP server.
ls
Format
ls [-l] [REMOTE_FILE_NAME [local_file_name]]
Function
Displays the remote host (Memory Card or EM File Memory) file names.
Set the switch [-l] to display not only the file names but the creation date and
size as well. If the switch is not set, only the file names will be displayed.
You can specify a file name in the Memory Card or EM File Memory if desired.
If a local file name is specified, the file information will be stored in the speci-
fied file in the host computer.
dir
Format
dir [REMOTE_FILE_NAME [local_file_name]]
Function
Displays the file names, date created, and size of the files in the remote host
(Memory Card or EM File Memory). It displays the same information as com-
mand [ls -l].
Specify a file name in the Memory Card or EM File Memory as the remote file
name.
If a local file name is specified, the file information is stored in the specified file
in the host computer.
rename
Format
rename CURRENT_FILE_NAME NEW_FILE_NAME
Function
Changes the specified current file name to the specified new file name.
rename can be used only to change the file name. It cannot be used to move
the file to a different directory.
74
Using FTP Commands Section 4-5
mkdir
Format
mkdir DIRECTORY_NAME
Function
Creates a directory of the specified name at the remote host (Memory Card or
EM File Memory).
An error will occur if a file or directory of the same name already exists in the
working directory.
rmdir
Format
rmdir DIRECTORY_NAME
Function
Deletes the directory of the specified name from the remote host (Memory
Card or EM File Memory).
The directory must be empty to delete it.
An error will occur if the specified directory does not exist or is empty.
pwd
Format
pwd
Function
Displays the remote host’s (Ethernet Unit) current work directory.
cd
Format
cd [directory_name]
Function
Changes the remote host (Ethernet Unit) work directory to the specified
remote directory.
The files in the Memory Card are contained in the MEMCARD directory under
the root directory (/). The files in EM File Memory are contained in the EM
directory under the root directory (/). The root directory (/) is the directory
used when logging into the Ethernet Unit. No MEMCARD directory will exist if
a Memory Card is not inserted in the PLC or if the Memory Card power indica-
tor is not lit. No EM directory will exist if EM File Memory does not exist.
cdup
Format
cdup
Function
Changes the working directory at the remote host to the parent directory (one
directory above the current working directory).
75
Using FTP Commands Section 4-5
type
Format
type data_type
Function
Specifies the file data type. The following data types are supported:
ascii: Files are transferred as ASCII data
binary (image): Files are transferred as binary data.
All files are treated by the PLC as binary files. Before reading or writing any
files, always use the type command to set the file type to binary. File con-
tents cannot be guaranteed if transferred as ASCII data.
The default file type is ASCII.
get
Format
get FILE_NAME [receive_file_name]
Function
Transfers the specified remote file from the Memory Card or EM File Memory
to the local host.
A receive file name can be used to specify the name of the file in the local
host.
mget
Format
mget FILE_NAME
Function
Allows the use of a wildcard character (*) to transfer multiple remote files from
the Memory Card or EM File Memory to the local host.
put
Format
put file_name [DESTINATION_FILE_NAME]
Function
Transfers the specified local file to the remote host (Memory Card or EM File
Memory).
A destination file name can be used to specify the name the file is stored
under in the Memory Card or EM File Memory.
Any existing file with the same name in the remote host (Memory Card or EM
File Memory) will be overwritten by the contents of the transferred file.
If an error occurs during file transfer, the file being transferred will be deleted
and the transmission will end in an error.
mput
Format
mput FILE_NAME
Function
Allows the use of a wildcard character (*) to transfer multiple local files to the
remote host (Memory Card or EM File Memory).
76
Using FTP Commands Section 4-5
Any existing file with the same name in the remote host (Memory Card or EM
File Memory) will be overwritten by the contents of the transferred file.
If an error occurs during file transfer, the file being transferred will be deleted
and the transmission of that file will end in an error. However, mput execution
will continue and remaining files will be transferred.
delete
Format
delete FILE_NAME
Function
Deletes the specified remote file from the Memory Card or EM File Memory.
mdelete
Format
mdelete FILE_NAME
Function
Allows the use of a wildcard character (*) to delete multiple remote files from
the Memory Card or EM File Memory.
close
Format
close
Function
Disconnects the Ethernet Unit’s FTP server.
bye
Format
bye
Function
Ends the FTP (client).
quit
Format
quit
Function
Ends the FTP (client).
77
Using FTP Commands Section 4-5
78
Checking FTP Status Section 4-6
Status of Meaning
bit 00
1 FTP server busy (a user is connected)
0 FTP server free
Note 1. File operations for files on the Memory Card are performed during FTP
communications. Do not remove the Memory Card or turn OFF power to
the PLC while FTP is being used.
2. When using File Memory Instruction from the program in the CPU Unit,
program exclusive control using the FTP Status Flag so that the same data
is not manipulated simultaneously by more than one instruction.
3. The FTP status can also be checked using the software switch settings on
the CX-Programmer.
■ FTP Indicator
The FTP indicator on the Ethernet Unit indicates FTP status as shown in the
following table.
FTP indicator Meaning
Lit FTP server busy (a user is connected)
Not lit FTP server free
79
Using File Memory Section 4-7
Memory Card
File
File
EM File
Memory
File
■ Directories
Up to five levels of directories (including root as the first level) can be created
as file storage locations. A maximum of 65 characters can be used in direc-
tory names.
80
Using File Memory Section 4-7
81
Using File Memory Section 4-7
+0 +1 +2 +3 +4 +5 +6 +7 +8 +9
+0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678
+10 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0
48 bytes
(Reserved by the system.)
■ TXT Format
The TXT format is a data format (using tab delimiters) specified by the ladder
instructions, READ DATA FILE (FREAD(700)) and WRITE DATA FILE
(FWRIT(701)), in the CPU Unit. The format is configured according to the
specified FREAD(700) and FWRIT(701) parameters, as follows:
Data format Use of CRs and CR position
• Words without delimiters • No CRs
• Double words without delimiters • CR after every 10 fields.
• Words delimited by tabs. • CR after each field.
• Double words delimited by tabs • CR after every 2 fields.
• CR after every 4 fields.
• CR after every 5 fields.
• CR after every 16 fields.
If data from the I/O memory (1234 hexadecimal, 5678 hexadecimal, 9ABC
hexadecimal, etc.) is contained in an attached file in TXT format, the data will
be converted into ASCII format in words or double-words. The words are
delimited by inserting tabs ([HT]: 09), and carriage returns (CR) after specified
fields ([CR][LF]: 0D0A).
Example: Data format using words delimited by tabs and CRs after every 10 fields.
82
Using File Memory Section 4-7
I/O memory
+0 +1 +2 +3 +4 +5 +6 +7 +8 +9
+0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678
+10 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0
■ CSV Format
The CSV format is a data format (using comma delimiters) that is specified by
ladder instructions, READ DATA FILE (FREAD(700)) and WRITE DATA FILE
(FWRIT(701)), in the CPU Unit. The CSV format is configured according to
the specified FREAD(700) and FWRIT(701) parameters, as follows:
Data format Use of CRs and CR position
Words delimited by commas. • No CRs
Double words delimited by com- • CR after every 10 fields.
mas. • CR after each field.
• CR after every 2 fields.
• CR after every 4 fields.
• CR after every 5 fields.
• CR after every 16 fields.
If word data from the I/O memory (1234 hexadecimal, 5678 hexadecimal, up
to DEF0 hexadecimal) is contained in an attached file in CSV format, the word
data will be converted into ASCII format in word or double-word units. The
words are delimited by inserting comma delimiters (',':2C), and CRs after
specified fields ([CR][LF]: 0D0A).
Example: Data format using words delimited by commas with CRs after every
10 fields.
83
Using File Memory Section 4-7
I/O memory
+0 +1 +2 +3 +4 +5 +6 +7 +8 +9
+0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678
+10 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0
Note FREAD(700) will not be able to read the last byte in a file that has been written
to the Memory Card if the file contains an odd number of bytes. Add 00 hexa-
decimal to the end of the file if necessary to write an even number of bytes to
the Memory Card.
Note The UM and DM Areas contain binary data. Set the data type to binary using
the type command before reading or writing files using FTP.
Note For details on how to use File Memory Instructions, refer to the CS/CJ Series
Instructions Reference Manual (W340).
84
FTP File Transfer Time Section 4-8
Note 1. The above times assume that the Fixed Peripheral Servicing Time in the
PLC Setup is set to the default value of 4%.
2. If the Fixed Peripheral Servicing Time in the PLC Setup is increased, FTP
files will be transferred faster.
85
UNIX Application Example Section 4-9
FTP started.
21
Login name
3. Make sure the Memory Card is inserted. The MEMCARD directory will be
displayed if there is a Memory Card in the CPU Unit.
86
UNIX Application Example Section 4-9
File read.
File written
8. End FTP.
FTP ended.
87
UNIX Application Example Section 4-9
88
SECTION 5
Automatic Clock Adjustment Function
This section provides an overview of the automatic clock adjustment function, including details on specifications, required
settings, operations from CX-Programmer, and troubleshooting.
5-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5-1-1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5-1-2 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5-2 Using the Automatic Clock Adjustment Function . . . . . . . . . . . . . . . . . . . . . 91
5-2-1 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5-2-2 Settings Required for Automatic Clock Adjustment Function. . . . . 92
5-2-3 Auto Adjust Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
5-3 Automatic Clock Adjustment Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5-4 Automatic Clock Adjustment Error Processing . . . . . . . . . . . . . . . . . . . . . . . 94
5-4-1 Automatic Clock Adjustment (SNTP) Errors. . . . . . . . . . . . . . . . . . 94
5-4-2 Troubleshooting Automatic Clock Adjustment Errors with Indicators 94
5-4-3 Error Log Error Codes for the Automatic Clock Adjustment Function 95
89
Overview Section 5-1
5-1 Overview
5-1-1 Overview
The Ethernet Unit can obtain the clock information from the SNTP server (see
note 1) at a particular time or when a designated bit turns ON and then
refresh the internal clock information of the CPU Unit to which it is mounted
(referred to as the local CPU Unit)
Intranet
SNTP server
Automatic clock The clock information can be broadcast
adjustment to other CPU Units on the same Network.
24 : 00 : 00
Ethernet
24 : 00 : 00 Ethernet Unit
Note (1) The SNTP (Simple Network Time Protocol) server is used to control the
time on the LAN.
(2) An error will occur in the following CPU Units when the automatic clock
adjustment function is executed under the conditions shown in the table.
CPU Unit Conditions
CPU Units manufactured on or When the CPU execution mode is set to other
before January 31, 2003 (lot num- than normal mode (priority peripheral servicing
bers 030131 or earlier): mode, parallel processing with synchronous
CJ1G-CPU@@H memory access mode, or parallel processing
CJ1H-CPU@@H with asynchronous memory access mode).
CS1G-CPU@@H AND
CS1H-CPU@@H When the CPU Unit operating mode is set to
RUN or MONITOR mode.
(3) The manufacturing date can be determined from the lot number on the
side or top corner of the CPU Unit.
(4) The lot numbers are as follows:
YYMMDDnnnn, in which YY indicates the last two digits of the year, MM
the month, DD the day, and nnnn the serial number.
(5) In accordance with SNTP protocol specifications, automatic adjustment
will not be possible from February 7, 2036. In Ethernet Units, this function
will no longer operate from February 7, 2036 (this status will not be dis-
played as error information).
90
Using the Automatic Clock Adjustment Function Section 5-2
5-1-2 Specifications
Item Specification
Protocol SNTP
Port number 123 (UDP)
Can also be set from the CX-Programmer in the Unit Setup.
Adjustment timing Automatic (fixed time) and manual (manual only cannot be
set)
Access to SNTP Writes the clock information Obtains the clock information
server from the SNTP server to the from the SNTP server set up
local CPU Unit. on the Network, and applies
the information obtained to
the local CPU Unit.
Refresh timing When the automatic clock adjustment switch is turned from
OFF to ON and at a specified time.
91
Using the Automatic Clock Adjustment Function Section 5-2
Note When the Server specification type field in Auto Adjust Time Tab is set to Host
name.
92
Using the Automatic Clock Adjustment Function Section 5-2
93
Automatic Clock Adjustment Switch Section 5-3
Automatic Clock
Adjustment Switch
When the Automatic Clock Adjustment Switch turns from OFF to ON, the
Ethernet Unit obtains the clock data from the SNTP server on the network,
and applies it to the local CPU Unit. After applying the data, the switch auto-
matically turns OFF again.
94
Automatic Clock Adjustment Error Processing Section 5-4
Note For details on other error log information, refer to the Operation Manual, Con-
struction of Networks: SECTION 8 Troubleshooting.
5-4-3 Error Log Error Codes for the Automatic Clock Adjustment
Function
When an error occurs while the Ethernet Unit is operating, the error code,
detailed error code, and time the error occurred are saved in the error log.
The following table provides a list of the error codes.
The error log can be read by sending FINS commands to the Ethernet Unit or
by using the mail receive function and specifying the ErrorLogRead com-
mand.
Error Meaning Detailed error code Correction EEPROM
code 1st byte 2nd byte
021A Logic error 00 01: Data link Recreate the data Saved
in setting table specified by the
table 02: Network 2nd byte of the
parameters detailed error
code.
03: Routing
tables
04: Setup
05: CPU Bus
Unit Words
(CIO/DM)
03C1 Server set- 00: DNS 01: IP address Set the server ---
ting error 01: SMTP 02: Host name settings correctly
02: POP3 based on the
03: SNTP 03: Port number information in the
04: Other detailed error
parameters code.
03C4 Server 00: DNS 01: Specified Take either of the ---
connection 01: SMTP host does not following mea-
error exist sures.
02: POP3
02: No service • Correct the set-
03: SNTP at specified host tings for each
03: Timeout server.
04: Closed uni- • Inspect the com-
laterally by host munications
path (Ethernet
05: Cannot con- Unit, cable con-
nect because nections, hub,
account infor- router, server),
mation does not and correct the
match situation that is
06: Host name causing the
resolution error error.
07: Transmis-
sion error
08: Reception
error
09: Other error
95
Automatic Clock Adjustment Error Processing Section 5-4
Note (1) For details on other error log information, refer to the Operation Manual,
Construction of Networks: SECTION 8 Troubleshooting.
(2) An error will occur in the following CPU Units when the automatic clock
adjustment function is executed under the conditions shown in the table.
CPU Unit Conditions
CPU Units manufactured on or When the CPU execution mode is set to other
before January 31, 2003 (lot num- than normal mode (priority peripheral servicing
bers 030131 or earlier): mode, parallel processing with synchronous
CJ1G-CPU@@H memory access mode, or parallel processing
CJ1H-CPU@@H with asynchronous memory access mode).
CS1G-CPU@@H AND
CS1H-CPU@@H When the CPU Unit operating mode is set to
RUN or MONITOR mode.
(3) The manufacturing date can be determined from the lot number on the
side or top corner of the CPU Unit.
(4) The lot numbers are as follows:
YYMMDDnnnn, in which YY indicates the last two digits of the year, MM
the month, DD the day, and nnnn the serial number.
96
SECTION 6
Socket Services
This section describes the functionality provided by the Ethernet Unit via the socket services.
97
6-8 Using Socket Services with CMND(490) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6-8-1 Using Socket Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6-8-2 Socket Services and Socket Status . . . . . . . . . . . . . . . . . . . . . . . . . . 136
6-8-3 Basic FINS Command Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
6-8-4 Response Codes in the Command Response. . . . . . . . . . . . . . . . . . . 138
6-8-5 Response Codes in the Results Storage Areas . . . . . . . . . . . . . . . . . 138
6-8-6 Communications Timing Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
6-8-7 Socket Service Timing Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
6-8-8 TCP/IP Communications Programming Example . . . . . . . . . . . . . . 140
6-8-9 UDP/IP Communications Programming Example . . . . . . . . . . . . . . 148
6-9 Precautions in Using Socket Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
6-9-1 UDP and TCP Socket Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
6-9-2 UDP Socket Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
6-9-3 TCP Socket Service. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
6-9-4 Precautions in Using Socket Service Request Switches . . . . . . . . . . 155
6-9-5 Times Required for Sending and Receiving for Socket Services . . . 156
98
Overview of Socket Communications from Ethernet Units Section 6-1
UDP socket 1
UDP open request
Socket
services
Sockets
TCP socket 8
TCP socket
port 65535
99
Protocol Overview Section 6-2
■ TCP Communications
The following procedure is followed each time data is transmitted to ensure
that the data arrives normally at the remote node:
1,2,3... 1. The remote node returns ACK when data is received normally.
2. The local node sends the next data after it receives ACK, or it resends the
same data if ACK is not returned within the specified time.
Transmitted data
Send Receive
request ACK (acknowledge) request
made. made.
Resent data
Local node when ACK is not returned Remote node
With the TCP protocol, the remote IP address and remote TCP port number
are specified when an open request is made for a socket. When a send
request is made, the number of bytes to send and the send data are specified.
When a receive request is made, the number of bytes to receive is specified.
With the TCP protocol, communications with another remote device are not
possible until the socket that was opened has been closed.
■ UDP Communications
Data is simply sent to the remote node. Unlike TCP, the reception of data is
not checked and data is not resent. To increase communication reliability, data
resends must be programmed by the user in user application.
Transmitted data
Send Receive
request request
made. ACK (acknowledge: only when made.
processed by application)
With the UDP protocol, the remote IP address and remote UDP port number
are not specified when an open request is made for a socket. When a send
request is made, the remote IP address, the remote UDP port number, the
number of bytes to send, and the send data are specified. When a receive
request is made, the number of bytes to receive is specified. (The response
data shows from which IP address and UDP port number the received data
was sent.)
With the UDP protocol, communications with another remote device are
possible even if the socket that was opened is not closed.
6-2-2 Opening TCP Sockets
To achieve highly reliable data communications, TCP establishes a virtual
communications circuit between the two nodes before starting data
transmissions. The virtual communications circuit is known as a “connection.”
100
Protocol Overview Section 6-2
Note 1. TCP sockets must be closed once a connection has been made before
communications are possible with other TCP sockets. This is true for other
server and client sockets. Up to eight TCP sockets can be open simulta-
neously.
2. With UDP sockets, communications are possible with more than one other
UDP socket.
3. When a connection is made between two nodes, the process at the node
providing a service is called the server, and the process at the node re-
questing the service is called the client. The server is started first and waits
for a service request from a client. The client requests to the server that a
connection be opened and then transmits data. When the TCP protocol is
used, however, the client–server relationship does not need to be pro-
grammed in the application because it is automatically handled by the pro-
tocol.
Passive open
Active open
Connection requested
ACK (acknowledge)
Data receive request
Send next data
ACK (acknowledge)
Next data receive request Data receive request
Close Close
101
Protocol Overview Section 6-2
1,2,3... 1. The sending user program sends a request to send 1,984 bytes of data.
2. The Ethernet Unit fragments the send data into Data A with 1,024 bytes
and Data B with 960 bytes.
3. Data A and Data B are sent consecutively.
4. The receiving user program sends a request to receive 1,984 bytes of data.
However, only data A is sent in the first packet, and data B is not received.
5. Another receive request to receive data must be made before the remain-
ing data, Data B, is received.
Sending User Program Ethernet Unit Receiving Node Receiving Computer
1. Send request 4. First receive request
1,984 bytes 1,984bytes
1,024 bytes
Source data Data A Data A Data A
Only first
Data B 1,024 bytes
960 bytes 5. Second receive request
1,984 bytes
2. Data separated
3. Data A and Data B Data B
Data B sent
consecutively. Remaining
960 bytes
When using TCP protocol, the fragmented data is passed to the user
program. Therefore, the receiving user program must be able to evaluate the
end of the data transmission, and repeatedly send receive requests until all
data has been received. The receive request is sent twice in the example
shown above, but the data would be even more fragmented if a router was
included in the communications path, and the number of receive requests
would need to be increased accordingly.
When making the receive request, it is not necessary to specify the same data
length as the sent data length. For example, if the length setting is shorter
than the actual length of the data, all the data can be received by repeating
the receive requests.
Note If communications are with a different segment and data is sent via the TCP
protocol, data will be fragmented into units of 536 bytes.
1,2,3... 1. The transmission user program sends a request to send 1,984 bytes of da-
ta.
2. The Ethernet Unit fragments the send data into Data A with 1,472 bytes
and Data B with 512 bytes.
102
Overview Section 6-3
1. Send request
1,984bytes 1,472 bytes
Source data Data A
4. First receive request
1,984 bytes
Data B Data A Data B
512 bytes
2. 3.
6-3 Overview
6-3-1 Socket Service Functions
The Ethernet Unit’s socket services are used to exchange data between the
PLC and general-purpose applications that do not support FINS message
communications.The socket services can be used by CS/CJ-series PLCs
through the user program by manipulating dedicated control bits (called
Socket Service Request Switches) or by executing the CMND(490)
instruction.
Intranet
General-purpose application
(not FINS communications);
Ethernet
Ethernet Unit
User-set data The program in the CPU Unit sends requests to the
Ethernet Unit to open/close sockets or send/receive
data. This is achieved by manipulating dedicated
control bits or executing CMND(490), and allows the
CPU Unit to exchange data with the host computer
by using UDP or TCP protocols directly.
103
Overview Section 6-3
Sockets
call
Socket Service
Request Switches
Refreshed UDP data
transfers
Socket Service
(See Note 1.)
Parameters
Refreshed
(See Note 2.)
Note 1. Socket Service Request Switches in the CPU Bus Unit Area in the CIO
Area are used to send a service request from the CPU Unit to the Ethernet
Unit.
2. The Socket Service Parameters in the CPU Bus Unit Area in the DM Area
are used to specify the service being requested from the Ethernet Unit.
The CPU Bus Unit Area in the DM Area is also used to receive results of
processing from the Ethernet Unit to the CPU Unit.
After setting the required parameters in a Socket Service Parameter Area in
the CPU Bus Unit Area in the DM Area, the Socket Service Request Switches
can be used to request opening, sending, receiving, or closing for either the
UDP or TCP protocol. When requesting a send, send data at the send/receive
data addresses set in the parameter area is sent. When requesting a
104
Overview Section 6-3
105
Socket Service Function Guide Section 6-4
■ Point
This method is used by setting the required parameters in the socket service
parameter area allocated in the CPU Bus Unit words in the DM Area, and then
turning ON the Socket Service Request Switches in memory.
■ Advantages/Disadvantages
A total of eight ports (UDP and TCP combined) can be used for socket ser-
vices.
■ Point
A UDP or TCP socket service is requested by sending a FINS command to
the Ethernet Unit by executing CMND(490) from the CPU Unit.
■ Advantages/Disadvantages
• Knowledge of FINS commands is required.
• The previous user program can be used without changing because the
functions are equivalent to those of CVM1/CV-series Ethernet Units.
• A total of 16 sockets, comprising eight TCP ports and eight UDP ports,
can be used.
106
Using Socket Service Functions Section 6-5
107
Using Socket Service Functions Section 6-5
■ Setup
Item Details Default value
Broadcast Set the method for specifying IP address All 1 (4.3BSD)
when broadcasting with FINS/UDP.
• All 1 (4.3BSD): Broadcast with host
number set to all ones.
• All 0 (4.2BSD): Broadcast with host
number set to all zeros.
For normal operations use the default:
All 1 (4.3BSD)
IP Address Set local IP address for Ethernet Unit. 0.0.0.0 (Uses
192.168.250.FINS
node address)
Sub-net Mask Set the subnet mask of the Ethernet Unit. 0.0.0.0
This setting is required when the IP (Uses default net-
Address Table method is not used for IP mask of IP
address conversion. address setting.)
Enable CIDR Set the specification for the subnet mask. Not selected.
• Not selected: Set for the range of class
A, class B, and class C.
• Selected: Classless setting range
(192.0.0.0 to 255.255.255.252)
IP Router Table Set when the Ethernet Unit will communi- None
cate with nodes in other IP network seg-
ments via an IP router.
108
Using Socket Service Functions Section 6-5
109
Socket Service Status Section 6-6
110
Socket Service Status Section 6-6
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
- - - - - - - - -
111
Socket Service Status Section 6-6
Up to 4,096 bytes of data are stored in the reception buffer, but the value
stored is within the range (maximum: 1,984 bytes) that can be set by manipu-
lating the control bits or sending the receive request in the CMND(490)
instruction.
0000 hexadecimal: 0 bytes
07C0 hexadecimal: 1,984 bytes
112
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
2. Turn ON the Socket Service Request Switches in the CPU Bus Unit Area
in the CIO Area.
CPU Bus Unit Area in the CIO Area
I/O memory
Send
or
Receive
Precautions
A Socket Service Parameter Area cannot be used for other sockets once
open processing has been successfully completed for it. Check the socket
113
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Check TCP Connection/UDP Open Flag. OFF? The specified UDP socket is
NO already open.
Is Bit 15 (Open Flag) in the socket status word for YES
the socket being used OFF?
(Checks to see if the socket is open before com-
munications and close processing.)
114
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
m+18
m+88
115
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Parameter Settings
The following table shows the parameters that are required for each service
and the use of the parameters by the socket service.
UDP Socket Services
Parameter No. of Range Socket service
words (decimal values in UDP UDP UDP UDP
parentheses) open receive send close
Socket option 1 Specified bit --- --- --- ---
UDP/TCP socket No. 0001 to 0008 hexadecimal W W W W
(1 to 8)
Local UDP/TCP port No. 1 0000 to FFFF hexadecimal W --- --- ---
(0 to 65,535)
Remote IP address 2 00000000 to FFFFFFFF --- R W ---
hexadecimal
(0.0.0.0 to 255.255.255.255)
Remote UDP/TCP port No. 1 0000 to FFFF hexadecimal --- R W ---
(0 to 65,535)
Number of bytes to send/receive 1 0000 to 07C0 hexadecimal --- RW RW ---
(0 to 1,984 bytes)
Send/Receive data address 2 Memory area address --- W W ---
Time out time 1 0000 to FFFF hexadecimal --- W --- ---
(Unit: 100 ms) (0 to 65,535)
(0: No limit, 0.1 to 6,553.5 s)
Response code 1 --- R R R R
116
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
6-7-4 Parameters
■ Socket Option
For the TCP OPEN REQUEST (ACTIVE or PASSIVE) command, specifies
whether or not the keep-alive function is to be used. When the keep-alive
function is used, bit 8 is ON (set to 1).
Turn ON bit 9 (set to 1) to use the linger function.
■ UDP/TCP Socket No.
Specify the number of the UDP or TCP socket to open.
■ Local UDP/TCP Port No.
Specify the number of the UDP or TCP port for the socket to use for
communications.
• Do not specify the port being used as the FINS UDP port (default: 9600)
in an open request for a UDP socket.
• Do not specify FTP server TCP port numbers 20 and 21 in an open
request for a TCP port.
• Do not specify mail communications TCP port number 25.
• As a rule, use port numbers 1,024 and higher.
If port number 0 is specified when for an active TCP open, the TCP port
number will be automatically allocated and the number of the port that was
opened will be stored in the local UDP/TCP port number in the Socket Service
Parameter Area (i.e., the actual port number will be overwritten on the value of
0 set by the user).
■ Remote IP Address
Specify the IP address of the remote device.
• Offset +2 in the Socket Service Parameter Area contains the upper bytes
of the Remote IP Address, and offset +3 contains the lower bytes.
Example: The contents of offsets +2 and +3 would be as shown below
when the Remote IP Address is 196.36.32.55 (C4.24.20.37 hexadeci-
mal).
+2: C424
+3: 2037
• This parameter is not used when making a receive request for a UDP
socket. The remote IP address will be stored with the response data and
will be written as the Remote IP Address in the Socket Service Parameter
Area.
• When opening a passive TCP socket, the combination of the remote IP
address and the remote TCP port number can be used to affect process-
ing as shown in the following table.
Remote IP Remote TCP Processing
Address Port No.
0 0 All connection requests accepted.
0 Not 0 Connection requests accepted only for the same
port number.
Not 0 0 Connection requests accepted only for the same IP
address.
Not 0 Not 0 Connection requests accepted only for the same
port number and IP address.
117
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
118
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
119
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
As shown in the above table, the Request Switches are turned OFF by the
Ethernet Unit when the requested processes has been completed.
Note There is also a Socket Force-close Switch in bit 2 of the first word allocated to
the Ethernet Unit in the CPU Bus Unit Area in the CIO Area. When the Socket
Force-close Switch is turned ON, all sockets that are open will be force-
closed. Refer to Section 4 Ethernet Unit Memory Allocations in the Operation
Manual, Construction of Networks for details.
When using socket services with the Socket Service Request Switches, the
ladder diagram should be programmed to check the response codes when
Socket Service Request Switches are turned OFF.
120
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Response Meaning
code
1103 The bit number in the Send/Receive Data Address is not 00.
110C Request Switch turned ON during other processing.
220F Specified socket is already processing a receive request.
2210 The specified socket is not open.
2211 Unit is busy; cannot execute service.
2607 Specified Socket Service Parameter Area is already being used for
another socket.
003E Internal buffer cannot be obtained due to high reception traffic
(ENOBUFS).
0066 Internal memory cannot be obtained; cannot execute service.
0080 Receive request timed out.
0081 The specified socket was closed during reception processing.
121
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Note These response codes will be returned only on large, multilevel networks.
122
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Response Meaning
code
000D Remote IP address parameter error (EACCES).
003E Internal buffer cannot be obtained due to high reception traffic
(ENOBUFS).
0042 Error (EMSGSIZE).
(See note.)
0044 ICMP data received (ENOPROTOOPT).
0045 Error in communications with remote node (ECONNABORTED).
0049 The same port number has been specified more than once (EAD-
DRINUSE).
004A Error (ECONNREFUSED) or the remote node has not been opened
as passive socket.
004B Error in communications with remote node (ECONNRESET).
(See note.)
004C Remote IP address parameter error (EADDRNOTAVAIL).
Wrong parameter designation.
An attempt was made to set the local TCP port of the local node to
Active Open.
004E Remote IP address parameter error (ENETUNREACH).
The network ID is not in the IP router table or router settings are
incorrect.
0051 Remote IP address parameter error (EHOSTUNREACH).
The router settings are incorrect.
0053 Communications error with remote node (ETIMEDOUT).
No remote node.
0081 The specified socket was closed during open processing.
Note These response codes will be returned only on large, multilevel networks.
123
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Response Meaning
code
004F ICMP data received (EHOSTDOWN).
(See note.)
0051 ICMP data received (EHOSTUNREACH).
(See note.)
0053 Error in communications with remote host (ETIMEDOUT).
0066 Internal memory cannot be obtained; cannot execute.
0080 Receive request timed out.
0081 The specified socket was closed during receive processing.
Note These response codes will be returned only on large, multilevel networks.
Note These response codes will be returned only on large, multilevel networks.
124
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Request
Switch
Flag
(See note.)
Request Switch Request Not synced with
turned ON. accepted. Request Switch.
Note Starting with unit version 1.5, the Sending Flag and Receiving Flag
will not turn ON if the high-speed socket service option is selected.
Therefore, the program can be controlled only by setting the Send
Request Switch and Receive Request Switch to OFF.
Closing during Other The Close Request Switch or Force-close Switch can be used to close a
Processes socket even when open, receive, or send processing is being executed. Clos-
ing is the only other process that is possible during other processes.
125
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Closing Flag
Open Flag
Request Switch Request
turned ON. accepted. Close request
accepted.
Not synced with
Close Request Request Switches.
Switch turned ON.
Note 1. Starting with unit version 1.5, the Sending Flag and Receiving Flag will not
turn ON if the high-speed socket service option is selected.
2. The Open Flag will not turn ON at all if a close request is made during open
processing.
Force-close Switch
The requested processes are canceled and an response code is stored when
the Force-close Switch is used.
126
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Force-close Switch
Closing Flag
Open Flag
Note 1. Starting with unit version 1.5, the Sending Flag and Receiving Flag will not
turn ON if the high-speed socket service option is selected.
2. The Open Flag will not turn ON at all if a force-close request is made during
open processing.
System Configuration The programming example uses the following system configuration. For the
TCP connection, the Ethernet Unit uses a passive open and the host com-
puter uses an active open.
Host computer Ethernet Unit
PLC
Data Flow The data will flow between the CPU Unit, Ethernet Unit, and host computer as
shown in the following diagram.
Line Ethernet CPU Unit
Host computer (Ethernet) Unit
Request Switches and ex-
Sent to line. ecution bits turned ON
(see note).
127
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Note Here, “execution bits” refer to CIO 0000.00 to CIO 0000.03, which are used in
the ladder diagram to control execution of communications.
Basic Operations
• CIO 0000.00 is turned ON to request opening a TCP socket from the
Ethernet Unit.
• CIO 0000.01 is turned ON to request closing the TCP socket from the
Ethernet Unit.
• CIO 0000.02 is turned ON to request sending data from the Ethernet Unit.
Data (100 bytes) is sent beginning at D00000.
• CIO 0000.03 is turned ON to request receiving data from the Ethernet
Unit. The data that is received (100 bytes) is stored beginning at D01000.
• One of the bits between CIO 0001.00 and CIO 0001.03 will turn ON if an
error occurs. Refer to 6-7-5 Socket Service Request Switches for informa-
tion on errors.
Program Memory Map The send and receive data and bits (flags) used by the program are shown in
the following diagram.
DM Area
15 00
DM00000
DM00049
15 00
DM01000
DM01049
CIO Area
15 03 02 01 00
TCP
CIO 0000 Receive TCP TCP TCP
Send Bit Close Bit Open Bit
Bit
128
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Programming Example
0000.00
TCP Passive Open
@RSET When the TCP Open Bit (CIO 0000.00) turns ON, the TCP
000100 Open Error Flag (CIO 0001.00) is turned OFF and the TCP
Opening Flag (CIO 0002.00) is turned ON to initialize pro-
@SET
000200
cessing.
0000.00 0002.00
MOV(021)
#0001 When the TCP Opening Flag (CIO 0002.00) turns ON, the
D30018
following parameters are written to the parameter area for
MOV(021) socket number 1.
#1000 D30018: 0001 Hex = UDP/TCP socket No. 1
D30019 D30019: 1000 Hex = Local UDP/TCP port No. 4096
D30020 and D30021:
MOV(021) C424 2037 Hex =
#C424
D30020
Remote IP address 196.36.32.55
D30022: 0000 Hex = Any remote UDP/TCP port No.
MOV(021) D30026: 0000 Hex = No timeout time
#2037
D30021
MOV(021)
#0000
D30022
MOV(021)
#0000
0000.00 0002.00 D30026
After the parameters have been set, the TCP Passive
SET
151901 Open Request Switch (CIO 1519.01) is turned ON and
the TCP Opening Flag (CIO 0002.00) is turned OFF.
RSET
000200
If the TCP Passive Open Request Switch (CIO 1519.01)
turns OFF while the TCP Opening Flag (CIO 0002.00) is
0000.00 0002.00 1519.01 OFF, the contents of the response code (D30027) in the
<>(305) SET Socket Service Parameter Area is checked, and if it is not
D30027 000100 0000 Hex (normal end), the TCP Open Error Flag (CIO
#0000 0001.00) is turned ON.
0000.00 0002.00 1519.01 After the execution results have been checked, the TCP
RSET Open Bit (CIO 0000.00) is turned OFF.
000000
0000.01
TCP Close
@RSET When the TCP Close Bit (CIO 0000.01) turns ON, the TCP
000101 Close Error Flag (CIO 0001.01) is turned OFF and the TCP
@SET Closing Flag (CIO 0002.01) is turned ON to initialize proces-
0000.01 0002.01
000201 sing.
MOV(021)
#0001
0000.01 0002.01 D30018 When the TCP Closing Flag (CIO 0002.01) turns ON, the
SET following parameter is written to the parameter area for
151905 socket number 1.
D30018: 0001 Hex = UDP/TCP socket No. 1
RSET
000201
After the parameter has been set, the Close Request
0000.01 0002.01 1519.05
Switch (CIO 1519.05) is turned ON and the TCP Closing
<>(305) SET Flag (CIO 0002.01) is turned OFF.
D30027 000101
#0000 If the Close Request Switch (CIO 1519.05) turns OFF while
the TCP Opening Flag (CIO 0002.01) is OFF, the contents
0000.01 0002.01 1519.05
of the response code (D30027) in the Socket Service
RSET Parameter Area is checked, and if it is not 0000 Hex (normal
000001 end), the TCP Close Error Flag (CIO 0001.01) is turned ON.
After the execution results have been checked, the TCP
Continued on next page. Close Bit (CIO 0000.01) is turned OFF.
129
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
MOV(021)
#0000
0000.02 0002.02 D30025
SET
After the parameters have been set, the Send Request
151903 Switch (CIO 1519.03) is turned ON and the TCP Sending
Flag (CIO 0002.02) is turned OFF.
RSET
000202
=(300) @SET
D30001 000203
&100
0000.03 0002.03 TCP Receive
MOV(021) When the TCP Receive Bit (CIO 0000.03) turns ON, the
#0001 TCP Receive Error Flag (CIO 0001.03) is turned OFF and
D30018
the TCP Data Received/Requested Flag (CIO 1509.13),
MOV(021) and the Number of Bytes Received at TCP Socket (D30001)
#0064 are checked. If the data is stored in the buffer, the TCP
D30023
Receiving Flag (CIO 0002.03) turns ON.
MOV(021) When the TCP Receiving Flag (CIO 0002.03) turns ON,
#8203 the following parameters are written to the parameter
D30024 area for socket number 1.
MOV(021)
D30018: 0001 Hex = UDP/TCP socket No. 1
#E800
D30023: 0064 Hex = No. of send/receive bytes is 100
D30025 D30024 and D30025:
8203 E800 Hex =
MOV(021) Send/receive data address D01000
#0000 D30026: 0000 Hex = No timeout time.
0000.03 0002.03 D30026
SET
151904
RSET
000203
0000.03 0002.03 1519.04 If the Receive Request Switch (CIO 1519.04) turns OFF
while the TCP Receiving Flag (CIO 0002.03) is OFF, the
RSET
contents of the response code (D30027) in the Socket
000003
Service Parameter Area is checked, and if it is not 0000
Hex (normal end), the TCP Receive Error Flag (CIO
END(001) 0001.03) is turned ON.
Note When using the above programming example, change the bit and word
addresses as necessary to avoid using the same areas used by other parts of
the user program or the CPU Bus Unit.
130
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
System Configuration The programming example uses the following system configuration.
Host computer
Ethernet Unit
PLC
Basic Operations
• CIO 0000.00 is turned ON to request opening a UDP socket from the
Ethernet Unit.
• CIO 0000.01 is turned ON to request closing the UDP socket from the
Ethernet Unit.
• CIO 0000.02 is turned ON to request sending data from the Ethernet Unit.
The data is sent (100 bytes) beginning from word D000.00.
• CIO 0000.03 is turned ON to request receiving data from the Ethernet
Unit. The data that is received (100 bytes) is stored beginning at D010.00.
• One of the bits between CIO 0001.00 and CIO 0001.03 will turn ON if an
error occurs. Refer to 6-7-5 Socket Service Request Switches for informa-
tion on errors.
Program Memory Map The send and receive data and bits (flags) used by the program are shown in
the following diagram.
DM Area
15 00
DM00000
DM00049
15 00
DM01000
DM01049
131
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
CIO Area
15 03 02 01 00
UDP
CIO 0000 Receive UDP UDP UDP
Send Bit Close Bit Open Bit
Bit
132
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
Programming Example
0000.00
UDP Open
@RSET When the UDP Open Bit (CIO 0000.00) turns ON, the UDP
000100 Open Error Flag (CIO 0001.00) is turned OFF and the UDP
Opening Flag (CIO 0002.00) is turned ON to initialize pro-
@SET
000200
cessing.
0000.00 0002.00
MOV(021)
#0001
When the UDP Opening Flag (CIO 0002.00) turns ON, the
D30018
following parameters are written to the parameter area for
MOV(021) socket number 1.
#1000 D30018: 0001 Hex = UDP/TCP socket No. 1
0000.00 0002.00 D30019 D30019: 1000 Hex = Local UDP/TCP port No. 4096
SET
151900
RSET
000200 After the parameters have been set, the UDP Open Re-
0002.00 1519.00
quest Switch (CIO 1519.00) is turned ON and the UDP
0000.00
Opening Flag (CIO 0002.00) is turned OFF.
<>(305) SET
D30027 000100 If the UDP Open Request Switch (CIO 1519.00) turns
#0000 OFF while the UDP Opening Flag (CIO 0002.00) is OFF,
0000.00 0002.00 1519.00 the contents of the response code (D30027) in the Socket
Service Parameter Area is checked, and if it is not 0000
RSET Hex (normal end), the UDP Open Error Flag (CIO
000000 0001.00) is turned ON.
0000.01
@RSET After the execution results have been checked, the UDP
000101 Open Bit (CIO 0000.00) is turned OFF.
@SET
000201
0000.01 0002.01 UDP Close
MOV(021) When the UDP Close Bit (CIO 0000.01) turns ON, the UDP
#0001 Close Error Flag (CIO 0001.01) is turned OFF and the
0000.01 0002.01 D30018 UDP Closing Flag (CIO 0002.01) is turned ON to initialize
processing.
SET
151905 When the UDP Closing Flag (CIO 0002.01) turns ON, the
following parameter is written to the parameter area for
RSET
000201
socket number 1.
D30018: 0001 Hex = UDP/TCP socket No. 1
0000.01 0002.01 1519.05
<>(305) SET After the parameter has been set, the Close Request
D30027 000101 Switch (CIO 1519.05) is turned ON and the UDP Closing
#0000 Flag (CIO 0002.01) is turned OFF.
0000.01 0002.01 1519.05 If the Close Request Switch (CIO 1519.05) turns OFF
RSET while the UDP Opening Flag (CIO 0002.01) is OFF, the
000001 contents of the response code (D30027) in the Socket
0000.02 Service Parameter Area is checked, and if it is not 0000
@RSET Hex (normal end), the UDP Close Error Flag (CIO
000102 0001.01) is turned ON.
@SET After the execution results have been checked, the UDP
000202 Close Bit (CIO 0000.01) is turned OFF.
0000.02 0002.02
MOV(021)
#0001
D30018
MOV(021)
#C424
D30020
UDP Send
MOV(021)
When the UDP Send Bit (CIO 0000.02) turns ON, the UDP
#2037
D30021
Send Error Flag (CIO 0001.02) is turned OFF and the UDP
Sending Flag (CIO 0002.02) is turned ON to initialize pro-
MOV(021) cessing.
#1000 When the UDP Sending Flag (CIO 0002.02) turns ON, the
D30022
following parameters are written to the parameter area for
MOV(021) socket number 1.
#0064 D30018: 0001 Hex = UDP/TCP socket No. 1
D30023 D30020 and D30021:
C424 2037 Hex =
MOV(021) Remote IP address 196.36.32.55
#8200 D30022: 1000 Hex = Remote UDP/TCP port No. 4096
D30024 D30023: 0064 Hex = No. of send/receive bytes is 100
MOV(021)
D30024 and D30025:
#0000
8200 0000 Hex =
D30025 Send/receive data address D00000
133
Using Socket Services by Manipulating Dedicated Control Bits Section 6-7
<>(305) SET
D30027 000102
#0000
0000.02 0002.02 1519.03 If the Send Request Switch (CIO 1519.03) turns OFF while
the UDP Sending Flag (CIO 0002.00) is OFF, the contents
RSET of the response code (D30027) in the Socket Service Pa-
000002 rameter Area is checked, and if it is not 0000 Hex (normal
0000.03 end), the UDP Send Error Flag (CIO 0001.02) is turned ON.
@RSET After the execution results have been checked, the UDP
000103 Send Bit (CIO 0000.02) is turned OFF.
@SET UDP Receive
000203
0000.03 0002.03 When the UDP Receive Bit (CIO 0000.03) turns ON, the
MOV(021) UDP Receive Error Flag (CIO 0001.03) is turned OFF and
#0001 the UDP Receiving Flag (CIO 0002.03) is turned ON to
D30018 initialize processing.
MOV(021) When the UDP Receiving Flag (CIO 0002.03) turns ON,
#0064 the following parameters are written to the parameter area
D30023 for socket number 1.
D30018: 0001 Hex = UDP/TCP socket No. 1
MOV(021) D30023: 0064 Hex = No. of send/receive bytes is 100
#8203 D30024 and D30025:
D30024
8203 E800 Hex =
MOV(021) Send/receive data address D01000
#E800 D30026: 0000 Hex = No timeout time.
D30025
MOV(021)
#0000
0000.03 0002.03 D30026
SET
151904
RSET
000203
After the parameter has been set, the Receive Request
0000.03 0002.03 1519.04 Switch (CIO 1519.04) is turned ON and the UDP Receiv-
<>(305) SET ing Flag (CIO 0002.03) is turned OFF.
D30027 000103
#0000
If the Receive Request Switch (CIO 1519.04) turns OFF
0000.03 0002.03 1519.04 while the UDP Receiving Flag (CIO 0002.03) is OFF, the
RSET contents of the response code (D30027) in the Socket
000003 Service Parameter Area is checked, and if it is not 0000
Hex (normal end), the UDP Receive Error Flag (CIO
END(001) 0001.03) is turned ON.
After the execution results have been checked, the UDP
Receive Bit (CIO 0000.03) is turned OFF.
Note When using the above programming example, change the bit and word
addresses as necessary to avoid using the same areas used by other parts of
the user program or the CPU Bus Unit.
134
Using Socket Services with CMND(490) Section 6-8
1,2,3... 1. Execute a socket service request command (MRC: 27) for the Ethernet
Unit using CMND(490).
CPU Ethernet Unit
User program
Socket service
CMND
Request
command
END
Response
CMND
END
3. The Ethernet Unit starts the process requested by the parameters in the
socket service request command.
135
Using Socket Services with CMND(490) Section 6-8
Other node
Communications
4. When the process has been completed, the result is stored in the results
storage area defined in the socket service request command and the sock-
et status will indicate completion of processing.
CPU Ethernet Unit
Socket status area
Process complete
notification
136
Using Socket Services with CMND(490) Section 6-8
Check the Port Enabled Flag. ON? The specified port is running
NO network communications.
YES
Is the Port Enabled Flag in A502 for communica-
tions port ON?
Check results storage area response code. 0000? An error occurred. The specified
NO socket could not be opened.
UDP opened
Command Code:
Specifies the process code requested from the socket.
Socket Option
For the TCP OPEN REQUEST (ACTIVE or PASSIVE) command, specifies
whether or not the keep-alive function is to be used.
Socket Number
Specifies the socket number for the process, between 1 and 8.
Results Storage Area
Specifies the area to store the results of the requested process.
Parameters
Specifies the parameters defined for the command code.
137
Using Socket Services with CMND(490) Section 6-8
Note If there is more than one Communications Unit mounted to the PLC, the FINS
network address must be set as a parameter for CMND(490) and a local net-
work table must be created in the routing tables from the CX-Programmer.
1
Running Running
Port Enabled Flag
0
1
Open Flag
0
1
Opening Flag
0
138
Using Socket Services with CMND(490) Section 6-8
■ CLOSE REQUEST
1
Running Running
Port Enabled Flag 0
1
Close Flag 0
1
Closing Flag 0
■ SEND REQUEST
1
Running Running
Port Enabled Flag 0
1
Send Flag 0
1
Opening Flag 0
■ RECEIVE REQUEST
1
Port Enabled Flag Running Running
0
1
Receive Flag 0
1
Opening Flag
0
1
Data Received/Requested Flag
0
Number of Bytes Received at TCP Socket 0001 to 07CD Hex 0000 Hex
139
Using Socket Services with CMND(490) Section 6-8
1
Port Enabled Flag Running Running
0
CMND(490) (RECEIVE REQUEST)
response command Normal response code
1
Receive Flag 0
1
Close Flag 0
1
Opening Flag 0
Results storage area for
Store error response code
RECEIVE REQUEST
Note The timing shown in the above diagram occurs if a CLOSE REQUEST com-
mand is executed during SEND REQUEST command execution. The timing
shown in the diagram also applies if a CLOSE REQUEST command is exe-
cuted during OPEN REQUEST command execution, with the exception of the
status of the Opening Flag.
System Configuration
The system configuration for the program example and the Ethernet Unit
system setup are shown below. To establish a TCP connection, the Ethernet
Unit is passively opened and the host computer actively opened.
Host computer
Ethernet Unit
PLC
140
Using Socket Services with CMND(490) Section 6-8
Data Flow
The data will flow between the CPU Unit, Ethernet Unit, and host computer as
shown in the following diagram.
Host Line Ethernet Unit CPU Unit
computer (Ethernet)
(1) Request Switches
(4) Sent to line. (2) Execution bits turned ON (see Note)
Note Here, “execution bits” refer to CIO 0000.00 to CIO 0000.03, which are used in
the ladder diagram to control execution of communications and are not sys-
tem flags, such as the Port Enabled Flags (A202.00 to A202.07).
Basic Operations
• CIO 0000.00 is turned ON to request opening a passive TCP socket from
the Ethernet Unit.
• CIO 0000.01 is turned ON to request closing the TCP socket from the
Ethernet Unit.
• CIO 0000.02 is turned ON to request sending data from the Ethernet Unit.
Data (100 bytes) is sent beginning at D02005.
• CIO 0000.03 is turned ON to request receiving data from the Ethernet
Unit. The data that is received (100 bytes) is stored beginning at D04022.
• One of the bits between CIO 0001.00 and CIO 0001.03 will turn ON if an
error occurs. Refer to 6-7-5 Socket Service Request Switches for informa-
tion on errors. The following areas can be used to access details about
errors:
CMND(490) response codes
Response codes in results storage area
Network Communications Error Flags (A219.00 to A219.07)
Completion codes (A203 to A210)
141
Using Socket Services with CMND(490) Section 6-8
0 1 2
15 to 8 7 6 5 4 3 2 1 0
DM Area
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
142
Using Socket Services with CMND(490) Section 6-8
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
143
Using Socket Services with CMND(490) Section 6-8
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
Command code
0 1 2 3 4 5 6 7 8 9
144
Using Socket Services with CMND(490) Section 6-8
CIO Area
15 to 8 7 6 5 4 3 2 1 0
145
Using Socket Services with CMND(490) Section 6-8
Programming Example
0000.00 TCP Passive Open
@RSET When the TCP Open Bit (CIO 0000.00) turns ON, the TCP
000100 Open Error Flag (CIO 0001.00) is turned OFF and the TCP
Opening Flag (CIO 0002.00) is turned ON to initialize pro-
@SET cessing.
000200
0000.00 0002.00 A0202.00
When the TCP Opening Flag (CIO 0002.00) turns ON, the
CMND(490) status of the Port Enabled Flag (A202.00) is checked to be
D01000 sure it is ON and a PASSIVE TCP OPEN REQUEST com-
D01010 mand is sent using CMND(490).
D00000 D01000: First command word
RSET
D01010: First response word
000200 D00000: First control data word
0000.00 0002.00 A0202.00 1509.00 1509.14 The TCP Opening Flag (CIO 0002.00) is also turned OFF.
SET If the Port Enabled Flag (A202.00) turns ON and the Open-
000100 ing Flag (CIO 1509.00) turns OFF while the TCP Opening
<>(305) Flag (CIO 0002.00) is OFF, checks are made and if any of
D01020 the following are true, the TCP Open Error Flag (CIO
#0000
0001.00) is turned ON.
A0219.00 The Results Storage Error Flag (CIO 1509.14) is ON.
The contents of the Response Storage Area set in the
0000.00 0002.00 A0202.00 1509.00 command code (D01020) is not 0000 Hex (normal end).
RSET The Network Communications Error Flag (A219.00) is ON.
000000
0000.01
After the execution results have been checked, the TCP
@RSET Open Bit (CIO 0000.00) is turned OFF.
000101
@SET
000201
Continued on next page. The contents of the Response Storage Area set in the
command code (D01050) is not 0000 Hex (normal end).
The Network Communications Error Flag (A219.00) is ON.
After the execution results have been checked, the TCP
Close Bit (CIO 0000.01) is turned OFF.
146
Using Socket Services with CMND(490) Section 6-8
= (300)
After the execution results have been checked, the TCP
@SET
D30001 000203
Send Bit (CIO 0000.02) is turned OFF.
&100
0000.03 0002.03 A0202.00 TCP Receive
CMND(490) When the TCP Receive Bit (CIO 0000.03) turns ON, the
D04000 TCP Receive Error Flag (CIO 0001.03) is turned OFF.
D04010
The contents of the reception buffer, and the status of the
D00030
TCP Data Received/Requested Flag (CIO 1509.13), and
RSET the Number of Bytes Received at TCP Socket (D30001)
000203 are checked. If the data is stored in the buffer, the TCP
0000.03 0002.03 A0202.00 1509.01 1509.14 Receiving Flag (CIO 0002.03) turns ON.
↓ SET
000103 When the TCP Receiving Flag (CIO 0002.03) turns ON,
<>(305) the status of the Port Enabled Flag (A202.00) is checked
D04020 to be sure it is ON and a TCP RECEIVE REQUEST
#0000 command is sent using CMND(490).
D04000: First command word
A0219.00 D04010: First response word
D00030: First control data word
0000.03 0002.03 A0202.00 1509.01 The TCP Receiving Flag (CIO 0002.03) is also turned
↓ RSET
OFF.
000003 If the Port Enabled Flag (A202.00) turns ON and the Re-
ceiving Flag (CIO 1509.01) turns OFF while the TCP Re-
END(001) ceiving Flag (CIO 0002.03) is OFF, checks are made and if
any of the following are true, the TCP Receive Error Flag
(CIO 0001.03) is turned ON.
The Results Storage Error Flag (CIO 1509.14) is ON.
The contents of the Response Storage Area set in the
command code (D04020) is not 0000 Hex (normal end).
The Network Communications Error Flag (A219.00) is ON.
After the execution results have been checked, the TCP
Receive Bit (CIO 0000.03) is turned OFF.
Note When using the above programming example, change the bit and word
addresses as necessary to avoid using the same areas used by other parts of
the user program or the CPU Bus Unit.
147
Using Socket Services with CMND(490) Section 6-8
System Configuration
The system configuration for the program example and the Ethernet Unit
system setup are shown below.
Host computer
Ethernet Unit
PLC
Basic Operations
• CIO 0000.00 is turned ON to request opening a UDP socket from the
Ethernet Unit.
• CIO 0000.01 is turned ON to request closing the UDP socket from the
Ethernet Unit.
• CIO 0000.02 is turned ON to request sending data from the Ethernet Unit.
Data (100 bytes) is sent beginning at D02008.
• CIO 0000.03 is turned ON to request receiving data from the Ethernet
Unit. The data that is received (100 bytes) is stored beginning at D04025.
• One of the bits between CIO 0001.00 and CIO 0001.03 will turn ON if an
error occurs. Refer to 6-7-5 Socket Service Request Switches for informa-
tion on errors. The following areas can be used to access details about
errors:
CMND(490) response codes
Response codes in results storage area
Network Communications Error Flags (A219.00 to A219.07)
Completion codes (A203 to A210)
148
Using Socket Services with CMND(490) Section 6-8
DM Area
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
149
Using Socket Services with CMND(490) Section 6-8
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
150
Using Socket Services with CMND(490) Section 6-8
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
CIO Area
15 to 8 7 6 5 4 3 2 1 0
151
Using Socket Services with CMND(490) Section 6-8
Programming Example
0000.00
@RSET UDP Passive Open
000100 When the UDP Open Bit (CIO 0000.00) turns ON, the
UDP Open Error Flag (CIO 0001.00) is turned OFF and
the UDP Opening Flag (CIO 0002.00) is turned ON to
initialize processing.
@SET
000200
152
Using Socket Services with CMND(490) Section 6-8
RSET
000202
0000.03
@RSET
000103
@SET
UDP Receive
When the UDP Receive Bit (CIO 0000.03) turns ON, the
000203 UDP Receive Error Flag (CIO 0001.03) is turned OFF
and the UDP Receiving Flag (CIO 0002.03) is turned ON
0000.03 0002.03 A202.00 to initialize processing.
CMND(490)
When the UDP Receiving Flag (CIO 0002.03) turns ON, the
D04000
status of the Port Enabled Flag (A202.00) is checked to be
D04010 sure it is ON and a UDP RECEIVE REQUEST command is
D00030
sent using CMND(490).
D04000: First command word
D04010: First response word
D00030: First control data word
RSET
000203
The UDP Receiving Flag (CIO 0002.03) is also turned OFF.
0000.03 0002.03 A202.00 1501.01 1501.14
SET
If the Port Enabled Flag (A202.00) turns ON and the Re-
ceiving Flag (CIO 1501.01) turns OFF while the UDP Re-
000103 ceiving Flag (CIO 0002.03) is OFF, checks are made and if
any of the following are true, the UDP Receive Error Flag
(CIO 0001.03) is turned ON.
<>(305)
D04020 The Results Storage Error Flag (CIO 1501.14) is ON.
#0000 The contents of the Response Storage Area set in the com-
mand code (D04020) is not 0000 Hex (normal end).
A219.00
The Network Communications Error Flag (A219.00) is ON.
0000.03 0002.03 A202.00 1501.01 After the execution results have been checked, the UDP
RSET Receive Bit (CIO 0000.03) is turned OFF.
000003
END(001)
Note When using the above programming example, change the bit and word
addresses as necessary to avoid using the same areas used by other parts of
the user program or the CPU Bus Unit.
153
Precautions in Using Socket Services Section 6-9
154
Precautions in Using Socket Services Section 6-9
• Data can remain in a buffer at the local node if the remote TCP socket
closes during communications. Any data remaining in the buffer will be
discarded when the TCP socket is closed. To avoid problems of this
nature, steps will have to be taken in the application program, such as
sending data to enable closing, and then only closing once reception of
this data has been confirmed.
• When closing a connection for a TCP socket, the first port to be closed
cannot be reopened for at least 60 seconds after the other port closes.
However, this restriction does not apply for a port opened using the TCP
ACTIVE OPEN REQUEST command with a local TCP port number of 0
(port number automatically assigned) which is closed from the side that
actively opened the socket.
• A connection is established for a passively opened socket by actively
opening it from another socket. A connection will not be established by a
different socket attempting to actively open the socket that is already
actively opening a socket. Similarly, a connection will not be established if
a different socket attempts to passively open a socket that is already
being passively opened by another socket. You cannot actively open mul-
tiple connections to a socket passively opened at the Ethernet Unit.
• The Ethernet Unit TCP sockets have no KEEP ALIVE function to check
that the connection is normal if communications do not occur for a set
time period through a communications line for which a connection has
been established. The Ethernet Unit’s TCP sockets make no checks to
the socket at the other node. Checks made by the remote node, however,
are received as responses, so that it is not necessary for the user pro-
gram to consider the KEEP ALIVE function.
155
Precautions in Using Socket Services Section 6-9
6-9-5 Times Required for Sending and Receiving for Socket Services
The transmission delays for socket service is calculated as the sum of the
communications processing times for both nodes.
Transmission delay = Remote node send processing time + Local node
receive processing time + Local node send processing time + Remote
node receive processing time
Calculate the maximum Ethernet Unit transmission delays for sending and
receiving using the following formulas. These times are the same for both
UDP and TCP.
The delays found using the following formulas, however, are approximate val-
ues when one socket service is used. If multiple socket services are used, the
delays will increase depending on the operating conditions. Also, the trans-
mission delay on the network relative to the processing time is so small that it
can be ignored, and so it is omitted.
156
Precautions in Using Socket Services Section 6-9
Note 1. The values obtained from the above equations are guidelines for the trans-
mission delay time when one socket in the Ethernet Unit is used only. The
execution time required for the user program is not included.
2. The communications time for the remote nodes depends on the device be-
ing used. For remote nodes that are not Ethernet Units, calculate the com-
munications time according to the device's operation manual.
3. The actual operating environment can cause transmission delays larger
than those calculated with the methods given here. Among the causes of
longer delays are the following: traffic on the network, window sizes at net-
work nodes, traffic through the Ethernet Unit (e.g., simultaneous servicing
of multiple sockets and socket service communications, etc.), and the sys-
tem configuration.
4. The above values are guidelines when the default (4%) for the uniform pe-
ripheral servicing time in the PLC Setup is used.
5. By increasing the value of the uniform peripheral servicing time, the maxi-
mum transmission delay time for socket services can be shorter.
6. If the high-speed socket service option is selected and manipulating spe-
cific bits is used, the setting for the peripheral servicing time will not affect
the time required for communications. This is because the send process-
ing or receive processing, which previously depended on the peripheral
servicing time, are not interrupted.
7. Processing cannot be faster than the send and receive processing perfor-
mance of the Ethernet Unit if the send request is processed periodically
using a ladder program timer or if receive request processing is performed
for continuous data from a remote node. In particular, the data buffer on the
receiving side may be exhausted. In such a case, adjust the send timing
(i.e., send timing from remote node) or receive frequency so that the actual
load is approximately 1.5 times slower than the processing performance.
Example: When using TCP socket services between two PLCs by manipu-
lating specific bits (high-speed socket service enabled) to send/
receive 512 bytes in both directions, the guideline for the maxi-
mum transmission delay time can be calculated according to the
following conditions as shown in the table below.
CPU Unit cycle time (local node) = 1 ms
157
Precautions in Using Socket Services Section 6-9
158
SECTION 7
Using FINS Communications to Create Host Applications
This section provides information on communicating on Ethernet Systems and interconnected networks using FINS
commands. The information provided in the section deals only with FINS communications in reference to Ethernet Units.
FINS commands issued from a PLC are sent via the SEND(090), RECV(098), and CMND(490) instructions programmed
into the user ladder-diagram program. Refer to the CS/CJ-series Programmable Controllers Instructions Reference Manual
(W340) for further details on programming these instructions.
159
Overview of FINS Communications Section 7-1
PLC
or host computer
Ethernet Unit
Ethernet
Ethernet Unit
PLC
FINS
Application Layer Node Address
UDP TCP
Transport Layer UDP Port No. TCP Port No.
IP
Ethernet
Physical Layer Ethernet Address
160
Overview of FINS Communications Section 7-1
161
FINS Frames Section 7-2
FINS Command
Frame Format
FINS Response
Frame Format Size (bytes) Contents
FINS Header
Information
ICF (Information Control
Field) Bit 7 6 5 4 3 2 1 0
1 0 0 0 0 0
162
FINS/UDP Method Section 7-3
163
FINS/UDP Method Section 7-3
Node Node
Data transmission 1
Data transmission 2
Data transmission 3
FINS/UDP Frame The following diagram shows the structure of a UDP packet used for sending
Format and receiving data on an Ethernet network.
EthernetV.2 IP UDP FINS frame FCS
UDP packet
As the diagram shows, a nested structure is used with the FINS/UDP method,
i.e., Ethernet Ver. 2, IP frame, UDP frame, and FINS frame. A UDP data sec-
tion (FINS frame) that exceeds 1,472 bytes is split into packets for transmis-
sion. The split UDP data is then joined automatically at the UDP/IP protocol
layer. There is normally no need to pay attention at the application layer to this
split, but it may not be possible to send 1,472-byte UDP packets over an IP
network with multiple layers. When using the FINS communications service in
a system such as this, select the FINS/TCP method.
UDP Port Numbers for The UDP port number is the number for UDP to identify the application layer
FINS/UDP (i.e., the FINS communications service in this case). When communications
are executed by UDP/IP, this port number must be allocated to the communi-
cations service.
The default setting for the FINS/UDP local UDP port number (i.e., the Ether-
net Unit's UDP port number) is 9600. To set another number, make the setting
for the FINS/UDP port using the Setup Tab in the Unit Setup.
At the Ethernet Unit, a UDP/IP frame received with a FINS/UDP port number
is recognized as a FINS frame.
164
FINS/UDP Method Section 7-3
The UDP port number for the host application (e.g., personal computer) func-
tions differently from the ports that can be used depending on the setting for
the address conversion method at the Ethernet Unit. Basically, the same num-
ber can be used for the UDP port number set in the Ethernet Unit (default:
9600), but the number does not need to be the same as the Ethernet Unit
under the following application conditions.
• Sending commands from the host application when the automatic gener-
ation (dynamic) method is used as the Ethernet Unit’s address conversion
method.
• Sending commands from the host application without registering the IP
addresses in the IP table when the IP address table method is used as
the Ethernet Unit’s address conversion method.
• Sending commands from the host application without registering the IP
addresses in the IP table when the combined method is used as the
Ethernet Unit’s address conversion method.
For each address conversion method, when commands are sent from the
Ethernet Unit, use the same value set in the Ethernet Unit for the UDP port
number of the host application.
3. Make the routing table settings and transfer them to each PLC. (See note.)
Set the routing tables with CX-Net, and transfer them to each PLC.
4. Create a ladder program that includes the SEND(090), RECV(098), and CMND(490) instructions.
165
FINS/UDP Method Section 7-3
Note (1) The FINS UDP port number at the Ethernet Unit is set to the default of
9600. It can be changed in the Unit Setup.
(2) Even if the Ethernet network is comprised of multiple segments, set the
same value for the FINS network address.
Ethernet
■ Example 2: Host Computer and Remote Node Connected Via Relay Node
(Ethernet Unit)
Host computer Remote node
IP address: 196.36.32.50 Relay node IP address: 196.36.32.50
FINS network/node/unit: 1/50/0 (hex) IP address: FINS network/node/unit:
196.36.32.100 2/1/0 (hex)
Ethernet
Unit Controller Link
166
FINS/UDP Method Section 7-3
UDP port number: FINS UDP port number (Ethernet Unit of relay node)
FINS addresses (Remote node CPU Unit):
Network address: 2
Node address: 1
Unit number: 0
FINS addresses (Host computer):
Network address: 1
Node address: 50
Unit number: 0
FINS/UDP Sample
Program
Operation Overview • This program reads 150 words of the PLC memory beginning at D00100
by sending a FINS command (MEMORY AREA READ, command code
0101) from a UNIX workstation (WS) to the PLC on the Ethernet network.
• If no response is received within two seconds of sending the FINS com-
mand, the command will be resent.
Settings • The Ethernet Unit IP address is 196.36.32.100, and the FINS node
address is 100. IP address conversion is set to automatic generation
(dynamic).
• The FINS UDP port number for the Ethernet Unit is 9600 (default).
• The workstation’s IP address is 196.36.32.50 and its FINS node address
is 50.
• The FINS UDP port number for the workstation can be a user-set number
(if set to 0, the system automatically allocates an available port).
167
FINS/UDP Method Section 7-3
Sample Program
1 #include <errno.h>
2 #include <stdio.h>
3 #include <sys/types.h>
4 #include <sys/socket.h>
5 #include <netinet/in.h>
6 #include <signal.h>
7
8 #define FINS_UDP_PORT 9600
9 #define SERV_IP_ADDR "196.36.32.100" /* Ethernet Unit IP ADDRESS*/
10 #define MAX_MSG 2010
11 #define RESP_TIMEOUT 2
12
13
14 /*
15 * FINS/UDP COMMUNICATIONS SAMPLE PROGRAM
16 */
17 main(argc,argv)
18 int argc;
19 char *argv[];
20 {
21 int sockfd;
22 struct sockaddr_in ws_addr, cs_addr;
23 char fins_cmnd[MAX_MSG], fins_resp[MAX_MSG];
24 int sendlen, recvlen, addrlen;
25 char sid = 0;
26 extern recv_fail();
27
28 /* GENERATE UDP SOCKET*/
29 if ((sockfd = socket(AF_INET,SOCK_DGRAM,0)) < 0)
30 err_exit("can't open datagram socket");
31
168
FINS/UDP Method Section 7-3
169
FINS/UDP Method Section 7-3
170
FINS/TCP Method Section 7-4
Node Node
(Client) (Server)
Connection established
Acknowledgement
Data transmission 1
Acknowledgement
Compared to the FINS/UDP method, the FINS/TCP method has the following
characteristics.
• Data transmission is more reliable, due to factors such as retry process-
ing at the TCP/IP layer. The FINS/TCP method is thus better suited to
dealing with communications errors in an IP network that spans several
layers.
• Remote clients can be restricted by means of settings at the server (i.e.,
the server can be protected from access by non-specified IP addresses).
• Broadcasting cannot be used.
• TCP/IP has various retry procedures, and this tends to lower its perfor-
mance in comparison with UDP/IP.
• There is a limit to the number of connections that can be made (i.e., 16
connections maximum), and any given node can communicate only with
up to 16 other nodes at a time.
171
FINS/TCP Method Section 7-4
FINS/TCP Frame The following diagram shows the structure of a TCP packet sent over an
Format Ethernet network.
TCP packet
As the diagram shows, a nested structure is used with the FINS/TCP method,
i.e., Ethernet Ver. 2, IP frame, TCP frame, FINS/TCP header frame, and FINS
frame. A TCP data section (FINS/TCP header + FINS frame) that exceeds the
segment size (Ethernet Unit default: 1,024 bytes, with automatic adjustment
for optimum values between the nodes) is split into TCP packets for transmis-
sion. The split TCP data tends to be joined automatically at the remote node's
TCP/IP protocol layer. The TCP/IP protocol layer, however, cannot determine
where the data has been split, so the TCP data sections from multiple packets
are all joined together. Therefore, when using the FINS/TCP method, FINS/
TCP headers must be added at the beginning of FINS frames in order to
serve as FINS frame delimiters. The length of the data in the following FINS
frame is stored in the header, allowing the frame to be separated out by the
remote node. With the Ethernet Unit and FinsGateway Ver. 2003 the appropri-
ate frames are separated out automatically. When constructing applications
using the TCP/IP socket interface on the host computer, processing is
required to separate out the FINS frames.
TCP Port Number for The TCP port number is the number for TCP to identify the application layer
FINS/TCP (i.e., the FINS communications service in this case). When communications
are executed using TCP/IP, this port number must be allocated for the com-
munications service.
The Ethernet Unit’s default setting for the FINS/TCP local TCP port number
(i.e., the Ethernet Unit's TCP port number) is 9600. To set another number,
make the setting for the FINS/TCP port using the Setup Tab in the Unit Setup.
The FINS/TCP port number set in the Unit Setup is used by the FINS/TCP
server's TCP socket. The FINS/TCP client's TCP socket uses any TCP port
number that can be used at that node. (With the Ethernet Unit and FinsGate-
way Ver. 2003, an unused TCP port is automatically detected and utilized.)
At the Ethernet Unit, a TCP/IP frame that is received is recognized as a FINS
frame, according to the remote TCP port number in the received frame.
The host application is normally used as the FINS/TCP client. A user-set
number can be set for the TCP port number used by the host application.
Note (1) The default for the Ethernet Unit is 1,024 bytes, and the size is automat-
ically adjusted to the best value between nodes.
(2) FINS/TCP header + FINS frame
172
FINS/TCP Method Section 7-4
FINS/TCP Connection While a connection with a remote node is established, the bit corresponding to
Status (Word n+23) the FINS/TCP connection status turns ON in the section of the CPU Bus Unit
words allocated in the CIO Area. The bit turns OFF if the connection is termi-
nated by an error in communications with a remote node or a FINS command
(i.e., FINS/TCP CONNECTION REMOTE NODE CHANGE REQUEST).
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
n+23
FINS/TCP With FINS/TCP, FINS node addresses are exchanged immediately after a
Communications connection is established. This makes it possible to determine the FINS node
Procedure addresses to which the 16 connection numbers are connected, and to man-
age them in an internal table.
Example: Example:
IP address C IP address S
FINS node address A FINS node address B
Passive open
173
FINS/TCP Method Section 7-4
Automatic Allocation When the FINS message service is used, a FINS node addresses must also
of FINS Node be allocated in the host application for communications. The FINS node
Addresses addresses used by the host application are normally allocated in advance
using fixed allocations. When the FINS/TCP procedure is used, however, the
FINS node addresses used by the host application can be allocated automat-
ically at the Ethernet Unit.
■ Automatic Allocation Procedure
When exchanging FINS node addresses, node address 0 (node address not
set) is used for the client. At the server that receives the information, a num-
ber from the automatically allocated node addresses (default: 239 to 254)
controlled by the server that has not established a connection is automatically
allocated, and the FINS node address is sent to the client.
After exchanging the FINS node addresses, the client uses the allocated node
address (default: 239 to 254) to create FINS frames (substituting the value
allocated in SA1 of the FINS header).
Example: Example:
IP address C IP address S
FINS node address 0 FINS node address B
Passive open
Connection request (C→S)
Active open Connection established
174
FINS/TCP Method Section 7-4
To change the automatically allocated FINS node addresses, use the mouse
to select the connection number to be changed, and click the Edit Button. The
FINS/TCP Connection Setting Dialog Box will be displayed.
The FINS node address allocated to the connection is displayed to the right of
the Automatically Allocated FINS Node Address field. Change this number
and click the OK Button. After setting, complete the operation by transferring
the settings to the Ethernet Unit, in the same way as for normal Unit Setup
data.
175
FINS/TCP Method Section 7-4
176
FINS/TCP Method Section 7-4
The details of the above frame are shown in the following table.
Item Contents (hexadecimal) Remarks
Header 46494E53 ASCII code: ‘FINS’
Length 0000000C 12 bytes: Length of data from
command onwards.
Command 00000000
Error code 00000000 Not used, so does not require
checking by server.
Client node address 00000000 to 000000FE 0 to 254
(FINS node address Note: Client FINS node
of FINS/TCP client) addresses are automatically
obtained when set to 0.
FINS NODE ADDRESS When this command is executed, the server node notifies the client of its own
DATA SEND (SERVER TO FINS node address. This command is sent after the server has received the
CLIENT) Command FINS NODE ADDRESS DATA SEND (CLIENT TO SERVER) command. The
FINS NODE ADDRESS DATA SEND (CLIENT TO SERVER) command
received by the server is decoded and if any errors are detected, the error
details are sent by adding to the Error Code in the command, and then the
connection is closed.
177
FINS/TCP Method Section 7-4
When this command is received by the client node, the TCP/IP port must be
closed quickly, unless the contents of the Error Code are 00000000 hexadeci-
mal (normal).
When automatically allocated FINS node addresses are set, the client node
address automatically allocated at the server is stored in the client node
address field.
After a connection has been established as a FINS/TCP client or server, do
not send this command again. Otherwise, the error code (00000003 hexadec-
imal: The command is not supported) will be received in the FINS FRAME
SEND ERROR NOTIFICATION command and the connection will be termi-
nated.
Size
(bytes)
Header 4
Length 4
Command 4
FINS/TCP header Error code 4
Client node address
4
The details of the above frame are shown in the following table.
Item Contents (hexadecimal) Remarks
Header 46494E53 ASCII code: ‘FINS’
Length 00000010 16 bytes: Length of data from
command onwards.
Command 00000001
Error code --- Refer to the following table of
error codes.
Client node address 00000001 to 000000FE 1 to 254
(FINS node address
of FINS/TCP client)
Server node address 00000001 to 000000FE 1 to 254
(Fins node address
of FINS/TCP server)
178
FINS/TCP Method Section 7-4
FINS FRAME SEND When FINS frames are sent using TCP/IP, always add the FINS FRAME
Command SEND command to the beginning of the FINS frame. The FINS frame is sepa-
rated out from the TCP data line following the data length in the FINS FRAME
SEND command.
Size
(bytes)
Header 4
FINS/TCP header Length 4
Command 4
Error code
4
FINS frame FINS frame 12 to 2,012 (Refer to 7-2 FINS Frames for details.)
The details of the above frame are shown in the following table.
Item Contents (hexadecimal) Remarks
Header 46494E53 ASCII code: ‘FINS’
Length 00000014 to 000007E4 20 to 2020 bytes: Length of
data after command.
Command 00000002
Error code 00000000 Not used, so does not require
checking by at the receiving
end.
FINS frame --- From FINS header ICF to end
of data.
FINS FRAME SEND If an error occurs in the FINS/TCP header of the FINS FRAME SEND com-
ERROR NOTIFICATION mand, this command is used so that an error code will be returned to the node
Command that sent the FINS FRAME SEND command by the node that detected the
error. When this command is sent, the source node closes the connection.
The node that receives the command must close the connection quickly.
Size
(bytes)
Header 4
FINS/TCP header
Length 4
Command 4
E rro r code 4
The details of the above frame are shown in the following table.
Item Contents (hexadecimal) Remarks
Header 46494E53 ASCII code: ‘FINS’
Length 00000008 8 bytes: Length of data from
command onwards.
Command 00000003
Error code --- Refer to the following table of
error codes.
179
FINS/TCP Method Section 7-4
CONNECTION This command is sent when the FINS NODE ADDRESS DATA SEND (CLI-
CONFIRMATION ENT TO SERVER) command is received from a client with the same IP
Command address and FINS node address as another client with a connection that is
already established. The client that receives this command will simply destroy
the frames.
After the command is sent, if ACK is returned in the TCP layer by the remote
node, the connection that is established is maintained. If RST is returned in
the TCP layer by the remote node, the established connection is closed.
If the FINS NODE ADDRESS DATA SEND (CLIENT TO SERVER) or FINS
NODE ADDRESS DATA SEND (SERVER TO CLIENT) command is received
after a connection has already been established as a FINS/TCP client and
server, the error code (00000003 hexadecimal: command not supported) will
be sent in the FINS FRAME SEND ERROR NOTIFICATION command, and
the connection will be terminated.
The error code (00000021 hexadecimal: specified node already connected)
will be sent using an FINS NODE ADDRESS DATA SEND (SERVER TO CLI-
ENT) command to the connected node that received FINS NODE ADDRESS
DATA SEND (CLIENT TO SERVER) from the client with the same FINS node
address as the currently open connection, regardless of the result. Do not
send this command from the client. (The error code (00000003 hexadecimal:
command not supported) will be sent in the FINS FRAME SEND ERROR
NOTIFICATION command, and the connection will be terminated.)
Size
(bytes)
Header 4
FINS/TCP header Length 4
Command 4
Reserve 4
The details of the above frame are shown in the following table.
Item Contents (hexadecimal) Remarks
Header 46494E53 ASCII code: ‘FINS’
Length 00000008 8 bytes: Length of data after
command.
Command 00000006
Error code 00000000 Not used, so does not require
checking at the receiving end
(client).
180
FINS/TCP Method Section 7-4
Connection Sequence
Normal Operation
Client Server
accept
connect SYN
SYN, ACK
ACK
send A
B
recv
ACK
Normal
C
D send
recv
ACK
E
F send
recv
ACK
connect Socket interface
E
send F
recv Message from TCP/IP layer
ACK
Message from host layer
1,2,3... 1. After the TCP connection is established, the client node address is sent by
the client to the server using the FINS NODE ADDRESS DATA SEND (CLI-
ENT TO SERVER) command.
2. The client’s FINS node address (client node address) is obtained from the
received command.
3. The server’s node address is sent by the server to the client using the FINS
NODE ADDRESS DATA SEND (SERVER TO CLIENT) command.
4. The server’s FINS node address is obtained from the received command.
5. The FINS message is sent using the FINS FRAME SEND command.
6. The FINS message is separated out from the received command.
Note In steps 5 and 6 both the client and server can send and receive FINS mes-
sages (commands/responses) in both directions.
Error Connection
Sequence Client Server
accept
connect SYN
SYN, ACK
ACK
A
send
recv
ACK B Error
C
D send
recv
ACK
FIN close
close ACK
FIN
connect Socket interface
Connection closed
Message from TCP/IP layer
according to TCP/IP
protocol procedure. Message from host layer
181
FINS/TCP Method Section 7-4
1,2,3... 1. The client sends the FINS NODE ADDRESS DATA SEND (CLIENT TO
SERVER) command to the server.
2. The received command is decoded (e.g., if an error occurs, the code that
is not ‘FINS’ (ASCII code) in the command header is stored.)
3. The server sends the error code for the detected error (in this example,
00000001 hexadecimal: Header is not ‘FINS’ (ASCII code)) in the FINS
NODE ADDRESS DATA SEND (SERVER TO CLIENT) command to the
client, and the TCP/IP port is closed.
4. The error code for the received command is decoded, and the TCP/IP port
is closed.
Connection Sequence for
Automatic Allocation of Client Server
FINS Node Addresses
accept
connect SYN
SYN, ACK
ACK
A
send B
recv
ACK
Normal
C send
D
recv
ACK
E send
F
recv
ACK
connect Socket interface
E
send F
recv Message from TCP/IP layer
ACK
Message from host layer
1,2,3... 1. The client specifies the client node address as 00000000 hexadecimal in
the server as the automatically allocated FINS node address, and sends it
using the FINS NODE ADDRESS DATA SEND (CLIENT TO SERVER)
command.
2. The server checks the client node address in the received command to see
whether an automatically allocated FINS node address is specified, and
the client node address is determined from the automatically allocated
FINS node addresses controlled by the server.
3. The server stores its own node address in the server node address field
and the automatically allocated client FINS node address in the client node
address field, and sends to the client using the FINS NODE ADDRESS
DATA SEND (SERVER TO CLIENT) command.
4. The server node address is obtained from the server node address field in
the received command, and the client node address is obtained from the
client node address field.
5. A FINS message is sent using the FINS FRAME SEND command.
6. The FINS message is separated out from the received command.
Note In steps 5 and 6, both the client and server can send and receive FINS mes-
sages (commands/responses) in both directions.
182
FINS/TCP Method Section 7-4
Recovery Connection
Sequence when Host Server
Client
Computer (WS) is Stopped
by an Error
A accept accept
send B
recv
ACK
C
send
D
recv
ACK
Power
interruption E
connect SYN
SYN, ACK
ACK
F
send G
recv
ACK
I H
send
1,2,3... In steps 1 to 4 the FINS message send and receive processing is performed
using the FINS FRAME SEND command.
5. This example assumes that the host computer’s power is unexpectedly in-
terrupted. The normal close processing cannot be performed at the host
computer, and an attempt is made to establish a TCP connection at startup
of the application after the power is turned ON again.
6. After establishing a TCP connection, the client sends the client node ad-
dress to the server using the FINS NODE ADDRESS DATA SEND (CLI-
ENT TO SERVER) command.
7. From the received command, the client’s node address is confirmed. At
this time, the server determines that an attempt is being made to establish
a connection with the same node address (see note), and detects a con-
nection error.
8. The server sends a CONNECTION CONFIRMATION command to the cli-
ent.
9. The client has lost the connection information from before the power inter-
ruption, so sends a response with an RST frame in the TCP layer. The
server that received the RST response closes the connection.
10. The server sends the error code (00000021 hexadecimal: Specified node
is already connected) to the client using the FINS NODE ADDRESS DATA
SEND (SERVER TO CLIENT) command.
11. The error code in the received command is also decoded by the client, and
the TCP/IP port is closed.
183
FINS/TCP Method Section 7-4
Note (1) The FINS TCP port number at the Ethernet Unit is set to the default of
9600. It can be changed in the Unit Setup.
(2) Even if the Ethernet network is comprised of multiple segments, set the
same value for the FINS network address.
Ethernet
184
FINS/TCP Method Section 7-4
■ Example 2: Host Computer and Remote Node Connected Via Relay Node
(Ethernet Unit)
Host computer
IP address: 196.36.32.50 Remote node
FINS network address: 1 FINS network address: 2
FINS node address: 50 Relay node FINS node address: 1
FINS unit number: 0 IP address: 196.36.32.100 FINS unit number: 0
Ethernet
Unit
Controller Link
FINS/TCP Sample
Program
Operation Overview • This program reads 150 words of the PLC memory beginning at D00100
by sending a FINS command (MEMORY AREA READ, command code
0101) from a UNIX workstation (WS) to the PLC on the Ethernet network.
• If no response is received within two seconds of sending the FINS com-
mand, an error will occur.
Settings • The Ethernet Unit IP address is 196.36.32.100, and the FINS node
address is 100.
• The FINS TCP port number at the Ethernet Unit (server side) is 9600
(default).
• The workstation’s IP address is 196.36.32.50 and the FINS node address
is allocated automatically.
• The FINS TCP port number at the workstation (client side) can be user-
set (if set to 0, the system automatically allocates an available port).
185
FINS/TCP Method Section 7-4
Sample Program
1 #include <errno.h>
2 #include <stdio.h>
3 #include <sys/types.h>
4 #include <sys/socket.h>
5 #include <netinet/in.h>
6 #include <signal.h>
7
8 #define FINS_TCP_PORT 9600
9 #define SERV_IP_ADDR "196.36.32.100" /* Ethernet Unit IP ADDRESS*/
10 #define MAX_MSG 2010
11 #define MAX_HEADER 32
12 #define RESP_TIMEOUT 2
13
14
15 /*
16 * FINS/TCP COMMUNICATIONS SAMPLE PROGRAM
17 */
18 main(argc,argv)
19 int argc;
20 char *argv[];
21 {
22 int sockfd;
23 struct sockaddr_in ws_addr, cs_addr;
24 unsigned char fins_cmnd[MAX_MSG], fins_resp[MAX_MSG], fins_tcp_header[MAX_HEADER];
25 unsigned char srv_node_no, cli_node_no;
26 int sendlen, recvlen;
27 char sid = 0;
28 extern recv_fail();
29
30 /*GENERATE TCP SOCKET*/
31 if ((sockfd = socket(AF_INET,SOCK_STREAM,0)) < 0)
32 err_exit("can't open stream socket");
186
FINS/TCP Method Section 7-4
33
34 /* ALLOCATE IP ADDRESS AND PORT # TO SOCKET*/
35 bzero((char *) &ws_addr,sizeof(ws_addr));
36 ws_addr.sin_family = AF_INET;
37 ws_addr.sin_addr.s_addr = htonl(INADDR_ANY);
38 ws_addr.sin_port = htons(0); /* ASSIGN LOCAL TCP PORT NUMBER
39
40 if (bind(sockfd,(struct sockaddr *)&ws_addr,sizeof(ws_addr)) < 0)
41 err_exit(“can’t bind local address”);
42
43 /* ESTABLISH CONNECTION WITH FINS/TCP SERVER*/
44 bzero((char *) &cs_addr,sizeof(cs_addr));
45 cs_addr.sin_family = AF_INET;
46 cs_addr.sin_addr.s_addr = inet_addr(SERV_IP_ADDR);
47 cs_addr.sin_port = htons(FINS_TCP_PORT);
48
49 if (connect(sockfd,(struct sockaddr *)&cs_addr,sizeof(cs_addr)) < 0)
50 err_exit(“can’t connect to FINS/TCP server”);
51
52
53 /* SEND FINS/TCP COMMAND*/
54 /*
55 * GENERATE FINS NODE NUMBER DATA SEND COMMAND (CLIENT TO SERVER)
56 */
57 fins_tcp_header[0] = ‘F’; /* Header */
58 fins_tcp_header[1] = ‘I’;
59 fins_tcp_header[2] = ‘N’;
60 fins_tcp_header[3] = ‘S’;
61 fins_tcp_header[4] = 0x00; /* Length */
62 fins_tcp_header[5] = 0x00;
63 fins_tcp_header[6] = 0x00;
64 fins_tcp_header[7] = 0x0C;
65 fins_tcp_header[8] = 0x00; /* Command */
66 fins_tcp_header[9] = 0x00;
67 fins_tcp_header[10] = 0x00;
68 fins_tcp_header[11] = 0x00;
69 fins_tcp_header[12] = 0x00; /* Error Code */
70 fins_tcp_header[13] = 0x00;
71 fins_tcp_header[14] = 0x00;
72 fins_tcp_header[15] = 0x00;
73 fins_tcp_header[16] = 0x00; /* Client Node Add */
74 fins_tcp_header[17] = 0x00;
75 fins_tcp_header[18] = 0x00;
76 fins_tcp_header[19] = 0x00; /*AUTOMATICALLY GET FINS CLIENT FINS NODE NUMBER*/
77
78 /* SEND FINS/TCP COMMAND*/
79 sendlen = 20;
80
81 if (send(sockfd,fins_tcp_header,sendlen,0) == sendlen)
82 {
83 alarm(RESP_TIMEOUT); /* START RESPONSE MONITOR TIMER*/
84 printf(“FINS/TCP header send length %d¥n”,sendlen);
85 }
187
FINS/TCP Method Section 7-4
86 else
87 {
88 err_exit("FINS/TCP header send error");
89 }
90
91 /*RECEIVE FINS/TCP COMMAND (READ RECEIVE FUNCTIONS)*/
92 recvlen = 24;
93 if (tcp_recv(sockfd, fins_tcp_header, recvlen) == recvlen)
94 {
95 alarm(0); /*STOP RESPONSE MONITOR TIMER*/
96
97 /* CONFIRM WHETHER FINS NODE NUMBER SEND COMMAND
(CLIENT TO SERVER)| WAS RECEIVED*/ |
98 if ((fins_tcp_header[8] != 0x00) | (fins_tcp_header[9] != 0x00) |
0x00) || (fins_tcp_header[11] != 0x01))
99 (fins_tcp_header[10] !=
100 {
101 err_exit("FINS/TCP illegal command error");
102 }
103
104 printf("FINS/TCP header receive length %d¥n",recvlen);
105 cli_node_no = fins_tcp_header[19];
106 srv_node_no = fins_tcp_header[23];
107 printf("FINS/TCP client Node No. = %d¥n",cli_node_no);
108 printf("FINS/TCP server Node No. = %d¥n",srv_node_no);
109 }
110 else
111 {
112 err_exit("TCP receive error");
113 }
114
115 /* SEND FINS/TCP COMMAND*/
116 /*
117 * GENERATE FINS COMMAND FRAME
118 */
119 fins_tcp_header[0] = 'F'; /* Header */
120 fins_tcp_header[1] = 'I';
121 fins_tcp_header[2] = 'N';
122 fins_tcp_header[3] = 'S';
123 fins_tcp_header[4] = 0x00; /* Length */
124 fins_tcp_header[5] = 0x00;
125 fins_tcp_header[6] = 0x00;
126 fins_tcp_header[7] = 8+18; /*Length of data from Command up to end of FINS frame */
127 fins_tcp_header[8] = 0x00; /* Command */
128 fins_tcp_header[9] = 0x00;
129 fins_tcp_header[10] = 0x00;
130 fins_tcp_header[11] = 0x02;
131 fins_tcp_header[12] = 0x00; /* Error Code */
132 fins_tcp_header[13] = 0x00;
133 fins_tcp_header[14] = 0x00;
134 fins_tcp_header[15] = 0x00;
135
136 /* SEND FINS/TCP COMMAND*/
137 sendlen = 16;
138 if (send(sockfd,fins_tcp_header,sendlen,0) == sendlen) {
188
FINS/TCP Method Section 7-4
189
FINS/TCP Method Section 7-4
192 }
193
194 printf("FINS/TCP header receive length %d¥n",recvlen);
195 recvlen = fins_tcp_header[6];
196 recvlen <<=8;
197 recvlen += fins_tcp_header[7];
198 recvlen -= 8; /* SUBTRACT LENGTH OF COMMAND & ERROR CODE OF FINS/TCP HEADER*/
199 printf("FINS/TCP frame receive length %d¥n",recvlen);
200 }
201 else
202 {
203 err_exit("TCP receive error");
204 }
205
206 /* RECEIVE FINS RESPONSE FRAME*/
207 if (tcp_recv(sockfd, fins_resp, recvlen) == recvlen)
208 {
209 alarm(0); /* STOP RESPONSE MONITOR TIMER*/
210 printf("recv length %d¥n",recvlen);
211
212 if (recvlen < 14) /* ILLEGAL RESPONSE LENGTH CHECK*/
213 err_exit("FINS length error");
214 if ((fins_cmnd[3] != fins_resp[6]) || (fins_cmnd[4] != fins_resp[7]) ||
215 (fins_cmnd[5] != fins_resp[8]) )
216 {
217 /* DESTINATION ADDRESS CHECK*/
218 err_exit("illegal source address error");
219 }
220
221 if(fins_cmnd[9] != fins_resp[9]) /* SID CHECK */
222 err_exit("illegal SID error");
223 }
224 else
225 {
226 alarm(0); /* STOP RESPONSE MONITOR TIMER
227 err_exit("receive error");
228 }
229
230
231 /* CLOSE SOCKET */
232 close(sockfd);
233
234 }
235
236
237 /*
238 * TCP RECEIVE PROCESSING (RECEIVE REPEATED UP TO THE SPECIFIED NUMBER OF BYTES)
239 */
240 int tcp_recv(sockfd, buf, len)
241 int sockfd;
242 unsigned char *buf;
243 int len;
244 {
190
FINS/TCP Method Section 7-4
191
Maximum Transmission Delays: Writing/Reading to CPU Unit Section 7-5
192
Maximum Transmission Delays: Writing/Reading to CPU Unit Section 7-5
193
Maximum Transmission Delays: Writing/Reading to CPU Unit Section 7-5
Example Calculations The following example shows calculations for sending 256 words between two
PLC nodes using SEND(090). Calculations are shown in the following table.
Conditions
CPU cycle time: 10 ms
CPU execution mode: Normal
CPU uniform peripheral servicing time: Default (4%)
Baud rate: 100Base-TX
Item Calculation
Personal computer transmission pro- ---
cessing time
Transmission delay (command) 256 × 0.0013 + 0.0118 = 0.3446 ≈ 0.3 ms
194
Appendix A
Ethernet Network Parameters
195
Ethernet Network Parameters Appendix A
196
Appendix B
Buffer Configuration
UDP socket
(See note 1.)
reception
request buffers
(8 × 9,016 max.)
FINS reception
buffer (16,383
FINS processing bytes max.)
CPU Unit
buffers (192 ×
Communications
2,020 bytes) Network
controller
FINS send
buffer (9,000
bytes max.)
FTP service
send buffer
(4,096 bytes)
IP packet
output queue
(50 max. ×
1,500 bytes)
TCP socket send
request buffers (8
× 4,096 max.)
(See note 2.)
197
Buffer Configuration Appendix B
Network Memory
Most of the buffers used for communications servicing by the Ethernet Unit are administered in a buffer config-
uration called network memory. Network memory consists of 196K bytes of memory divided into short and long
buffers. The use of short and long buffers is determined by the status of the various services when the Ethernet
Unit is running. The capacity of all buffers cannot be used due to limits in the mounted memory capacity. The
status of the short and long buffers can be accessed by execution the FINS command MEMORY STATUS
READ (2763).
Note 1. The status of UDP and TCP socket reception request buffers can be accessed by executing the FINS
command SOCKET STATUS READ (2764).
The status of UDP and TCP socket send request buffers can be accessed by executing the FINS command
SOCKET STATUS READ (2764).
198
Appendix C
TCP Status Transitions
The TCP socket status can be confirmed using the socket status data returned for the FINS command
SOCKET STATUS READ (2764).
CLOSED
ACTIVE OPEN
snd SYN
Passive OPEN CLOSE
LISTEN
CLOSE
rcv SYN
SEND
snd SYN,ACK
snd SYN
Status Meaning
CLOSED Connection closed.
LISTEN Waiting for connection.
SYN SENT SYN sent in active status.
SYN RECEIVED SYN received and sent.
ESTABLISHED Already established.
CLOSE WAIT FIN received and waiting for completion.
FIN WAIT 1 Completed and FIN sent.
CLOSING Completed and exchanged FIN. Awaiting ACK.
LAST ACK FIN sent and completed. Awaiting ACK.
FIN WAIT 2 Completed and ACK received. Awaiting FIN.
TIME WAIT After closing, pauses twice the maximum segment life
(2MSL).
199
TCP Status Transitions Appendix C
200
Appendix D
ASCII Characters
Bits 1 to 4 Bits 5 to 7
Binary 0000 0001 0010 0011 0100 0101 0110 0111
Hex 0 1 2 3 4 5 6 7
0000 0 NUL DLE Space 0 @ P p
0001 1 SOH DC1 ! 1 A Q a q
0010 2 STX DC2 ” 2 B R b r
0011 3 ETX DC3 # 3 C S c s
0100 4 EOT DC4 $ 4 D T d t
0101 5 ENQ NAK % 5 E U e u
0110 6 ACK SYN & 6 F V f v
0111 7 BEL ETB ’ 7 G W g w
1000 8 BS CAN ( 8 H X h x
1001 9 HT EM ) 9 I Y i y
1010 A LF SUB * : J Z j z
1011 B VT ESC + ; K [ k {
1100 C FF FS , < L \ l |
1101 D CR GS - = M ] m }
1110 E SO RS . > N ^ n ~
1111 F SI US / ? O _ o DEL
201
ASCII Characters Appendix D
202
Appendix E
Maintenance
The Ethernet Unit makes up part of a network. Repair a defective Ethernet Unit as soon as possible as it can
have a negative effect on the entire network. We recommend that customers keep one or more spare Ethernet
Units to allow immediate recovery of the network.
203
Maintenance Appendix E
204
Appendix F
Inspections
Carry out regular inspections to ensure the Ethernet Unit is functioning perfectly.
Items
Most of the parts that make up an Ethernet Unit are semiconductor components. None of the parts in the Unit
will wear out after a specific lifetime, but some parts may deteriorate due to extreme operating condition.
Therefore, it is important to inspect the Unit regularly.
Inspection Interval
Normally inspect once or twice per year. Choose the inspection period according to the severity of the operat-
ing conditions.
Inspection Items
Correct any of the items in the table below not conforming to the specified standard.
Item Details Standard
Environment Temperature around Unit 0 to 55°C
Humidity around Unit 10% to 90% (with no condensation)
Accumulated dust No accumulated dust
Mounting Ethernet Unit firmly attached No looseness
Transceiver cable connector fully pushed in No looseness
Condition of transceiver cable No visible abnormality
Twisted-pair cable connector fully pushed in No looseness
Condition of twisted-pair cable No visible abnormality
Standard Tools
• Flat-blade and Phillips screwdrivers
• Tester or digital voltmeter
• Industrial alcohol and a clean cloth
205
Inspections Appendix F
206
Index
207
Index
encryption, 17, 37
D
ERC indicator
delete command, 68, 73, 77 error display, 29
dir command, 68, 73, 74 ERH indicator
DNS communications, 3 error display, 29
DNS server, 31 error log
automatic clock adjustment error codes, 29
errors, 94 ErrorLogClear command, 36
DNS Tab, 7, 19, 39, 92 command/response format, 55
initial settings, 31 ErrorLogClear field, 41
ErrorLogRead command, 2, 36
command/response format, 54
E ErrorLogRead field, 41
EC Directives, xxvi errors
electromagnetic fields, xxiv automatic clock adjustment, 94
EM File Memory, 80 error codes
using, 80 mail send function, 29
error messages, 78
E-mail
mail receive function, 63
attached files, 16, 17, 35
mail send function, 28
receiving, 41
troubleshooting
body, 16, 17, 36
using indicators, 29
command line, 37
compression, 17, 37 Ethernet communications
data sent, 22 network parameters, 195
decoding, 37 parameters, 195
destination e-mail-address, 17 Ethernet Units
encoding, 17 communications services, 2
encryption, 17, 37 replacing, 203
errors resetting, 203
troubleshooting, 28 ETN condition field, 24
Ethernet Unit information, 13
header information, 13
protection, 40 F
protocols, 17
FALS instruction, xxiii
reception timing, 35
remote mail commands, 35 file data, 16
responses, 37 file extensions
send conditions, 17 CSV, 15
send status, 17 IOM, 15
specifications, 17 TXT, 15
status information, 15 FileDelete command, 36
subject line, 17, 36 command/response format, 45
triggers, 13, 17, 18, 23 FileDelete field, 41
user-set information, 14
FileList command, 2, 36
EMC Directives, xxvi command/response format, 46
EMI Standard, xxvi FileList field, 41
EMS Standard, xxvi FileRead command, 2, 36
encoding command/response format, 44
mail send function, 17 FileRead field, 41
208
Index
209
Index
210
Index
211
Index
212
Index
213
Index
214
Revision History
A manual revision code appears as a suffix to the catalog number on the front cover of the manual.
Revision code
The following table outlines the changes made to the manual during each revision. Page numbers refer to the
previous version.
Revision code Date Revised content
1 July 2003 Original production
02 March 2004 The following revisions were made.
Page xiv: Added information on unit versions.
Page 91: Corrected and changed information in tables and procedure.
Page 150: Corrected “114 (0072hex)” to “116 (0074hex)” and “14 bytes” to “16 bytes”
for D00020.
Page 173: Added information on FINS/TCP connections.
Page 177: Added information on FINS/TCP connections.
Page 179: Added information on FINS/TCP connections.
Page 199: Added table on TCP status transitions.
03 November 2005 Page v: Information on general precautions notation added.
Page xv: Information on liability and warranty added.
04 April 2009 Added information for unit version 1.5.
Corrected notation.
215
Revision History
216
OMRON Corporation OMRON ELECTRONICS LLC
One Commerce Drive Schaumburg, Authorized Distributor:
Industrial Automation Company
IL 60173-5302 U.S.A.
Control Devices Division H.Q.
Tel: (1) 847-843-7900/Fax: (1) 847-843-7787
Automation & Drive Division
Automation Department 1
OMRON ASIA PACIFIC PTE. LTD.
Shiokoji Horikawa, Shimogyo-ku, No. 438A Alexandra Road # 05-05/08 (Lobby 2),
Kyoto, 600-8530 Japan Alexandra Technopark, Singapore 119967
Tel: (81) 75-344-7084/Fax: (81) 75-344-7149 Tel: (65) 6835-3011/Fax: (65) 6835-2711