Toshiba V Series User Manual

Toshiba V Series User Manual | Manualzz
6F8C0904
Integrated Controller V Series
Ethernet module (EN311) User’s
Manual
Sep 30, 2004
Important Information
No patent liability is assumed by TOSHIBA Corporation with respect to use of information, illustrations,
circuits, equipment or examples of application in this publication.
TOSHIBA Corporation reserves the right to make changes and improvements to this publication and/or
related products at any time without notice. No obligation shall be incurred other than as noted in this
publication.
This publication is copyrighted and contains proprietary material. No part of this book may be reproduced,
stored in a retrieval system, or transmitted, in any form or by any means — electrical, mechanical,
photocopying, recording, or otherwise — without obtaining prior written permission from TOSHIBA
Corporation.
PROSEC, TOSLINE and TOSDIC are trademarks or registered trademarks of TOSHIBA Corporation.
IBM is a registered trademark of International Business Machines Corporation.
Microsoft, MS-DOS, Windows and Windows NT are registered trademarks of Microsoft Corporation in the
U.S.A. and other countries.
Ethernet is a registered trademark of Xerox Corporation.
DeviceNet is a trademark of the Open DeviceNet Vender Association, Inc.
 TOSHIBA CORPORATION 2000-2004. All rights reserved
Safety Precautions
This manual contains important information for the operator to operate this product safely and correctly
and avoid bodily injury and property damage.
Grasp the meanings of the following marks and their descriptions before reading this manual.
Hazard Classifications
WARNING
Indicates a potentially hazardous situation which, if not avoided,
could result in serious injury or death.
CAUTION
Indicates a potentially hazardous situation which, if not a avoided,
can result in minor or moderate injury, or property damage. It can
also be used to alert against unsafe practices.
Note: 1. Serious injury means loss of sight, injury, burns (high temperature, low temperature), electrical
shock, fracture, or intoxication which leaves aftereffects or requires hospitalization or need to
go to the hospital for a long time.
2. Injury means hurt, burn, or electrical shock which does not require hospitalization or going to
the hospital for a long time.
3. Property damage means extended breakdown of assets and materials.
Notation of Markings
Prohibited
Indicates a "may not" mark.
The concrete forbiddance is indicated with a pictograph or wording.
Mandatory
Indicate a mandatory action that you should never fail to do.
The concrete content is indicated inside or near the circle with a
pictograph or wording.
Caution
Indicates a caution.
The concrete content is indicated inside or near the triangle.
Note: The description of forbiddance, mandatory, and caution marks are subject to change, depending
on the labels on the main unit.
6F8C0904
i
1. Checking the Warning Labels on the Main Unit
Make sure warning markings are attached on the main unit.
If any of them are missing or the wording is illegible, contact Toshiba's Service Department.
2. Precautions on Installation
WARNING
Mandatory
Be sure to ground the equipment.
Operation without grounding may cause
accidental fire or shock.
CAUTION
Mandatory
Avoid the following locations when
installing or storaging the equipment.
• Locations where there is dust, salinity, or ion
particles
• Locations where there are corrosive gases
(SO2, H2S) or flammable gases
• Locations where vibration or shock occurs
beyond the allowance
• Locations where there is condensation due
to sharp temperature variations
• Locations where the ambient temperature
exceeds the allowance range
• Locations where the relative humidity
exceeds the allowance range
• Locations where the equipment is exposed
to direct sunlight
• Locations where strong electric radiation or
magnetic field is generated
Mandatory
Install the equipment at a place where
maintenance and inspection are easy to do.
Otherwise, recovery from failure may take much
more time, leading to a serious accidents.
Mandatory
1. Be sure to mount the EN311 in the base unit
because it is for the V Series model 3000.
Do not use it alone or for other applications.
Failure to observe this can cause electric
shock, injuries or module trouble.
Mandatory
Improper the installation or writing of the
system can cause not only insufficient
performance but also malfunction and
failure of the equipment
ii
Ethernet module User’s Manual
Mandatory
Mandatory
1. In configuring a system using 10BASE5,
make sure not to exceed the maximum
cable length of 500 m per segment and the
maximum number of MAUs(100)
2. In configuring a system using 10BASE5,
make sure that MAU intervals will not be
less than 2.5 m.
3. In configuring a system using 10BASE5,
make sure that AUI cable length will not
exceed 50 m.
4. Configuring a system using 10BASE5
requires MAU and AUI cables.(See 3.6
Network Component.) Purchase them as
necessary for your system.
1. Before applying voltages to the MAU power
terminal board, be sure to correctly connect
the 12-VDC cable with attention to the
positive and negative polarities.
Failure to observe this could cause trouble.
2. For module wiring, either use crimp
terminals with sheath or cover the wires with
tape so that there will be no exposed
conductors. Handle the terminal board cover
with care not to drop or break, and place it
securely on the terminal board after the
wiring. Exposed conductors could cause
electric shook.
3. It is recommended that external power be
switched on/off at the same time as T3H
power is switched on/off, if possible.
it is difficult to simultaneously switch
external power and T3H power on/off,
observe the following sequence.
Switching power on: T3H power first,
then external power
Switching power off: External power
first, then T3H power
Failure to observe the above sequence of
switching power on/off could cause trouble,
malfunction and/or shortcircuit.
Mandatory
1. In configuring a system using 10BASE2,
make sure not to exceed the maximum
cable length of 185 m per segment and the
maximum number of MAUs (30).
2. In configuring a system using 10BASE2,
make sure that node intervals will not be
less than 0.5 m.
3. Configuring a system using 10BASE2,
requires terminators and T-adaptors. (See
3.6 Network Components.) Purchase them
as necessary for your system.
Mandatory
1. ASK a qualified company for 10BASE5/
10BASE2 installation because it requires
adequate safety measure and conformity
with the standards. For the specifications of
environmental conditions for installation,
refer to JIS X5252.
Forbidden
Do not cover the hole of the equipment, and the
ventilator/air inlet of the system.
Otherwise, overheating, etc. can cause fire
or malfunction.
6F8C0904
iii
Forbidden
1. Before mounting or removing the EN311, be
sure to switch power off (S controller power
and network power). Failure to do so can
cause electric shock or fire.
2. Keep the EN311 free of wire fragments and
other foreign matter to prevent fire, module
trouble, and malfunction.
3. Secure the joints of the connectors and
cables and the EN311 mounted in the base
unit with stoppers or screws to prevent them
from slipping out of place or getting
unsteady.
If they are not adequately secured, vibration,
etc. can cause trouble or malfunction.
Forbidden
1. The EN311 cannot be simultaneously
connected to 10BASE5 and 10BASE2
systems.
2. Do not connect unused network cables to
the EN311.
Failure to observe this could cause trouble
and/or malfunction.
3. Do not connect or disconnect cables when
power (T3H/MAU supply power) is on.
Failure to observe this could cause trouble
and/or malfunction.
3. Safety Precautions on Maintenance and inspection
WARNING
Mandatory
Turn off power removing or connecting any
modules, boards, or devices.
Otherwise, it can cause electrical shock, or
machine damage.
iv
Mandatory
Turn off power removing any modules after
installing.
Otherwise, exposed conductive parts of wire
or on the rear of terminal blocks can cause
electrical shock.
Ethernet module User’s Manual
CAUTION
Mandatory
Touch a grounded metal part to discharge the
static electricity on your body before touching
the equipment.
Otherwise, charged static electricity on your
body can cause malfunction or failure.
Mandatory
Place any modules or boards removed from
the unit on a conductive mat or conductive bag
(containing a spare board, etc.) on an
grounded desk.
Otherwise, static electricity can damage
components of the module.
Forbidden
Be careful not to hit or fall off the equipment by
accident.
Excess shock can cause failure.
Forbidden
Do not apply benzene and thinner when cleaning the equipment.
Otherwise, it can cause deformity or discoloration the panel or case of the equipment.
Mandatory
Use soft cloth to clean the equipment.
Use water-dipped and squeezed cloth to
clean it if dirty.
Leaving the equipment dirty can cause
mistaken or malfunction.
4. Precautions During Parts Replacement
WARNING
Mandatory
Turn off power of the equipment before
replacing the power fuse or warning fuse.
Otherwise, it can cause electrical shock or fire.
6F8C0904
v
5. Precautions During Daily Use
WARNING
Mandatory
Apply power of the specified ratings (voltage
fluctuation range, frequency, output rating,
etc.) in User's manual.
Otherwise, it can cause malfunction, machine
damage or fire due to overheat.
Mandatory
Turn off power immediately if the ambient
temperature or internal temperature exceeds
beyond normal range or if failure is occurred
in the equipment.
Contact Toshiba for repairing.
Operation under such situation can cause fire
or electrical shock.
CAUTION
Forbidden
Do not disassemble or modify the equipment.
Otherwise, it can cause malfunction or failure.
Forbidden
Do not enter wire scrapes or other foreign
debris into the equipment.
Also, do not insert metal parts into them.
They can cause fire or accidents.
Forbidden
Do not forcibly bend or pull or distort the power
cord and other cables. Otherwise, they can be
cut off or cause overheat.
Forbidden
Do not touch any components, terminals,
connectors, or printed circuit boards in the
module.
Otherwise, it can cause the IC or LSI or the
like to be broken by static electricity, resulting
in failure or malfunction.
Also, the edge of components can cause
injury.
vi
Ethernet module User’s Manual
6. Safety Precautions on Disposal
WARNING
Forbidden
Do not throw lithium batteries into fire.
Otherwise, they can explode.
CAUTION
Mandatory
In disposing of the lithium battery or Ni-Cd
battery, observe the rules and regulations of
the local administration.
Mandatory
Observe local regulations for disposal of the
lithium batteries or the product (Base unit
and modules).
7. Precautions for Use of The Equipment
CAUTION
Mandatory
1. The emergency stop circuit, interlock circuit,
etc. must be laid out outside the S-controller
that includes EN311s.
If the S-controller and/or EN311s should
develop trouble or malfunction, it could
cause an accident involving physical
injuries or damage, and also mechanical
breakdowns and accidents.
6F8C0904
vii
CAUTION
Mandatory
1. Ensure adequate safety in changing a
program or delivering a forced output during
operation, or in performing RUN, HALT, or
other operations.
Operation errors could cause mechanical
breakdowns and accidents.
Mandatory
1. Prepare programs after fully understanding
the manual.
The sample programs are basic examples
and must be adequately studied for
applicability to an actual system.
viii
Forbidden
1. The EN311 cannot be simultaneously
connected to 10BASE5 and 10BASE2
systems.
Do not connect unused network cables to
the EN311.
Failure to observe this could cause trouble
and/or malfunction.
2. Do not operate the 10BASE5/10BASE2
selector dual switches during data
transmission or reception. Otherwise, it
could cause trouble and/or malfunction.
3. To change the positions of the dual
switches, change the upper and lower
switches together.
Proper selection cannot be made by
changing the position of only one of them.
Ethernet module User’s Manual
Limitation of Applications
The equipment has been designed and manufactured for use in an industrial environment.
However, the equipment is not intended to be used for systems which can endanger human life
(Note 1).
Consult Toshiba if you intend to use the equipment for a special application which involves human
life and has great influence on the maintenance of the public function (Note 2). This is why such
application requires special care on the operation, maintenance, and control of the system (Note 3).
(Note 1) The systems which can endanger human life are life maintenance systems, equipment
installed in the surgery, and other medical equipment.
(Note 2) The systems which involve human life and have great influence on the maintenance of the
public function mean the main control system of a nuclear power plant, safety and
protection system of a nuclear power facility, transport operation and control systems for
mass transportation, control systems of aviation and space systems, and other systems
and subsystems where safety is critical.
(Note 3) "Special care" means to build a safety system (foolproof design, fail safe design,
redundancy design, etc.) in full consultation with Toshiba's engineers.
Immunity
Toshiba is not liable for any loss caused by fire, earthquake, action by a third party, or other
accidents, or the operator's intentional or accidental misuse, incorrect use, or use under abnormal
condition.
Toshiba is not liable for any incidental loss caused by the use or non-use of this product, such as
loss of business profits, suspension of business, or loss or change of data on memory.
Toshiba is not liable for the loss caused by an operation contradictory to any of the instructions
stated in this manual.
Toshiba is not liable for the loss caused by an incorrect operation in combination with other
equipment.
Toshiba is not liable for the loss caused by a malfunction in combination with an application program
made by the customer.
NOTE:
Use cellular phones and PHSs at least one meter away from the working equipment, transmission
cables, and I/O bus cable. Otherwise, the system can malfunction.
6F8C0904
ix
Preface
This manual describes the specifications of the Ethernet Module (referred to as the
EN311) for PROSEC-T3H, handling of it when used by the Integrated Controller V Series
model 3000 Controller, and presents sample programs.
When using this product, use the product correctly based on a thorough reading of this
manual. This document is organized as follows:
Safety Precautions, Limitation of Applications, and Immunity
Make sure to read these sections before using this product.
• Chapter 1 Ethernet Module (EN311) Overview
Presents an overview of the EN311, including its functions, specifications, and
systems in which it can be used. Refer to this chapter to understand the basic
performance of the EN311.
• Chapter 2 EN311 Parts and Functions
Describes the function and names of the components of the EN311. Since this chapter
presents information required understanding the hardware settings described in the
next chapter, read this chapter carefully and use the EN311 correctly.
• Chapter 3 Preparing for Operation (Hardware)
Describes the hardware preparations and settings required to operate the EN311
normally.
• Chapter 4 Preparing for Operation (Software)
Describes the software settings required to operate the EN311 normally, and presents
sample programs.
• Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
Gives the precautions, describes the instruction format used with computer link
protocol and PC link protocol transmission, and presents sample programs.
• Chapter 6 Socket Interface Communication
Presents an overview of the socket interface, precautions, and the instruction format
used on the EN311 with the socket interface, and presents sample programs.
• Chapter 7 RAS Information
Describes the instruction format and the format of the EN311 RAS information
(including station status and down information), and presents sample programs.
• Chapter 8 Error Handling
Describes techniques for determining the causes of errors when EN311 operation is
abnormal, and procedures for recovering from those errors.
• Chapter 9 Installation and Wiring
Describes the procedures for installing the EN311 (and T3H), procedures for laying
transmission cable and the nature of the construction required.
• Appendix
Presents request code, completion status, and error code tables and describe the
execution times and minimum transmission delay times for each instruction.
6F8C0904
xi
Be Sure To Observe The Following
Please observe the following to ensure the safety of the operator using the equipment
and to keep it in normal operating condition.
1.
Before install, operate, maintain, or checkout, carefully read this manual and related
documentation and absorb the knowledge of equipment, safety information, and
considerations.
2.
Avoid installing or storing the equipment at any of the places or in the environment
mentioned below.
(1) Very dusty place
(2) Place where corrosive gases (such as SO2, H2S) are generated.
(3) Place where the product may be exposed to vibration or shock.
(4) Environment of extremely low or high temperature deviating from the conditions
for installation specified herein.
(5) Extremely humid place
xii
3.
If the ambient temperature of the internal temperature of the equipment has arisen
too high, or if the equipment has developed a fault, stop using it, switch power off,
and contact the nearest Toshiba service station.
4.
Do not open the case of the equipment while it is in operation except when setting
the switches.
5.
Do not attempt to modify the equipment.
6.
To install, wire, use, and maintain this equipment, you should be familiar with the
control devices, electronic circuitry, and wiring practices. In cases of wrong handling,
you are in a situation that could cause electric shock, fire, failure, malfunction.
Therefore, only trained and qualified personnel should be allowed to install, wire,
use, and maintain this equipment.
7.
The audience of this manual and the related documentation should be familiar with
the control devices, electronic circuitry, and wiring practices. If you have any questions about the contents, please ask.
Ethernet module User’s Manual
Related Documentation
Note that in addition to this manual, Toshiba also provides the following documents for
the controller, instructions/directives, programmer, and computer link protocol
transmission. All these manuals should be read together.
"S3 Hardware User's Manual" (6F8C0866)
Describes the specifications, how to handle, maintain, and secure the S3 hardware.
"S3 Hardware Functions" (6F8C0908)
Describes the S3 hardware functions and how to use them, gives the information
necessary to write user programs.
"V Series LD/FBD/SFC Instruction Set" (6F8C0865)
Describes the details of each instruction of the programming languages, LD, FBD, and
SFC.
"Engineering Tools - How to Setup" (6F8C0873)
Describes how to install the V Series Engineering Tools onto your PC.
"Engineering Tools - Basic" (6F8C0875)
Describes how to write, debug, print out, and save the programs using the V Series
Engineering Tools.
"T Series Computer Link Operation Manual" (UM-TS03***-E008)
Describes the specifications and handling of the computer link protocol transmission
functions built into the V Series Controller.
Registered Trademarks
• Ethernet is a registered trademark of Xerox Corporation.
• Cheapernet is not a registered trademark, but rather is a common name.
• 3 Com and Etherlink III are registered trademarks of 3 Com Corporation.
• PC-NFS Pro is registered trademarks of Sun Microsystems, Inc.
• Microsoft is a registered trademark of Microsoft Corporation.
Visual C++ is registered trademarks of Microsoft Corporation.
• UNIX is a registered trademark of UNIX System Laboratories, Inc.
6F8C0904
xiii
CONTENTS
1 Ethernet Module (EN311) Overview . . . . 1
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Standards and Terminology . . . . . . . . . . . . . . . . . . . . 2
1.3 Firmware Revisions of EN311 Supported by
S Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Basic Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 EN311 Specifications . . . . . . . . . . . . . . . . . . . . . . . . 10
1.6 Software Configuration . . . . . . . . . . . . . . . . . . . . . . . 12
2 EN311 Parts and Functions . . . . . . . . . . 15
2.1 Outline Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2 Dimensions and Components . . . . . . . . . . . . . . . . . . 17
2.3 Component Functions . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4 LED Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3 Preparing for Operation (Hardware) . . . 21
3.1 EN311 Setup Flowchart (Hardware) . . . . . . . . . . . . . 21
3.2 Switch Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3 Mounting the EN311 in the Base Unit . . . . . . . . . . . . 23
3.4 Connecting to the Network . . . . . . . . . . . . . . . . . . . . 24
3.5 MAU Power Supply . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.6 Network Wiring Equipment . . . . . . . . . . . . . . . . . . . . 29
4 Preparing for Operation (Software) . . . 31
4.1 Module Setup Flowchart (Software) . . . . . . . . . . . . . 32
4.2 Registering the EN311 . . . . . . . . . . . . . . . . . . . . . . . 33
4.3 EN311 Operation Modes and Station Statuses . . . . . 37
4.4 Function Block Specifications for EN311 Control . . . 39
4.4.1 USED_T function block . . . . . . . . . . . . . . . . . . . . . 39
4.4.2 URCV_T function block . . . . . . . . . . . . . . . . . . . . . 41
4.4.3 Socket Service Commands List . . . . . . . . . . . . . . . 42
4.4.4 Error Status List . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.5 EN311 Reset (Reset Request) . . . . . . . . . . . . . . . . . 47
4.6 Parameter Setup Request . . . . . . . . . . . . . . . . . . . . . 49
4.7 Router IP Address Setup Requests . . . . . . . . . . . . . . 53
4.8 Operating Mode Control Requests . . . . . . . . . . . . . . 55
4.9 Initialization Sample Program . . . . . . . . . . . . . . . . . . 57
6F8C0904
xv
CONTENTS
5 Computer Link Protocol and
the PC Link Protocol Transmission . . . 63
5.1 Computer Link Protocol Transmission . . . . . . . . . . . . 64
5.2 Sample Computer Link Protocol Program . . . . . . . . . 65
5.3 PC Link Protocol Transmission (Data write) . . . . . . . . 72
5.4 PC Link Protocol Transmission (Data read) . . . . . . . . 76
5.5 Sample PC Link Protocol Transmission Program . . . . 79
6 Socket Interface Communication . . . . . 87
6.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6.2 EN311 Socket Interface Usage Notes . . . . . . . . . . . . 91
6.2.1 Transmission/Reception Data Handling in UDP Socket Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91
6.2.2 Data handling and data segmentation in TCP socket
interface transmission and reception . . . . . . . . . . .92
6.2.3 Socket port numbers . . . . . . . . . . . . . . . . . . . . . . .96
6.2.4 General precautions for UDP/TCP socket . . . . . . .96
6.2.5 UDP socket interface notes . . . . . . . . . . . . . . . . . .97
6.2.6 Considerations for TCP socket . . . . . . . . . . . . . . . .97
6.3 Socket Interface Information . . . . . . . . . . . . . . . . . . . 100
6.4 Using the EN311 Socket Interface . . . . . . . . . . . . . . 102
6.4.1 UDP open request (using the USEND_T
instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103
6.4.2 UDP send request/broadcast send request (using the
USEND_T instruction) . . . . . . . . . . . . . . . . . . . . .104
6.4.3 UDP receive request (using the URECV_T
instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106
6.4.4 UDP close request (using the USEND_T
instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109
6.4.5 TCP open request (using the USEND_T
instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
6.4.6 TCP send request (using the USEND_T
instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
6.4.7 TCP receive request (using the URCV_T
instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114
6.4.8 TCP close request (using the USEND_T
instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
6.5 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.5.1 UDP socket sample programs . . . . . . . . . . . . . . .119
6.5.2 TCP socket sample programs . . . . . . . . . . . . . . .138
xvi
Ethernet module User’s Manual
CONTENTS
7 RAS Information . . . . . . . . . . . . . . . . . . 161
7.1 Station Status Information . . . . . . . . . . . . . . . . . . . . 162
7.2 Down Information . . . . . . . . . . . . . . . . . . . . . . . . . . 164
7.3 Remote Station Verification Request . . . . . . . . . . . . 165
7.4 Time Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
7.5 RAS Information Readout . . . . . . . . . . . . . . . . . . . . 170
8 Error Handling . . . . . . . . . . . . . . . . . . . 181
8.1 LED Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
8.2 Error Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
8.3 Station Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
8.4 Socket Interface Information . . . . . . . . . . . . . . . . . . 187
8.5 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
9 Installation and Wiring . . . . . . . . . . . . . 205
9.1 Installation Environment and Base Unit Mounting . . 205
9.2 Mounting and Removing Modules . . . . . . . . . . . . . . 206
9.3 Power Supply Wiring and Grounding . . . . . . . . . . . 207
9.4 Network Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
A Maintenance and Inspection . . . . . . . . 213
B Socket Service Command Table . . . . . 215
C Error Status Table . . . . . . . . . . . . . . . . 217
D USEND_T and URCV_T Execution
Times . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
E Computer Link/PC Link Protocol Minimum
Transmission Delay Times . . . . . . . . . 225
F Socket Interface Transmission Processing
Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
6F8C0904
xvii
CONTENTS
G Change/correction function in a
firmware . . . . . . . . . . . . . . . . . . . . . . . . . 231
G.1 Revision J . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
G.2 Revision K . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
G.3 Revision L . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
xviii
Ethernet module User’s Manual
Chapter 1 Ethernet Module
(EN311) Overview
1.1 Introduction
This guide describes how to handle the Ethernet Module (EN311) for the programmable
controller, PROSEC T3H, when it is used in the Sequence Control Module S3 of the
Integrated Controller V series model 3000.
Hereafter, the Sequence Control Module S3 of the V series model 3000 is called the S
controller and the Ethernet Module for PROSEC T3H is called the EN311.
EN311 is "the transfer module of the V series model 3000 parallel I/O module" which is
installed and used on the parallel I/O bus (called the G3 bus hereafter). The S controller
transfers data to the higher LAN level devices such as workstations/PCs and other
programmable controller via the EN311. The EN311 can be connected to the LAN (Local
Area Network) 10BASE5 (Ethernet) or 10BASE2 (Cheapernet). 10BASE5 or 10BASE2
can be selected by the switch on the module.
The following is a LAN configuration example using the EN311. In this example, the S
controller is connected to host machines such as workstations and personal computers
over a 10BASE5 or 10BASE2 LAN while the S controller is connected to lower level
controllers using a Toshiba proprietary control LAN.
:
:PROSEC-T3
T2:PROSEC-T2
TL-S20:TOSLINE-S20
DN311:Device Net Master
R-I/O:Device Net Slave
T3H PROSEC-T3H
Host machine
T3
PC/workstation
10BASE5 / 10BASE2
T
L
|
S
2
0
I
/
O
S Controller
S Controller
E
N
3
1
1
I
/
O
E
N
3
1
1
T
L
|
S
2
0
D
N
3
1
1
I
/
O
TOSLINE-S20
DeviceNet
T
3
H
/
T
3
T
L
|
S
2
0
I
/
O
I
/
O
T
2
E
T
L
|
S
2
0
I
/
O
I
/
O
R-I/O
R-I/O
R-I/O
Figure 1-1 LAN Configuration
6F8C0904
1
Chapter 1 Ethernet Module (EN311) Overview
1
1.2 Standards and Terminology
Generally, both the Ethernet Version 2.0 (DIX standard) established by the three
companies (DEC, Intel, and Xerox) and the ISO8802-3(IEEE802.3) which has been
internationally standardized based on the DIX standard are called the "Ethernet".
Because ISO8802-3 standard includes the DIX standard, the network devices developed
according to each standard are basically compatible.
Because the physical layer of the EN311 has a configuration compliant with the
ISO8802-3, ISO8802-3 compliant network devices should be used.
Also note that the data link layer of the EN311(send/receive frame of the IP datagram)
adopts the DIX standard frame (see Figure 6-8).
The network terms used throughout this guide are the ones used in the ISO8802-3
standard. The DIX standard terms (colloquial terms) and the ISO8802-3 standard
network terms are mapped as follows:
Table 1-1 Network Terms Correspondences
DIX Standard
ISO8802-3 Standard
Ethernet
10BASE5
Cheapernet
10BASE2
Coaxial cable
Coaxial cable
Transceiver cable
AUI (Attachment Unit Interface) cable
Transceiver
MAU (Medium Attachment Unit)
Ethernet address
MAC address
• Ethernet is a registered trademark of Xerox Corporation.
• Cheapernet is not a registered trademark (It's a colloquial term).
• DeviceNet is a registered trademark of ODVA (Open DeviceNet Vendor Association).
2
Ethernet module User’s Manual
1.3 Firmware Revisions of EN311 Supported by S Controller
1.3 Firmware Revisions of EN311 Supported by
S Controller
1
The S controller supports only the modules having firmware revisions with I (i) or later.
The revisions are made in descending alphabetic order.
The firmware revisions can be identified by the EN311 serial numbers.
"Firmware: Rev.I" format is used in serial number "9600001" and later. If your product
has a serial number prior to "9600001" but has "I" label attached to the end of the serial
number, it has been updated to revision I.
Year/month of manufacture (1999, June) Month of manufacture:
Oct...X/Nov...Y/Dec...Z
How to read serial number:
9600001
Reference number in the production lot of June, 1999
The number of digits in the serial number has changed to 8 from 7 since August, 1999.
Year/month of manufacture (1999, August) Month of manufacture:
Oct...X/Nov...Y/Dec...Z
How to read serial number:
99800001
Reference number in the production lot of August, 1999
6F8C0904
3
Chapter 1 Ethernet Module (EN311) Overview
1
1.4 Basic Functionality
The EN311 has the following main features.
(1) T series computer link protocol transmission (slave station)
The host machine can upload or download user programs, execute control
commands, and read or write register data to an S controller on the 10BASE5/2 LAN
using the T series computer link protocol.
This function can be used simply by making basic settings on the EN311 from the S
controller; there is no need to write special user programs for the S controller.
Computer link protocol uses UDP/IP as the transmission protocol.
UDP/IP: User datagram protocol/Internet protocol.
Host machine
PC
Application
W orkstation
program
10BASE5
/10BASE2
Response
Request
EN311
S controller
operating system
User program
Figure 1-2 T Series Computer Link Protocol Transmission (slave station)
4
Ethernet module User’s Manual
1.4 Basic Functionality
(2) T series/PC link protocol transmission
The S controller can use the T series/PC link protocol to read or write register data on
another S controller on the 10BASE5/2 LAN or to the PROSEC-T3H/T2N.
The S controller user programs for reading and writing are necessary to use the host
functions.
Only the basic EN311 settings performed from the T3H are required to use the slave
functions, and no special user programs are required on the T3H.
PC link protocol transmission uses UDP/IP as the transmission protocol.
UDP/IP: User Datagram Protocol/Internet Protocol.
PC link host station
User program
S controller
operating system
EN311
10BASE5
/10BASE2
Response
Request
EN311
S controller
operating system
User program
PC link slave station
Figure 1-3 T Series/PC Link Protocol Transmission
6F8C0904
5
1
Chapter 1 Ethernet Module (EN311) Overview
(3) Socket interface support
1
This is a standard communications technique used on engineering workstations
(EWS) and similar computers. Transmission between user programs on the S
controller and host machines is possible using the socket interface.
There are eight sockets on an EN311 and the transmission protocol (TCP/IP or UDP/
IP) can be specified for each socket.
TCP/IP: Transmission Control Protocol/Internet Protocol
UDP/IP: User Datagram Protocol/Internet Protocol
Host machine
PC
Workstation
Application
program
Socket
10BASE5
Data transmission
/10BASE2
EN311
Socket
S controller
User program
Figure 1-4 Socket Interface
6
Ethernet module User’s Manual
1.4 Basic Functionality
(4) Routing feature support
In order to exchange data between an EN311 on Network A which supports routing
feature and a PC on Network B, the EN311 should pass the transmission data to the
router. This is called an indirect routing and is supported by EN311.
S controller
Workstation
EN311
Network A
Router
Network B
PC
Figure 1-5 Routing feature
The indirect routing supported by EN311 is the default routing method. In this
method, if the destination of the data is not on the same network, the transmission
data is routed to the default router.
One address (IP address) per router can be registered into EN311. The destination
network must exist over this router. To send data from an EN311 on Network A to a
workstation on Network B, the IP address of Router A should be registered into the
EN311. If Router A is the EN311 router, the EN311 cannot send data to any PCs on
Network C. To send data to PCs on Network C, put the EN311 into the standby
mode, register Router B as the router, then put it into the run mode.
S controller
EN311
Network A
Router A
Router B
Network B
Network C
Workstation router B
PC
Figure 1-6 Router setting
6F8C0904
7
1
Chapter 1 Ethernet Module (EN311) Overview
(5) Other features
1
The EN311 can connect to either a 10BASE5 or a 10BASE2 network. A 10BASE5 or
a 10BASE2 can be simply selected by a switch on the front panel, although
simultaneous connection to both networks is not possible.
(a) 10BASE5
Transmission method: Baseband
Data transmission rate: 10 Mbps
Maximum segment length: 500 meters
Number of nodes per segment (Number of MAUs): 100
Minimum distance between MAUs: 2.5 meters
This network uses 50W coaxial cable as the transmission cable.
The EN311 can implement systems such as the one shown in the following figure
using 10BASE5 coaxial cable.
Terminator
MAU
MAU
Terminator
10BASE5 coaxial cable
Maximum
AUI
length of
cable
S controller
S controller
E
N
3
1
1
AUI cable is 50
E
N
3
1
1
meters
Figure 1-7 10BASE5
Usage Recommendations
• Do not exceed the maximum cable length (500 m) per segment or the maximum number of
MAUs (100) in systems using 10BASE5.
• Adjacent MAUs must be mounted at least 2.5 meters apart in systems using 10BASE5.
• The AUI cable length must not exceed 50 meters in systems using 10BASE5.
8
Ethernet module User’s Manual
1.4 Basic Functionality
(b) 10BASE2 (The MAU is built into the EN311)
1
Transmission method: Baseband
Data transmission rate: 10 Mbps
Maximum segment length: 185 meters
Number of nodes per segment (Number of MAUs): 30
Minimum distance between MAUs: 0.5 meters
This network uses 50W coaxial cable as the transmission cable.
The EN311 can implement systems such as the one shown in the following figure
using 10BASE2 coaxial cable.
S controller
S controller
E
N
3
1
1
E
N
3
1
1
Terminator
10BASE2 coaxial cable
Terminator
T connector
Figure 1-8 10BASE2
Usage Recommendations
• Do not exceed the maximum cable length (185 m) per segment or the maximum number of
MAUs (30) in systems using 10BASE2.
• Adjacent nodes must be separated by at least 0.5 meter in systems using 10BASE2.
6F8C0904
9
Chapter 1 Ethernet Module (EN311) Overview
1
1.5 EN311 Specifications
Table 1-2 lists the EN311 specifications. The general specifications of the EN311
conform to those of the S controller.
Table 1-2 Functional Specifications
Item
Specification
Module type
EN311
Transmission specifications
10BASE5(Ethernet)
10BASE2(Cheapernet)
Media access method
CSMA/CD
Modulation
Baseband
Transmission topology
Bus type
Transmission speed
10 Mbps
Maximum distance between
nodes
2500 m
Maximum segment length
500 m
185 m
100 units/segment(*)
30 units/segment
2.5 m
0.5 m
15-pin D-SUB (female) with
locking fitting
BNC connector
Maximum number of MAUs
Minimum node separation
Connector
Connecting cable
AUI cable conforming to the
ISO8802-3 standard
AUI cable: up to 50 meters in
length
Transmission services
925 m
Coaxial cable (RG-58/U: with
BNC connectors) using
T-adapter
1. T series computer link protocol (slave station)
2. T series/PC link protocol (master station/slave station)
3. Socket interface (8 sockets)
RAS functions
1. Self-diagnostics at power on
ROM, RAM, LAN controller,
S controller interface memory, MAC address
2. Test functions accessible from user programs
• Remote station verification request
3. Data provided by RAS data readout
• Event trace
• LAN controller (network) information
• Protocol state
4. Time/date setup function
5. Socket information in the S controller interface memory
10
Current drain [A]
0.7A (5V DC), 0.5A (12 VDC)
Outer dimensions [mm]
33.0 (W) × 250 (H) × 110 (D)
Weight [grams]
480
Board specifications
One slot (slot width)
Ethernet module User’s Manual
1.5 EN311 Specifications
Table 1-2 Functional Specifications
Item
Mounting method
1
Specification
In the Integrated Controller V Series, parallel I/O bus on model
3000 (G3 bus)
Number of modules mountable 4 modules per unit
USEND_T/URCV_T function block (module control and
transmission functions)
Access method
(In case of installing the EN7** also, 4 modules including EN7**
per unit)
* Segment: A network unit formed from a single transmission medium (coaxial cable)
The following figure shows the maximum distance between nodes and the segment
length.
Segment length
Node
Terminator
Repeater
MAU
Node
Node
Node
Maximum distance between nodes
Figure 1-9 Distance between nodes
6F8C0904
11
Chapter 1 Ethernet Module (EN311) Overview
1
1.6 Software Configuration
The EN311 transmission functions (computer link protocol transmission, PC link protocol
transmission, and socket interface transmission) are implemented with the software
configuration shown in the following figure.
S controller user program
USEND_T/URCV_T
function block
S controller
S controller firmware
Computer link/socket interface
G3 bus
Module interface
UDP
TCP
IP
ARP
ICMP
EN311
CSMA/CD
10BASE5
10BASE2
Figure 1-10 Software Configuration
(1) TCP (Transmission Control Protocol)
Before transferring data with the remote node, a connection (virtual communication
circuit) is first established and then data is transferred. Packet order control,
retransmission, flow control, and other techniques guarantee transmission reliability.
The EN311 supports the following functions:
• Response bit (ACK)
• Synchronized bit (SYN)
• Fin bit (FIN)
• Retransferring
• Window (flow) control --- Some functions have limitations.
• Segment division
• Reporting of the maximum receivable segment length
• Push bit(PSH)
When EN311 transmits data, a PSH bit is always OFF.
12
Ethernet module User’s Manual
1.6 Software Configuration
When EN311 receives data, EN311 notifies data reception to S controller regardless of a status of the PSH bit.
• Reset packet (packet which the RST bit is set to ON)
If the firmware of EN311 is after Revision I, transmission/reception of a reset
packet is possible for EN311. EN311 firmware carries out transmission of a reset
packet in conformity with TCP agreement. A reset packet cannot be transmitted
by S controller user program.
(2) UDP (User Datagram Protocol)
Transfers data with the remote node in datagram units. Provides high-speed
transfers since a connection is not used, but does not have control functions that
assure reliability, as does TCP. Thus it requires support from a higher level protocol.
The EN311 supports the following function:
• UDP checksum function.
(3) IP (Internet Protocol)
Sends and receives data in the datagram format. Sends data in datagram units to the
remote node according to the IP address.
The EN311 supports the following functions:
• Data fragmentation and reassemble
• Direct routing
• Broadcast
• Indirect routing --- Default routing
The EN311 does not support the multicast functions:
Although the EN311 physical layer structure conforms to the ISO8802-3 standard, it
adopts DIX standard frames as the data link frames (the IP datagram send/receive
frames). See Figure 6-8.
(4) ARP (Address Resolution Protocol)
Searches for a node MAC address (Ethernet address) that has a specified IP
address.
(5) ICMP (Internet Control Message Protocol)
Reports IP packet errors and verifies the state of the IP network.
The EN311 supports the following functions:
• Echo request/reply
• Timestamp request/reply
• Information request
• Destination unreachable
• Source quenches
• Redirect
• Time exceeded for a datagram
• Parameter problem on datagram
• Address mask request
The EN311 does not support the following functions:
• Information reply
• Address mask reply
6F8C0904
13
1
Chapter 2 EN311 Parts
and Functions
This chapter describes the sections of the EN311 and their functions.
6F8C0904
15
Chapter 2 EN311 Parts and Functions
2.1 Outline Drawing
2
Figure 2-1 EN311 Outline Drawing
16
Ethernet module User’s Manual
2.2 Dimensions and Components
2.2 Dimensions and Components
2
LED displays
Reset switch
Test connector
(9-pin D-SUB connector)
10BASE2
connector
10BASE2/10BASE5
selection switch
10BASE5
connector
LED display
MAU power
supply terminal block
Figure 2-2 EN311 Dimensions (Front and Side) Unit (mm)
6F8C0904
17
Chapter 2 EN311 Parts and Functions
2.3 Component Functions
(1) LED display
2
Indicators that display the EN311 operating state. See section 2.4, "LED Display", for
detailed information.
(2) Reset switch
Used to reset the EN311 module as a unit.
Usage Recommendations
• To press the reset switch, use a pointed object, such as a ballpoint pen, to press
the switch through the hole in the front panels. Be sure to press the switch all the
way down.
(3) Test connector
This connector is used for maintenance, and is not used during normal operation.
(4) 10BASE2 connector
Connector used to connect the EN311 to a 10BASE2 coaxial cable. See section 3.4,
"Connecting to the Network", for details on connection techniques.
(5) 10BASE5 connector
Connector used to connect an AUI cable (the cable between the EN311 and the
MAU) to the EN311. See section 3.4, "Connecting to the Network", for details on
connection techniques for AUI cables and the 10BASE5 connector and for AUI cable
and the MAU.
(6) 10BASE2/10BASE5 selection switch
Switch for selecting what kind of network, 10BASE5 or 10BASE2, the EN311 is
connected to. See section 3.2, "Switch Settings", for details on switching between
10BASE5 and 10BASE2 LANs.
(7) MAU power supply terminal block
Terminal block for providing 12-V DC power to the 10BASE5 MAU and the EN311
internal 10BASE2 MAU. Always provide 12-V DC power, regardless of which network
is used. If the S controller power supply is operating normally and 12-V DC power is
supplied, then the EN311 "EXT. POWER" LED will light. See section 3.5, "MAU
Power Supply", for details on providing the required voltage to the MAU power supply
terminal block.
18
Ethernet module User’s Manual
2.4 LED Display
2.4 LED Display
The LEDs on the EN311 front panel indicate the status of the system. These LEDs show
the operating state of the EN311.
Table 2-1 LED Descriptions
LED
Description
RUN (Run)
Green
Indicates whether or not the module is operating normally.
On . . . . . The module is operating normally.
Off . . . . . A module error occurred.
STBY (Standby)
Red
Indicates the operating mode while the module is operating normally or the
outline of the cause when the module is down.
On . . . . . Standby (while operating normally)
Off . . . . . Run (while operating normally)/self-diagnostic error (when the
module is down)
Blinking . The module went down while operating (when the module is
down).
SEND (Send)
Green
Indicates whether or not the module is transmitting data.
On . . . . . Data transmission in progress
Off . . . . . No data is being transmitted.
RCV (Receive)
Green
Indicates whether or not the module is receiving data from the transmission
line.
On . . . . . Data is present on the transmission line.
Off . . . . . The transmission line is empty.
COL (Collision)
red
Indicates whether or not a collision is occurring on the transmission line
during a data transmission.
On . . . . . Collision(s) occurred.
Off . . . . . No collisions occurred.
ACC (Access)
Green
Indicates whether or not the S controller is accessing the module.
On . . . . . The S controller is accessing the module.
Off . . . . . The S controller is not accessing the module.
EXT. POWER
(External Power)
Green
Indicates whether or not 12-V DC power is supplied to the MAU power
supply terminal block.
On . . . . . The 12-V power is supplied normally.
Off . . . . . The 12-V power is either not supplied.
Note that this LED will not light unless the S controller power is turned on.
The combinations of the RUN LED and the STBY LED indicate the module state (run,
standby or down).
Combination of LEDs
Description
RUN on, STBY on
The module is operating normally in standby mode
(Parameter setting wait state)*
RUN on, STBY off
The module is operating normally in run mode
(Data transfer ready state)*
RUN off, STBY blinking
An error occurred while the module was operating (Down mode)*
RUN off, STBY off
An error was detected during power-on self-diagnostics
(Down mode)*
* See section 4.8, "Operating Mode Control Requests", for detailed information on run,
standby and down modes.
6F8C0904
19
2
Chapter 3 Preparing for
Operation (Hardware)
3.1 EN311 Setup Flowchart (Hardware)
Warning
• Build emergency stop, interlock, and similar circuits outside the PC that includes the EN311.
If a breakdown or malfunction occurs in the PC or the EN311, there is the danger that someone could be hurt or fatally injured. Also, other equipment could be damaged or a breakdown
could occur.
Caution
• Take all necessary safety precautions before performing operations such as changing a running program, forcing output, or switching to RUN (operate) or HALT (stop) modes.
Equipment can be damaged and breakdowns can be caused by operating this equipment
incorrectly.
The following is the flowchart for EN311 setup.
Start
Select which LAN is to be used by setting the
Set the 10BASE5/2 selection switch
10BASE5/10BASE2 selection switch.
See section 3.2, "Switch Settings", for details.
Mount the EN311 onto an S controller G3 I/O bus
Mount the EN311 in an S controller G3 path and
tighten the mounting screws.
See the section about "Mounting Modules" in "S3
User's Manual - Hardware" for details.
Connect the EN311 to the network
Connect either the 10BASE5 AUI cable or the
10BASE2 coaxial cable.
See section 3.4, "Connecting to the Network", for
details.
Provide 12-V DC power to the MAU power supply
terminal block
Connect a 12-V DC power supply to the MAU
power supply terminal block and attach the terminal
block cover.
See section 3.5, "MAU Power Supply", for details.
End
Figure 3-1 EN311 Setup Flowchart
6F8C0904
21
Chapter 3 Preparing for Operation (Hardware)
3.2 Switch Settings
The EN311 provides two connected switches that are used to switch between 10BASE5
and 10BASE2 networks, i.e., to select the connected network type.
Caution
3
• The EN311 cannot be connected to both a 10BASE5 and a 10BASE2 network concurrently.
Do not connect a network cable of the unused type to the EN311. This can damage the
EN311 or cause it to malfunction.
• Do not change this switch setting while a data transfer is in progress. This can damage the
EN311 or cause it to malfunction.
• When changing this switch setting, turn both switches together at the same time. Only turning one of the switches at a time will not result in normal correct switching between the networks.
(1) 10BASE5
Turning the two connected DIP switches on the front panel to the left allows a
10BASE5 network to be connected.
10BASE5
10BASE2
Figure 3-2 Switch Settings when a 10BASE5 Network is Used (front view)
(2) 10BASE2
Turning the two connected DIP switches on the front panel to the right allows a
10BASE2 network to be connected.
10BASE5
10BASE2
Figure 3-3 Switch Settings when a 10BASE2 Network is Used (front view)
22
Ethernet module User’s Manual
3.3 Mounting the EN311 in the Base Unit
3.3 Mounting the EN311 in the Base Unit
Mount the EN311 in the S controller G3 I/O bus, secure it with the locks and screws.
See section 4.3, "Mounting Modules" in the S3 User's Manual - Hardware for the
mounting procedure.
3
Caution
• The EN311 is designed specially for the V Series model 3000 and should only be mounted
and used in a V Series model 3000 base unit. Do not use this module independently or
mounted in any other equipment. Such usage could result in electric shocks, personal injury,
or damage to the EN311 and other equipment.
• The EN311 itself should only be mounted or removed when all power is turned off. Similarly,
connections to the terminal block should only be made or removed when all power is turned
off. Not observing this precaution could result in electric shocks, malfunctions, or damage to
the EN311 or other equipment.
• Do not allow foreign objects such as wire shreds to get into the EN311. This could result in
fire, breakdown, or malfunction.
• Verify that connectors, cables, and the mounting of the EN311 itself in the base unit are all
secured with screws or stoppers and that there is no dropout or loose screws in any of these
parts.
If any of these parts is inadequately secured, breakdown or malfunction could
occur as the result of vibration.
Up to four EN311 modules may be mounted in one unit. If you also mount EN7**(*)
modules, total number of EN311 and EN7** modules should be 4 per unit.
(*) V Series model 3000 exclusive Ethernet module
Low-power system I/O modules including the EN311 should be mounted at the left side
of the unit, and high-power system I/O modules should be mounted at the right side of
the unit. In cabling as well, low-power system cables and high-power system cables
should be separated. section 9.4, "Network Wiring", describes network cable wiring.
The EN311 draws 0.7 amperes from the S controller power supply (5 VDC). For details
on determining the power supply capacity, see the section about the power supply
capacity in the S3 User's Manual - Hardware.
6F8C0904
23
Chapter 3 Preparing for Operation (Hardware)
3.4 Connecting to the Network
Since the EN311 supports both 10BASE5 and 10BASE2 networks, select either a
10BASE5 or 10BASE2 network according to your system needs.
Caution
3
• The EN311 cannot be connected to both a 10BASE5 and a 10BASE2 network at the same
time.
• Do not connect a network cable of the unused type to the EN311. This can damage the
EN311 or cause it to malfunction.
• Do not connect or disconnect cables when either the T3H or MAU power supply is turned on.
This can damage the EN311 or cause it to malfunction.
(1) Connecting to 10BASE5 Network
This section describes the connecting procedure starting from the state where the
10BASE5 coaxial cable, the MAU, and the AUI cable are already supplied and ready
to be connected. See section 9.4, "Network Wiring", for details on wiring the
10BASE5 coaxial cable, MAU, and AUI cables.
Sliding latch
EN311
To the MAU
AUI cable
MAU power supply terminal
Figure 3-4 AUI Cable Connection
(a) Push the 10BASE5 connector sliding latch up.
(b) Align the AUI cable connector with the 10BASE5 connector and push it in.
(c) Push the 10BASE5 connector sliding latch down. Make sure that the cable is
locked and cannot be pulled out.
24
Ethernet module User’s Manual
3.4 Connecting to the Network
Caution
• When installing a 10BASE5 or 10BASE2 network, the cabling must be handled with adequate safety precautions and in accordance with all applicable standards. A qualified professional should perform installation and wiring.
See the "ISO/IEC 8802-3" standard for installation environment standards.
Usage Recommendations
• Do not exceed the maximum number of MAUs (100) or the maximum cable length (500 m) in
systems using 10BASE5.
• Adjacent MAUs must be mounted at least 2.5 meters apart in systems using 10BASE5.
• The AUI cable length must not exceed 50 meters in systems using 10BASE5.
• An MAU and an AUI cable are required in systems configured using a 10BASE5 network.
(See section 3.6, "Network Wiring Equipment")
These parts must be ordered separately if necessary.
(2) Connecting to 10BASE2 Network
This section describes the connecting procedure starting from the state where the
10BASE2 coaxial cable, the MAU, and the AUI cable are already supplied and ready
to be connected. See section 9.4, "Network Wiring", for details on wiring the
10BASE2 coaxial cable.
10BASE2
coaxial cable
EN311
(1)
10BASE2 connector
(2)
Protrusion
Groove
10BASE2
coaxial cable
10BASE5 connector
Figure 3-5 10BASE2 Coaxial Cable Connection
6F8C0904
25
3
Chapter 3 Preparing for Operation (Hardware)
(a) Align the groove in the T connector with the protrusion on the 10BASE2
connector and insert the connector in the plug.
(b) With the connector inserted in the plug, rotate the ring on the plug 1/4 turn in the
clockwise direction to lock the BNC connector in place.
(c) Insert the BNC plugs on the 10BASE2 cable into (1) and (2) sections of the T
connector and lock them in place in the same way.
(d) Make sure that the cables and connectors are locked and cannot be pulled apart.
3
Caution
• When installing a 10BASE5 or 10BASE2 network, the cabling must be handled with adequate safety precautions and in accordance with all applicable standards. A qualified professional should perform installation and wiring.
See the "ISO/IEC 8802-3" standard for installation environment standards.
Usage Recommendations
• Do not exceed the maximum number of MAUs (30) or the maximum cable length (185 m) in
systems using 10BASE2.
• Adjacent nodes must be separated by at least 0.5 meter in systems using 10BASE2.
• Terminators and T connectors are required in systems configured using a 10BASE2 network. (See section 3.6, "Network Wiring Equipment") These parts must be ordered separately if required.
26
Ethernet module User’s Manual
3.5 MAU Power Supply
3.5 MAU Power Supply
Since the EN311 supplies 12-V DC power to the 10BASE5 MAU and the 10BASE2 MAU
(the latter of which is build into the EN311), an external 12-V DC power supply must be
connected to the MAU power supply terminal block. This means that 12-V DC power
must be provided to the EN311, regardless of which network type is used. The EXT.
POWER LED will light if the S controller power supply is operating normally and 12-V DC
power is supplied to the EN311.
Also note that the FG terminal in the MAU power supply terminal block must be grounded
to Class D grounding(100W or less ground registance) provided for the sole use of
control equipment. Such grounding is critical for reducing noise in the AUI cable. Figure
3-6 shows the method used to provide this power.
+
DC12V
-
FG (100Ω or less ground registance)
Figure 3-6 Providing 12-VDC Power
(1) DC 12V Power Unit
Since an external power supply is not included with the EN311, installations will have
to provide this equipment separately. Select an external power supply that matches
the environment in which the EN311 is used and the number of EN311 units
supplied. The table below lists a line of recommended power supply units.
Model
SR [ ] -12
Manufacture
Nemic-Lambda
[ ] : Output power (in watts)...Select the actual model according to the number of EN311
modules to which power must be supplied.
6F8C0904
27
3
Chapter 3 Preparing for Operation (Hardware)
(2) Procedure for Applying External Power
External power should be turned on and off at the same time as the S controller
power as near as one can do.
If simultaneous power supply on/off operations are not possible, turn these power
supplies on and off in the following sequences.
Power on: S power supply Æ External power supply
Power off: External power supply Æ S power supply
3
Data can be neither transmitted to nor received from the network if the external
power is not provided. Also note that the EN311 may be damaged if only external
power is supplied. Furthermore, since the EXT. POWER LED will not light in this
state, it is possible that the external power supply could cause a short.
Caution
• When providing a voltage to the MAU power supply terminal block, always provide the correct +/- 12-VDC voltage. Any other voltage can damage the EN311.
• When wiring the module, use either an insulated crimp-type terminal or wrap conducting sections with insulating tape so that no conducting sections are exposed.
Be sure to handle the terminal block cover carefully so that it does not fall off or become
damaged. Be sure to reinstall the terminal block cover after completing the wiring.
Electrical shock is possible if any conductors are left exposed.
• External power should be turned on and off at the same time as the T3H power as near as
one can do.
If simultaneous power supply on/off operations are not possible, turn these power supplies
on and off in the following sequences.
Power on: T3H power supply R External power supply
Power off: External power supply R T3H power supply
• Failure to follow the above procedures can result in equipment failures, malfunctions, or
short-circuits.
28
Ethernet module User’s Manual
3.6 Network Wiring Equipment
3.6 Network Wiring Equipment
This section describes the wiring and related equipment that makes up the network to
which the EN311 is connected. Since the EN311 conforms to the ISO 8802-3 (IEEE
802.3) standard, you should select equipment to be used in the network that also
conforms to this standard.
The following section introduces recommended wiring and related equipment. We
strongly recommend that these models be used when new items are needed.
3
Contact the manufacturer directly for detailed information on each equipment.
(1) 10BASE5
• Coaxial cable
Catalog no.
EEA-9202-[ ]M+TMJ x 2
[ ]: Length
Standard outer diameter 10.3 mm diameter, with terminators at both ends
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• Plugs
Catalog no.
EPL-6213
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• Terminators
Catalog no.
EEJ-6213
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• Adapters
Catalog no.
EAD-6213
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• Grounding clamps
Catalog no.
EEL-6213
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• AUI cable
Catalog no.
AUI15-[ ]M
[ ]: Length
Standard outer diameter 6.5 mm diameter (thin wire), molded connectors
Length
1, 2, 3, 5, 10, and 15 meters
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
Catalog no.
UI50-[ ]M
[ ]: Length
Standard outer diameter 10.5 mm diameter (thick wire), molded connectors
Length
20, 30, 40, and 50 meters
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• MAU
6F8C0904
Catalog no.
ETR-6071 02
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
29
Chapter 3 Preparing for Operation (Hardware)
(2) 10BASE2
• Coaxial cable
Catalog no.
RG-58A/U
Standard outer diameter 5.0 mm diameter, with BNC plugs at both ends
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• BNC plugs
3
Catalog no.
EPL-1067
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• T connectors
Catalog no.
ETS-8191
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• Adapters
Catalog no.
EAD-8191
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
• Terminators
Catalog no.
EEJ-8191
Manufacturer
Showa Electric Wire & Cable Co., Ltd.
Caution
• When installing a 10BASE5 or 10BASE2 network, the cabling must be handled with adequate safety precautions and in accordance with all applicable standards. A qualified professional should perform installation and wiring.
See "ISO/IEC 8802-3" standard for installation environment standards.
30
Ethernet module User’s Manual
Chapter 4 Preparing for
Operation (Software)
This section describes how to set up the EN311 software for operation.
Caution
• Make sure you understand the content of chapter 4 thoroughly before writing programs. The
sample programs present basic examples of EN311 usage, and should be reviewed carefully before using them in an actual system.
6F8C0904
31
Chapter 4 Preparing for Operation (Software)
4.1 Module Setup Flowchart (Software)
The following figure shows the flowchart for EN311 setup.
Start
Register the EN311 with the controller
4
Reset the EN311
Set the EN311 parameters from the
controller
・ Local IP address
・ UDP port number for message transfer
・ Router IP address
Specify the EN311 operating mode from
the controller
End
Register the EN311 with the S controller using the V Series
Engineering Tool.
For details, see section 4.2, "Registering the EN311."
There are three ways to reset the EN311:
Turn on the controller power.
Press the reset switch.
Reset by a user program.
For details, see section 4.5, "Resetting the EN311 ."
・
・
・
The EN311 parameters required for network transmission
are set up by a user program running on the S controller. In
this state, the system can handle remote station verification
requests. In this state, the system can also respond to
existence verification requests from other stations. See
section 7.3, "Remote Station Verification Request."
The EN311 operating mode is set by user programs running
on the controller. For details, see section 4.8, "Operating
Mode Control Requests."
In this state, the PC link/computer link protocol transmission
slave station functions are operating.
Figure 4-1 EN311 Setup Flowchart (Software)
32
Ethernet module User’s Manual
4.2 Registering the EN311
4.2 Registering the EN311
This section describes how to register the EN311 when it is connected to and used with
the S controller.
Supplemental Remarks
• Before registering the EN311, you should register the system, station, and controller folders
of the target with the engineering tool.
• You should register the EN311 before writing any programs using the EN311.
4
There are some actual examples in the following sections. It is assumed that
System(EN311TST) folder, Station(EN311TST) folder, and Controller(S3-TEST) folder
are allocated within the engineering tool beforehand.
For the details of folder allocations, refer to the engineering tool documentation.
(1) Starting the registration
Select "Station(EN311TST)" from the "Product View" of the engineering tool, then
double-click "Station Configuration" on the file list shown right. Then the
Configuration Editor starts and "Hardware Configuration" screen appears.
Double-click here
It is assumed that the main unit has been selected.
Main Unit ••• BU742 : model 3000 Main Unit (Single)
Station Bus: 2 slots, G3-I/O: 9 slots
6F8C0904
33
Chapter 4 Preparing for Operation (Software)
(2) Connecting the module - Example 1
Connect the EN311 to Slot 6 on the main unit.
Select "Main Unit" and select "Connections in module". Double-click an empty slot to
display the Module List Menu.
4
Double-click here
34
Ethernet module User’s Manual
4.2 Registering the EN311
(3) Connecting the module - Example 2
Choose and highlight "EN311" from the Module List Menu, and click the "Connect(C)"
button.
"EN311" appears on Slot 6 of "Hardware Configuration" as shown in the following
page. "EN311" appears in red at that time, because the registration data has not
been saved yet.
Similarly, register the EN311 to Slot 7.
4
Choose "EN311"
Click "Connect(C)" button
6F8C0904
35
Chapter 4 Preparing for Operation (Software)
(4) Saving the registration data
Choose the "File" menu and then the "Save As" command from the configuration
editor menu to save the EN311 registration data. The registration data is saved and
the module name becomes black.
4
If this is in red, it has not been
registered yet.
If it is in black, it has been registered.
The registration of the EN311 has been completed.
36
Ethernet module User’s Manual
4.3 EN311 Operation Modes and Station Statuses
4.3 EN311 Operation Modes and Station Statuses
The EN311 operation modes and its station statuses are described here. The method for
controlling the operation modes is described in section 4.8, "Operating Mode Control
Requests". The EN311 operation modes include the following:
(1) Initialize mode
• Indicates that the EN311 is processing the reset.
• When the reset processing is completed, the mode is changed to "Standby
mode".
• If the reset processing is completed abnormally (such as by error in self-testing
etc.), the mode is changed to "Down mode".
• During Initialize mode, the instructions from the S controller user program cannot
be executed.
(2) Standby mode
• In this mode, the EN311 parameters can be set for the EN311.
• The Standby mode is the only the only mode in which the EN311 parameters can
be set.
• After setting the EN311 parameter, the mode can be changed to "Run mode" by
the S controller user program instruction.
(3) Run mode
• In this mode, the EN311 can perform transmission with other nodes.
• The mode can be changed to "Standby mode" by the S controller user program
instruction.
• In Run mode, whether the computer link/PC link procedure can be transmitted or
not and whether the socket interface can be transmitted or not can be specified
separately.
(4) Down mode
• Indicates that the EN311 is placed in unrecoverable abnormal condition.
• Once the mode is changed to the Down mode, it can be recovered only by turning
on the power again or using the resetting switch.
• The details of the Down mode can be checked by means of the data on the I/F
buffer memory with the S controller.
(Refer to "7.2 Down Information".)
Figure 4-2 shows the EN311 mode transition diagram. The EN311 operation modes are
indicated in rectangular frames. The operation modes shown inside the boldface frames
can be controlled by the user program. The thick arrows in the diagram indicate the
requests which can be specified by the user program.
6F8C0904
37
4
Chapter 4 Preparing for Operation (Software)
Power down
Self-check completed normally
Initialize
Standby
Reset request
Initialization
Turning on the power
completed
again/reset switch
abnormally
4
Run request
Standby request
Unrecoverable error occurred
Down
Run
Unrecoverable error occurred
Figure 4-2 EN311 Mode Transition
The EN311's operation statuses (station statuses) are allocated to the special registers
of the S controller I/F memory. The S controller reads the station statuses from the
EN311. Each bit of the station status has the following meaning. Note that in judging
whether the mode is Initialize, Run or Standby, view the value as a register.
• Station status area address (word address) ••• 16#7EFF(Decimal: 32511)
• Station status format
F
E
DOWN
D
C
B
A
9
8
7
6
0
0
0
0
0
0
STBY
INZ
Bit
5
4
3
2
1
0
0
0
MTEN
RUN
0
TEST
STEN
Name
1
0
F
DOWN: Down mode
Down mode
Other than the Down
mode
E
INZ: Initializing mode
Initialization being
processed
Initialization processing
complete
D
STBY: Standby mode
Standby mode
Other than the Standby
mode
C
RUN: Run mode
Run mode
Other than the Run mode
5
MTEN: Message transmission
Permit
Inhibit
4
STEN: Socket I/F transmission
Permit
Inhibit
0
TEST: Test
Test function being
executed
Test function complete or
in waiting request state
• EN311 operation modes and station statuses
EN311 Mode
38
Station Status
Initialization being processed (Power-On, Reset request, Reset SW)
4000H
Standby mode (Initialization processing completed normally)
2000H
Run mode: Message transmission permit
1020H
Run mode: Socket I/F transmission permit
1010H
Run mode: Message transmission; socket I/F transmission permit
1030H
Ethernet module User’s Manual
4.4 Function Block Specifications for EN311 Control
4.4 Function Block Specifications for EN311 Control
Before preparing for operations of the EN311 software, this section provides an overview
of the following instructions used to control the EN311 from the S controller user
program.
• USEND_T function block
• URCV_T function block
EN311 module control and transmission control (PC link protocol transmission and
socket interface transmission) are performed solely using above function. Refer to "The
V Series LD/FBD/SFC Instructions Manual" for MREAD instruction. See the individual
items described in the section 4.5, "EN311 Reset (Reset Request)" or after for details on
the actual requests sent to the EN311.
4.4.1
USED_T function block
Communication FB
Socket Communication - Send
Diagram
Execution request
Transmit com mand
USEND_T
REQ
DONE
Completion output
CMD
Error
Transmit data
P
Number of data
words transm itted
N
Modification
ERROR
STATUS
Socket number or error status
EN input
Put into pulses
Index modification
−
−
−
(1) Parameters
Parameter Operand
Input
Output
Type
Constant
Description
REQ
Boolean
CMD
Pointer
−
Request command
P
Pointer
−
Beginning address of the transmit
data storage area
N
Unsigned integer
DONE
Boolean
−
Completion output
ERROR Boolean
−
Error
STATU
S
−
Socket number or error status
Integer
Scope
Execution request
Number of data words transmitted 1 to
1000W
Supplementary information on input parameters
Data structure of request command
F
CMD
Destination EN311 module slot number
CMD+1
Socket service command
CMD+2
Request parameter
(Details differ according to services.)
:
6F8C0904
0
39
4
Chapter 4 Preparing for Operation (Software)
(2) Functions
• For the EN311, this is the function block to request module control, TCP/IP protocol,
and/or UDP/IP protocol communication.
• When an execution request(REQ) becomes TRUE(ON) from FALSE(OFF), the N
number of transmit data words will be routed from transmission data P with the
contents of the specified transmission command (CMD).
• The number of transmission data words, 1-1000 can be specified (It depends on the
socket service command).
• When the transmission completes, the completion output(DONE) becomes TRUE(ON)
for one scanning time and the corresponding socket number is displayed on the
STATUS.
4
• When the transmission ends with an error, the error(ERROR) becomes TRUE(ON) for
one scanning time and the error status(error description) is displayed on the STATUS.
The completion output (DONE) does not turn ON if an error occurs.
Socket Service Commands used by USED_T
Description
40
Command
Reset request
16#0311
Parameter setup request
16#0312
Operating mode control request
16#0313
Remote station verification request
16#0314
Time set request
16#0318
Router IP address set request
16#0319
PC link (Register write request)
16#0321
UDP open request
16#0331
UDP send request/Broadcast transmission
16#0332
UDP close request
16#0334
TCP open request
16#0335
TCP send request
16#0337
TCP close request
16#0339
Ethernet module User’s Manual
4.4 Function Block Specifications for EN311 Control
4.4.2
URCV_T function block
Communication FB
Socket Communication - Send
Diagram
Execution request
Transmit com mand
URCV_T
REQ
DONE
Completion output
CMD
Error
Transmit data
P
Number of data
words transm itted
N
Modification
ERROR
STATUS
Socket number or error status
4
EN input
Put into pulses
Index modification
−
−
−
(1) Parameters
Parameter Operand
Input
Output
Type
Constant
Description
REQ
Boolean
CMD
Pointer
−
Request command
P
Pointer
−
Beginning address of the transmit
data storage area
N
Unsigned integer
DONE
Boolean
−
Completion output
ERROR Boolean
−
Error
STATU
S
−
Socket number or error status
Integer
Scope
Execution request
Number of data words transmitted 1 to
1001W
Supplementary information on input parameters
Data structure of request command
F
CMD
Destination EN311 module slot number
CMD+1
Socket service command
CMD+2
Request parameter
(Details differ according to services.)
:
0
(2) Functions
• For the EN311, this is the function block to request module control, TCP/IP protocol,
and/or UDP/IP protocol communication.
• When an execution request(REQ) becomes TRUE(ON) from FALSE(OFF), the N
number of received data words will be routed from receive data P with the contents of
the specified transmission command (CMD).
• The number of received data words, 1-1001 can be specified (It depends on the
socket service command).
• When the reception completes, the completion output(DONE) becomes TRUE(ON) for
one scanning time and the corresponding socket number is displayed on the STATUS.
6F8C0904
41
Chapter 4 Preparing for Operation (Software)
• When the reception ends with an error, the error(ERROR) becomes TRUE(ON) for
one scanning time and the error status(error description) is displayed on the STATUS.
The completion output (DONE) does not turn ON if an error occurs.
Socket Service Commands used by URCV_T
Description
4
4.4.3
Command
RAS information readout
16#0315
PC link (Register read request)
16#0321
UDP receive request/Broadcast reception
16#0333
TCP receive request
16#0338
Socket Service Commands List
The following is the list of socket service commands used by the USEND_T/URCV_T
function block for the EN311. For further information about each request code, see the
section indicated in this table.
Table 4-1 Request Codes for EN311
Command name/Code
42
Function
Instruction word
Type
Section
Reset request
/16#0311
Resets the module.
USEND_T
(1)
4.3
Parameter setup request
/16#0312
Sets up the EN311 parameters.
USEND_T
(1)
4.4
Operating mode control
request
/16#0313
Sets the operating mode.
USEND_T
(1)
4.5
Remote station
verification request
/16#0314
Verifies the existence of another
node on the network.
USEND_T
(1)
7.3
RAS information readout
request
/16#0315
Reads out the module RAS
information.
URCV_T
(1)
7.5
Time set request
/16#0318
Sets the module internal clock
Time information for event trace
USEND_T
(1)
7.4
Register read request
(PC link function)
/16#0321
Reads register data from remote
station into registers in the local
station.
URCV_T
(2)
5.4
Register write request
(PC link function)
/16#0321
Writes register data from the local
station to registers in remote
station.
USEND_T
(2)
5.3
UDP open request
/16#0331
Opens a UDP socket.
USEND_T
(3)
6.4.1
UDP send request
/16#0332
Sends data from a UDP socket.
USEND_T
(3)
6.4.2
UDP receive request
/16#0333
Reads data received by a UDP
socket.
URCV_T
(3)
6.4.3
UDP close request
/16#0334
Closes (terminates) an UDO
socket.
USEND_T
(3)
6.4.4
TCP open request
/16#0335
Opens a TCP socket.
USEND_T
(3)
6.4.5
TCP send request
/16#0337
Sends data from a TCP socket.
USEND_T
(3)
6.4.6
TCP receive request
/16#0338
Reads data received by a TCP
socket.
URCV_T
(3)
6.4.7
TCP close request
/16#0339
Closes (terminates) a TCP
socket.
USEND_T
(3)
6.4.8
Ethernet module User’s Manual
4.4 Function Block Specifications for EN311 Control
Considerations
(1) Types (1) - (3) are command classes. Class 1 is module control, Class 2 is PC link
protocol transmission, and Class 3 is socket interface transmission.
(2) For a single EN311 module, it is not possible to request another Class 1 command by
entering a start up signal to execution request (REQ) while the EN311 is executing a
Class 1 command. If such a request is issued, the command issued later will be
ignored. This is also true for class (2) CMDs.
(3) For a single EN311 module, when requesting a Class 3 command, it is not possible
to request another Class 3 command while the EN311 is executing a Class 3
command. If such a request is issued, the command issued later will be ignored.
4
(4) There are eight sockets, and each can independently accept and execute Class 3
commands.
(5) If the S controller switches from the run to the halt state and then back to the run
state while a command is being requested for the EN311, it is possible that the
EN311 could execute the request issued immediately prior to the halt state. This
section describes the handling required after returning to the run state.
• The S controller should always set the EN311 to standby mode using the operating mode control request after it returns to run mode.
• Enter the standby mode first, then initialize the EN311 using the reset request.
This causes all the requests issued to the EN311 to be discarded, computer link/
PC link protocol transmissions to be stopped, and the socket interface to be initialized (i.e. set to the closed state).
• The same status as in the method above can be obtained by initializing the EN311
with the Reset button while the S controller is halting.
6F8C0904
43
Chapter 4 Preparing for Operation (Software)
4.4.4
Error Status List
The status right after the completion of the USEND_T or URCV_T execution is displayed
at STATUS. If the error status is 16#EC**(-50**), it means that the error was detected on
the CPU module side. If the error status is 16#EB**, it means that the error was detected
on the EN311 side.
Table 4-2 Error Status Description
STATUS
4
Name
Description
0
Normal
completion
-5001
(16#EC77)
Parameter error • Occurs if a slot number other than 03xxH is specified.
• Occurs if a command number not existed in the USEND_T
function block is specified.
• Occurs if a value other than 1 to 8 is specified for the socket
identifier.
• Occurs if an incorrect parameter is specified in a RAS information readout request.
-5002
(16#EC76)
Transmission
complete
timeout
• Occurs if an S3 internal timer times out before the EN311
reply while one of the following command is issued.
UDP open, UDP send, UDP close, TCP send, TCP close
-5051
(16#EC45)
Register
specification
error
• Occurs if a register type not available for local station(except D and SW)is specified in a register read
request.
-5071
(16#EC31)
Register
specification
error
• Occurs if a register type not available for remote station(except D and SW)is specified in a register write
request.
-5052
(16#EC44)
Response
timeout
• Occurs if a response is not received within the specified
time from a remote station in a register read/write request.
-5054
(16#EC42)
Memory write
protect error
• Occurs if an attempt to store the SW register into the storage area of the local reception data is made in the register
read request.
-5074
(16#EC2E)
Memory write
protect error
• Occurs if an attempt to store the SW register into the storage area of the remote reception data is made in the register write request.
-5057
(16#EC3F)
No send
channel (CH)
• Occurs if the EN311 is not installed on the specified slot.
-5058
Reserved
-5059
(16#EC3D)
Incorrect
transmission
word count
• Occurs if either 0 words or 1001 or more words were specified for a UDC/TCP socket send/receive request.
-5060
(16#EC3C)
Boundary error
• Occurs if the area specified as the data storage does not
exist on the S3 in one of the following commands.
RAS information readout, UDP send/receive, TCP send/
receive, register read/write
-5080
(16#EC28)
Boundary error
• Occurs if the area specified as the data storage does not
exist on the S3 in the following command(occurs in the
remote station). Register write
-5062
(16#EC3A)
No I/O
response
• Occurs if a command was issued when the S3 cannot
access the EN311.
-5064
(16#EC38)
Send data
capacity
exceeded
• Occurs if a command was repeatedly sent with rapid cycle
to an non-existent remote station.
-5050
(16#EC46)
Error during
reset
• Occurs if another command is issued while a reset has
been requested.
Transmission
error
• Occurs if the EN311 returns an error response.
For more information, see Table 4-3.
0BxxH
44
Ethernet module User’s Manual
4.4 Function Block Specifications for EN311 Control
Table 4-3 Detailed Information
Error
Code
Description
Normal complete
01H
Local station fault
02H
The local station is in down mode
Local station standby
03H
In standby mode, data transmission was requested.
Timeout
20H
Timeout occurred during TCP open/receive processing, or
during UDP receive processing.
Length error
30H
Incorrect send data length
Station mode error
40H
One of the following requests was issued in a mode other
than standby mode:
a. Parameter setup, b. MAC address setup, c. Reset
MAC/IP not set up
50H
Occurs if the MAC address or IP address is not set up.
Transmission
prohibited state
60H
• Occurs if a PC link request was issued in run mode in the
message transmission prohibited state.
4
• Occurs if a socket open, close, send, or receive request
is issued in run mode in the socket interface transmission
prohibited state.
Format error
70H
Occurs when there is a format error in the request text.
71H
Port number error/IP address error
72H
Request code error
73H
Time setting: Year
74H
Time setting: Month
75H
Time setting: Day
76H
Time setting: Hour
77H
Time setting: Minute
78H
Time setting: Second
Already opened
80H
Occurs if an open request is issued for an already open
socket.
Unopened
81H
• Occurs if send, receive, or close request is issued for an
unopened socket.
• Occurs if transmitted to/received by the socket which has
received a close request from the remote station with the
TCP socket.
Incorrect socket
identifier
82H
Occurs if the socket identifier is out of range (1 to 8).
Incorrect control
request specification
83H
Occurs if a request that was prohibited by an operating
mode control request is issued.
• Occurs if a run request is issued in run mode.
• Occurs if a standby request is issued in standby mode.
• Occurs if a run request and a standby request are issued
at the same time.
6F8C0904
45
Chapter 4 Preparing for Operation (Software)
Table 4-3 Detailed Information
Error
LAN controller driver
error
Code
Description
90H
Occurs if the setting of the local station IP address/port
number in the area reserved for transmission fails.
91H
• Error in the TCP or UDP protocol (such as a transmission
phase error)
• Due to the remote-station down, the TCP socket made
the request to send to the socket where the NOACK bit of
the socket status is ON.
92H
4
• Occurs if the setting of the remote station IP address in
the remote station information area (the NETDATA table)
fails.
• Occurs if the remote station IP address network address
differs from the local station IP address network address.
Memory pool allocation A0H
failure
Occurs if the EN311 internal OS fails to allocate memory.
Port 2 task start failure
Occurs if computer link/PC link socket identifier acquisition
fails.
A1H
Broadcast specification A2H
error
Occurs if the remote IP address is broadcasted on a remote
station verification request.
MAC address
specification error
B0H
BCC error
B1H
Occurs if an error occurs after address saving on a MAC
setup request.
Insufficient resources
error
C0H
• Occurs if a transmission is repeated with cycle less than
100 ms to a non-existent remote station for UDP send/
PC link transmission.
• The UDP socket made the request to send when the
buffer in the EN311 was full without taking the received
data over to the S3 side.
Error in (number of
words) receive request
from S3
C1H
The size specified by the user program is less than the size
of data, which EN311 has received.
C2H
The size specified by the user program is out of the range
(1-1000 words).
Send buffer full
C3H
In the TCP socket transmission, the remaining space of the
send buffer of the corresponding socket to which the send
request data is stored is less than the data size of send
request.
Remote station window C4H
size is too small
46
In the TCP socket transmission, the window size of the
remote station ACK is smaller than the data size of send
request.
Ethernet module User’s Manual
4.5 EN311 Reset (Reset Request)
4.5 EN311 Reset (Reset Request)
This section describes the EN311 reset procedures. There are three ways to reset an
EN311 as follows:
(1) S controller power on
(2) Reset switch
(3) Reset by a user program running on the S controller
In EN311 reset processing, when one of the above resets occurs, the module first
performs the self-check described below. If the self-check completes normally, the
module switches to standby mode (the parameter setting wait state), thus completing the
reset sequence. If an error is discovered during the self-check, the module goes to the
down state.
• EN311 module self check items
• System ROM check
• System RAM check
• LAN controller check
• Memory check for S controller interface
See section 4.3, "EN311 Operation Modes and Station Statuses", for more information
on the EN311 operating modes.
(1) S controller power on
When power is applied to the S controller, power is also applied to the EN311, and
the EN311 performs its reset processing sequence.
(2) Reset switch
EN311 reset processing is performed when the EN311 reset switch is pressed. This
technique should be used when it is desirable to reset the EN311 without stopping
the S controller.
Usage Recommendations
• When pressing the reset switch, use a pointed object, such as a ballpoint pen, to press the
switch through the hole in the front panels. Be sure to press the switch all the way down.
6F8C0904
47
4
Chapter 4 Preparing for Operation (Software)
(3) Reset request from the S controller
It is possible to initiate reset processing from user programs on the S controller. This
section describes the format of the reset processing instruction.
Reset request (using the USEND_T instruction)
The user program requests an initialization to the EN311.
(a) Request command structure and error status
<Request command>
F
4
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0311)
<Error status>
F
STATUS
0
=0: Normal completion, ≠ 0: Error status
Error status examples
Error status number
Description
-5001(16#EC77)
Command type error
-5050(16#EC46)
Module error/Initialization in progress
(b) Considerations
• A request can be issued if the EN311 is in run mode, standby mode, or down
mode.
• For TCP open request, TCP receive request, or UDP receive request, if you
use the request with unrestraint wait, issue the reset request after changing
the operation mode to the standby mode.
48
Ethernet module User’s Manual
4.6 Parameter Setup Request
4.6 Parameter Setup Request
This section describes the procedure for EN311 parameter setup in the EN311 from an S
controller user program. The EN311 parameters consist of the following:
(1) Local station IP address
(2) UDP port number for computer link/PC link transmission
Here we first describe the IP address, subnet mask, and port number, which are the
parameters required for TCP/IP and UDP/IP transmission.
(1) IP address
The IP address is the address that specifies a particular node (station) when
transmitted data using the IP (Internet protocol). Therefore IP addresses must be set
and managed so that they are not duplicated. The following presents an overview of
IP addresses.
(a) IP address format
An address consists of a network address and a host address. The network
address is an address that specifies a particular network, and the host address is
an address that specifies a particular node (station) on that network. The same
network address must be assigned to all nodes (stations) on the same (i.e., any
given) network.
An IP address is a 32-bit data item. IP addresses are written as the decimal
values of each byte in the 32-bit datum, with the decimal values separated by
dots.
Example:11000000 00000000 00000000 00000001 → 192.0.0.1
IP addresses are divided into five classes, A through C, according to how many
bits in the 32-bit value are used as the network address (The networking
standards also define classes D and E, but the EN311 does not support them).
Figure 4-3 shows the classes A though C.
0
8
Class A
0
Class B
1 0
Class C
1 1 0
16
24
31
Host: 24 bits
Network: 7 bits
↑127 values
↑16,777,214 values
Network: 14 bits
↑16384 values
Host: 16 bits
↑65534 values
Network: 21 bits
↑2,097,152 values
Host: 8 bits
↑254 values
Figure 4-3 IP Address Class Divisions
In this system, networks with a large number of connected nodes use class A addresses
and networks with s small number of connected nodes use class C addresses. Class B
addresses are used for networks that fall between classes A and C. Expressed in
decimal, the first byte of the class A through C networks will be: 0 to 127 for class A, 128
to 191 for class B, and 192 to 223 for class C.
6F8C0904
49
4
Chapter 4 Preparing for Operation (Software)
(b) IP address acquisition
Taking future uses into account, we strongly recommend acquiring an official IP
address.
(c) Notes on IP addresses
The following IP addresses cannot be used with the EN311, both for the local
station and for remote station addresses.
• Addresses starting with 127 (7FH).
• Addresses in which the network address is all zeros or all ones.
• Addresses in which the host address is all zeros or all ones.
4
(d) Broadcast addresses
The only broadcast address that can be used with the EN311 is 255.255.255.255
(FF.FF.FF.FF).
The broadcast address 0.0.0.0 used on some UNIX systems (4.2 BSD) cannot
be used.
UNIX is an operating system used on engineering workstations (EWS) and other
computers. There are several versions of UNIX, including ones developed by
AT&T Bell Laboratories Inc., and ones developed by the University of California
at Berkeley. In particular, 4.2 BSD is a version developed at Berkeley.
(2) Subnets and the subnet mask
One technique for managing a network with a large number of nodes (stations) is to
divide that network into multiple subnets. A subnet operates by taking some number
of bits in the host address of the IP address for each class, and using those bits as a
subnetwork address. This allows the installation to operate the network internally as
multiple subnetworks, while the network is recognized externally as a single network.
The subnet mask is used to determine how many bits of the host address to allocate
as the subnet address. In the subnet mask, the network address field and the
subnetwork address field are set to 1 and the remaining field (the subnet host
address field) is set to 0.
Example:When a subnetwork address field of 12 bits is used in a class A IP address.
1111 1111 1111 1111 1111 0000 0000 0000 (Hexadecimal notation: FFFFF000)
Network
address
field
Subnetwork
address field
Host
address field
When a subnet mask is used, all nodes (stations) on the subnetwork must use the same
subnet mask. In the EN311, the user cannot set the subnet mask. The subnet masks
(with the network address field filled with ones) for each class are generated
automatically as shown in Table 4-4 from the specified IP address.
Table 4-4 Relationship between the Local IP Address and the Generated Subnet
Mask on the EN311
50
Local IP Address
Subnet mask
Class A
255.0.0.0 (FF000000)
Class B
255.255.0.0 (FFFF0000)
Class C
255.255.255.0 (FFFFFF00)
Ethernet module User’s Manual
4.6 Parameter Setup Request
Usage Recommendations
• The EN311 does not allow the user to set the subnet mask. Therefore the EN311 cannot be
used in systems that operate a subnetwork.
(3) Port number
An IP address identifies a particular node (station) on a network. However, since, on
any given node, there will be multiple applications using TCP/IP or UDP/IP to
communicate with applications on other nodes, the question of to which application
the data should be passed arises.
UDP ports have the role of acting as the point of contact between UDP and
applications that transfer data using UDP. UDP ports are managed using port
numbers. In the same manner, TCP uses TCP ports.
The combination of a port number and an IP address is called a socket. The EN311
transmits data to or from other nodes using these sockets in the computer link
protocol, the PC link protocol, and in socket interface transmission.
The range of port numbers that can be used with the EN311 is from 1024 to 65535,
for both TCP and UDP. However, note that the same port number cannot be used for
both TCP and UDP on the EN311. This is because UNIX allocates port numbers 1 to
1023 for standard services.
The following section describes the format of the parameter setup request.
(4) Parameter setup request (using the USEND_T instruction)
(a) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0312)
CMD+2
CMD+3
CMD+4
Local IP address
UDP PortNo.
UDP PortNo: The UDP port number used by the computer link/PC link protocol
transmission.
<Error status>
F
STATUS
0
=0: Normal completion, ≠ 0: Error status
Error status examples
Error status number
6F8C0904
Description
-5001(16#EC77)
Command type error
-5050(16#EC46)
Module error/Initialization in progress
2929(16#B71)
Port number error
51
4
Chapter 4 Preparing for Operation (Software)
(b) IP address setup procedure
For the address 133. 113. 90. 10
↑
↑
↑
↑
85H. 71H. 5AH. 0AH
F
87
0
CMD+2
85H
71H
CMD+3
5AH
0AH
(c) UDP port number for message transmission
As described in Chapter 1, UDP/IP is used for both computer link and PC link
protocol transmission, which are collectively referred to as message
transmission. These techniques use dedicated UDP sockets that are separate
from those used by socket interface transmission.
4
Set the port number to a value in the range 1024 to 65535 (because UNIX
allocates port numbers 1 to 1023 for standard services).
The UDP port number specified at CMD+4 is the UDP port number allocated for
message transmission (receive). The two port numbers following that port
number are automatically allocated for message transmission (send). If computer
link protocol/PC link protocol reception is performed directed at the message
transmission UDP port number specified at CMD+4, the EN311/S controller will
process the received data in the order received and send the result from one of
the message transmission send ports (See Figure 4-4).
EN311
Message transmission receive port
(Port number 2000)
Message transmission send port 1
Computer link/
PC link protocol transmission
Computer link protocol transmission
(Port number 2001)
Message transmission send port 2
PC link protocol transmission
(Port number 2002)
Figure 4-4 Relationship between Message Transmission Send and Receive Port
Numbers
(d) Considerations
• The UDP port numbers used for message transmission must not duplicate UDP
socket port numbers or TCP socket port numbers mentioned in the section on
socket interface transmission.
• If this request is issued when EN311 is in run mode or down mode, an error will
occur.
Run mode -
Error status: Station mode error (2880 = 16#B40)
Down mode -
Error status: Module error (5050 = 16#EC46)
• An error occurs if a UDP port number is set to a value outside the range 1024 to
65535.
Error status: Port number error (2929 = 16#B71)
52
Ethernet module User’s Manual
4.7 Router IP Address Setup Requests
4.7 Router IP Address Setup Requests
This section describes how to setup the router IP address from the S controller user
program.
The following is the format of the router IP address setup request.
Router IP address setup request
(using the USEND_T instruction)
The router IP address is setup for the EN311 in standby mode from the user program.
4
(1) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0319)
CMD+2
CMD+3
Router IP address
<Error status>
F
STATUS
0
=0: Normal completion, ≠ 0: Error status
Error status examples
Error status number
Description
-5001(16#EC77)
Command type error
-5050(16#EC46)
Module error/Initialization in progress
2880(16#B40)
Station mode error
2896(16#B50)
MAC/IP not set up
2929(16#B71)
IP address error
(2) IP address setup procedure
For the address 133. 113. 90. 250
↑
↑
↑
↑
85H. 71H. 5AH. FAH
F
6F8C0904
87
0
CMD+2
85H
71H
CMD+3
5AH
FAH
53
Chapter 4 Preparing for Operation (Software)
(3) Considerations
• The EN311 can be set in a run mode with "operation mode control request" without setting the router IP address. In this case, no routing will be done.
• If this request is issued when EN311 is in run mode or down mode, an error will
occur.
Run mode - Error status: Station mode error (2880 = 16#B40)
Down mode - Error status: Module error (5050 = 16#EC46)
• It is necessary to setup the local IP address to issue this request. If this request is
issued without setting the local IP address, the following error will occur:
Error status: MAC/IP not set up (2896 = 16#B50)
4
• The following error occurs if the network address part of the local IP address differs from the router IP address:
Error status: IP address error (2929 = 16#B71)
Usage Recommendations
• For transmissions in case of connecting the EN311 to general LAN via a router, it is recommended to use the TCP socket.
If you use the UDP socket, computer link, and/or PC link, make sure the reliability of transmission using the reception confirmation/retransmission from the user program side.
54
Ethernet module User’s Manual
4.8 Operating Mode Control Requests
4.8 Operating Mode Control Requests
This section describes the procedures for controlling the EN311 operating mode from
user programs on the S controller.
This section describes the operating mode control request instruction format.
Operating mode control request (using the USEND_T instruction)
This is a request from a user program that controls the EN311 operating mode.
(1) Request command structure and error status
4
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command(16#0313)
CMD+2
Specified information
<Error status>
F
STATUS
0
=0: Normal completion, ≠ 0: Error status
Error status examples
Error status number
Description
-5001(16#EC77)
Command type error
-5050(16#EC46)
Module error/Initialization in progress
2880(16#B40)
Station mode error
2896(16#B50)
MAC/IP not set up
2929(16#B71)
IP address error
(2) Specified information
F
E
0
0
D
C
B
A
9
8
7
6
0
0
0
0
0
0
STBY
6F8C0904
4
3
2
1
0
0
0
0
0
MTEN
RUN
Bit
5
Name
STEN
Purpose
D:
STBY (standby request)
Switches the EN311 from run mode to standby mode.
C:
RUN (run request)
Switches the EN311 from standby mode to run mode.
5:
MTEN (message
transmission enable/disable
request)
Computer link/PC link protocol transmission enable/prohibit
1: Enable, 0: Disable
4:
STEN (socket interface
transmission enable/disable
request)
Socket interface transmission enable/prohibit
1: Enable, 0: Disable
55
Chapter 4 Preparing for Operation (Software)
Examples: Standby request - 2000H
Run request - 1030H (Allows both message transmission and socket
interface transmission)
1010H (Allows socket interface transmission only)
1020H (Allows message transmission only)
(3) Considerations
• Values other than 1010H, 1020H, 1030H, and 2000H may not be specified for the
specified information.
Error status: Incorrect control request specification (2947 = 16#B83)
4
• Simultaneous run mode and standby mode requests (30x0H) cannot be executed.
Error status: Incorrect control request specification (2947 = 16#B83)
• A mode that has already been established cannot be requested. However,
requests that change the MTEN/STEN state within the same mode do not cause
an error.
Error status: Incorrect control request specification (2947 = 16#B83)
• No execution is possible in down mode.
Error status: Module error (5050 = 16#EC46)
• An error occurs if a control request that switches the EN311 to run mode is issued
without first setting the IP address.
Error status: MAC/IP not set up (2896 = 16#B50)
56
Ethernet module User’s Manual
4.9 Initialization Sample Program
4.9 Initialization Sample Program
This section describes the sample program that puts the EN311 into a run mode. After
the EN311 enters the run mode, it becomes possible to use the slave station functions of
the computer link/PC link.
Sample program specification: EN311 is installed into Slot 6 on the base.
Local IP address: 133.113.90.10
Local message transfer UDP port number: 2000
4
Start
7EFFH on DPRAM(word address)
Read the station status
N
Run mode ?
(If the result of ANDing with
1000H is 1000H)
Y
Issue the operating mode control
request(stand by)
Issue the reset request
Issue the parameter setup request
Issue the operating mode control
request(run)
Read the station status
N
Requested operating mode?
Y
End
6F8C0904
57
Chapter 4 Preparing for Operation (Software)
(1) Defining the variables
(*========================================
EN311 UDP SOCKET TEST PROGRAM (SEND)
========================================*)
VAR
4
SLOTW:
WORD; (* Slot specification *)
OPEN_READ:
BOOL;
MREAD_CMP:
BOOL;
MREAD_CMPX:
BOOL;
STN_STS:
WORD; (* Station status *)
STBY_REQ:
BOOL;
PARA_REQ:
BOOL;
CMP_MODE:
BOOL;
ERR_MODE:
BOOL;
STS_MODE:
INT; (* Standby request error status *)
CMP_RESET:
BOOL;
ERR_RESET:
BOOL;
STS_RESET:
INT; (* Reset request error status *)
CMP_PARA:
BOOL;
ERR_PARA:
BOOL;
STS_PARA:
INT; (* Parameter setup request error status *)
CMP_MODE2:
BOOL;
ERR_MODE2:
BOOL;
STS_MODE2:
INT; (* Run request error status *)
MREAD_CMP2:
BOOL;
NOT_RUN:
BOOL;
RUN1:
BOOL;
USEND_T_1:
USEND_T;
USEND_T_2:
USEND_T;
USEND_T_3:
USEND_T;
USEND_T_4:
USEND_T;
END_VAR
58
Ethernet module User’s Manual
4.9 Initialization Sample Program
(2) Program
(*STATION STATUS CHECK*
SLOTW
6
MOVE_WORD
ST
LD
OPEN_READ
MREAD
E
MREAD_CMP
( )
SLOTW
LD
T
4
16#7EFF
LD
TADDR
STN_STS
LD
P
1
LD
MREAD_CMP
STBY_REQ
N
PARA_REQ
MREAD_CMPX
( )
MREAD_CMPX
STN_STS
STN_STS
AND_WORD
LD
ST
16#1000
LD
STN_STS
EQ_WORD
STBY_REQ
(S)
LD
16#1000
LD
STN_STS
NE_WORD
LD
PARA_REQ
(S)
16#1000
LD
6F8C0904
59
Chapter 4 Preparing for Operation (Software)
(*OPERATION MODE CONTROL REQUEST "STANDBY"*)
%MW3.310
6
MOVE_WORD
ST
LD
%MW3.311
16#0313
MOVE_WORD
ST
LD
%MW3.312
16#2000
MOVE_WORD
LD
ST
STBY_REQ
USEND_T_1
4
CMP_MODE
(S)
USEND_T
REQ DONE
%MW3.310
LD
ERR_MODE
CMD
STS_MODE
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
N
(*RESET REQUEST*)
%MW3.300
6
MOVE_WORD
ST
LD
%MW3.301
16#0311
MOVE_WORD
ST
LD
USEND_T_2
CMP_MODE
USEND_T
REQ DONE
%MW3.300
LD
ERR_RESET
CMD
(S)
ERROR
STS_RESET
%MW3.290
LD
CMP_RESET
(S)
P
STATUS
ST
%MW3.290
LD
60
N
Ethernet module User’s Manual
4.9 Initialization Sample Program
(*PARAMETER SETTING REQUEST*)
%MW3.320
6
MOVE_WORD
ST
LD
%MW3.321
16#0312
MOVE_WORD
ST
LD
%MD3.322
16#85715A0A
MOVE_DWORD
ST
LD
%WM3.324
2000
MOVE_WORD
4
ST
LD
USEND_T_3
CMP_RESET
CMP_PARA
(S)
USEND_T
REQ DONE
PARA_REQ
%MW3.320
LD
ERR_PARA
CMD
STS_PARA
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
N
(*OPERATION MODE CONTROL REQUEST "RUN"*)
%MW3.310
6
MOVE_WORD
ST
LD
%MW3.311
16#0313
MOVE_WORD
ST
LD
%MW3.312
16#1010
MOVE_WORD
ST
LD
CMP_PARA
NOT_RUN
USEND_T_4
USEND_T
REQ DONE
%MW3.310
LD
ERR_MODE2
CMD
(S)
ERROR
STS_MODE2
%MW3.290
LD
CMP_MODE2
( )
P
STATUS
ST
%MW3.290
LD
6F8C0904
N
61
Chapter 4 Preparing for Operation (Software)
(*STATION STATUS CHECK*)
SLOTW
6
MOVE_WORD
ST
LD
CMP_MODE2
MREAD
E
MREAD_CMP2
( )
SLOTW
LD
T
16#7EFF
LD
4
TADDR
STN_STS
LD
P
1
LD
MREAD_CMP2
N
STN_STS
STN_STS
AND_WORD
LD
ST
16#1000
LD
STN_STS
NE_WORD
NOT_RUN
( )
LD
16#1000
LD
STN_STS
EQ_WORD
LD
RUN1
(S)
16#1000
LD
62
Ethernet module User’s Manual
Chapter 5 Computer Link Protocol and
the PC Link Protocol Transmission
This chapter describes the computer link protocol transmission from the host machine
and PC link protocol transmission with the S controllers(including S controller and T2N).
Caution
• Be sure to understand the contents of Chapter 5 thoroughly before writing programs. The
sample programs present basic examples of EN311 usage, and should be reviewed carefully before use in an actual system.
6F8C0904
63
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
5.1 Computer Link Protocol Transmission
Toshiba developed the T series computer link protocol transmission for use in controlling
the PROSEC-T Series programmable controllers. A host computer is able to used the
following functions using this procedure with respect to the S controller:
Function
5
Description
1 Reading the status
Reads the status form the S controller.
2 Reading the register/device
Reads the register/device data from the S controller
3 Writing the register/device
Writes the register/device data into the S controller
4 Reading the calendar/clock
Reads the calendar/clock data from the S controller
5 Writing the calendar/clock
Writes the calendar/clock data into the S controller
6 Test text
Performs the loop test between the host machine and the S
controller
When the S controller and the host computer communicate over an EN311 using the
computer link protocol, they use UDP/IP as the transmission protocol.
The host computer sends commands and data from its own UDP socket(Socket: A
combination of an IP address and a port number) to the EN311 message transmission
UDP socket.
When the S controller uses computer link protocol transmission, it simply performs the
following as described in Chapter 4:
• Parameter setup (IP address and the UDP port number for message transmission)
and
• Operating mode control (message transmission permission)
There is no need to create any special user programs on the S controller.
See the "T Series Computer Link Operation Manual" (UM-TS03***-E008)" for details on
the functions, specifications, and usage of T series computer link protocol transmission.
Usage Recommendations
• Since UDP/IP does not provide control functions to guaranteed communication reliability,
higher level protocols (such as retry) are required.
• No processing is performed if a computer link protocol transmission message is received at
any point other than a message transmission UDP socket.
64
Ethernet module User’s Manual
5.2 Sample Computer Link Protocol Program
5.2 Sample Computer Link Protocol Program
This section shows a sample program that runs on the host computer (a personal
computer or workstation) and that uses computer link protocol transmission.
This program issues a read/write request for 32 words from the start of the S controller D
registers.
Operating environment
• Hardware: Toshiba J-3100PV, PC/AT compatible
3Com Etherlink III (3C509/B)
• Software: PC-NFS Pro 1.1.1.0
Microsoft VisualC++ 1.0
5
Transfer parameters
• Local IP address:
133. 113. 98. 200
• Local UDP port number:
3001
• Remote IP address:
133. 113. 98. 10
• Remote UDP port number: 3001
6F8C0904
65
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
/**************************************************************************************************************/
/*
*/
/* SAMPLE.H
*/
/*
*/
/*
*/
/* Write/Read requests can be issued to other T3H units by modifying this definition file.
*/
/*
*/
/*
*/
/*
*/
/*
*/
/* (C) Copyright TOSHIBA Corporation 1995
/*
5
*/
All Rights Reserved
*/
/*
*/
/**************************************************************************************************************/
/*------------------------------*/
/* Define declarations
*/
/*------------------------------*/
#define MY_PORT 3001
66
/* Local port number
*/
#define DST_PORT 3001
/* Remote port number
*/
#define DST_IP
"133.113.98.10"
/* Remote IP address
*/
#define LOOP
10
/* Data send/receive execution counts
*/
#define DATASIZ
32
/* Data size
*/
/* Computer link function = word units
*/
#define RECVTOUT 30
/* RECVFROM timeout time
*/
#define REG_TYPE "D"
/* Register type
*/
#define REG_ADR
/* Register start address
*/
"0000"
Ethernet module User’s Manual
5.2 Sample Computer Link Protocol Program
/**************************************************************************************************************/
/*
*/
/* Sample program implementing register read/write using the computer link protocol
*/
/*
*/
/*
*/
/* This program is a sample program designed to verify the T3H Ethernet module computer
*/
/* link function.
*/
/* This program issues read/write requests to the specified T3H registers.
*/
/* Also note that registers in other stations can be accessed by modifying the SAMPLE.H
*/
/*
*/
definition file.
/*
*/
/*
*/
/*
*/
/* (C) Copyright TOSHIBA Corporation 1995
*/
/*
*/
All Rights Reserved
/*
*/
/**************************************************************************************************************/
/*---------------------------*/
/* Include declarations */
/*---------------------------*/
#define WIN31
/* Windows 3.1 application
*/
#define USECOMM
/* COMM API is required
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <sys\types.h>
#include <fcntl.h>
#include <errno.h>
#include <sys\socket.h>
#include <sys\timeb.h>
#include <time.h>
#include <sys\in.h>
#include <sys\netdb.h>
#include "sample.h"
6F8C0904
67
5
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
/*---------------------------------*/
/* Prototype declarations */
/*---------------------------------*/
int cl_send( int );
/* Register read/write processing
*/
/* Return status
*/
void main()
{
int ists;
int isdp ;
/* Socket identifier
*/
int i
/* Loop counter
*/
;
struct sockaddr_in Soc;
WORD wVersionRequested = (0,1);
/* WINSOC version number specification
*/
WSADATA WsaDtata ;
/* WINSOC data structure
*/
/* Initialization
*/
5
ists = 0 ;
/* Initial value setting
*/
/* Windows socket initialization
*/
ists = WSAStartup( wVersionRequested, &WsaDtata ) ;
if( ists == 0 ){
/* If normal return:
*/
isdp = socket(AF_INET, SOCK_DGRAM, 0);
/* Create socket (UDP)
*/
if( isdp != INVALID_SOCKET ){
/* If normal return:
*/
Soc.sin_addr.s_addr = 0 ;
/* Set local IP address
*/
Soc.sin_port = htons( MY_PORT );
/* Set local port number
*/
/* Execute bind processing
*/
Soc.sin_family = AF_INET;
ists = bind(isdp, (struct sockaddr *)&Soc, sizeof(Soc) );
if( ists != SOCKET_ERROR ){
/* If bind completed normally:
*/
/* Loop for the specified number of times
*/
ists = cl_send( isdp );
/* Register read/write processing
*/
if( ists != 0 )
/* If an error occurred in register
for( i = 0; i < LOOP; i++){
break ;
read/write processing
*/
/* Terminate processing
*/
/* Socket close processing
*/
/* Report WINSOC termination
*/
}
}
closesocket( isdp ) ;
}
}
WSACleanup() ;
}
68
Ethernet module User’s Manual
5.2 Sample Computer Link Protocol Program
/* SLW */
/**************************************************************************************************************/
/*
/*
*/
cl_send - Register read/write processing
*/
/*
*/
/**************************************************************************************************************/
/*
/*
*/
Calling sequence
*/
/*
/*
*/
cl_send();
*/
/*
*/
/* Arguments: Isdp : int
I : socket identifier
*/
/*
O : return status
*/
ists : int
/*
*/
/**************************************************************************************************************/
int cl_send( int Isdp )
{
int j, k
;
/* Loop counter
*/
int ists = 0 ;
/* Return status
*/
int iret
/* Return status
*/
/* Reception data length
*/
;
int ircvsiz ;
int isndsiz ;
/* Data length
*/
int icunt
;
/* Data setup index
*/
int idat
;
/* Temporary
*/
char csnd[ 1000 ] ;
/* Data send buffer
*/
char crcv[ 1000 ] ;
/* Data receive buffer
*/
fd_set ibits;
/* SELECT() bit mask
*/
struct timeval timeout;
/* SELECT() timer value
*/
struct sockaddr_in Snd, Rcv;
iret = -1 ;
memset( &Snd, 0x00, sizeof( Snd ) );
memset( &Rcv, 0x00, sizeof( Rcv ) );
memset( csnd, 0x00, sizeof( csnd ) );
/* Clear the send data buffer
*/
memset( crcv, 0x00, sizeof( crcv ) );
/* Clear the receive data buffer
*/
/* Set up the register write send data
*/
/* Set up the register write command
*/
/* Set the starting register number
*/
sprintf( &csnd[ 0 ], "(A01DW" ) ;
sprintf( &csnd[ strlen(csnd)], "%s", REG_TYPE );
sprintf( &csnd[ strlen(csnd) ], "%04s", REG_ADR );
sprintf( &csnd[ strlen( csnd) ], "," ) ;
idat = DATASIZ ;
/* Set the data count
*/
icunt = 0 ;
/* Comparison data storage index
*/
for( j = 0, k = 0; k < DATASIZ; k++ ){
/* Set register write data
*/
sprintf( &csnd[ strlen( csnd ) ], "%02d", idat ) ;
sprintf( &csnd[ strlen( csnd) ], "," ) ;
sprintf( &csnd[ strlen( csnd) ], "%04X", k ) ;
j=j+4;
sprintf( &csnd[ strlen( csnd) ], "," ) ;
j=j+1;
6F8C0904
69
5
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
icunt = icunt + 4 ;
}
sprintf( &csnd[ (strlen( csnd )) - 1], ")\r" ) ;
isndsiz = strlen( csnd );
/* Set the send data length
*/
Snd.sin_family = AF_INET;
Snd.sin_addr.s_addr = inet_addr( DST_IP );
/* Set the remote IP address
*/
Snd.sin_port = htons( DST_PORT );
/* Set the remote port number
*/
/* Send a register write request
*/
ists = sendto( Isdp, csnd, isndsiz, 0,
(struct sockaddr *)&Snd,sizeof( Snd ) );
if ( ists == isndsiz ){
5
memset(&ibits,0x00,sizeof(fd_set));
/* If the send length was OK
*/
/* Set the SELECT argument
*/
/* Set the BIT initial value
*/
timeout.tv_sec = RECVTOUT;
/* Set the timeout time
*/
FD_SET(Isdp,&ibits);
/* BIT setup
*/
ists = select( 1, &ibits,0,0,(struct timeval *)&timeout);
if(ists > 0){
/* f normal return:
*/
/* Register write response reception
*/
ists = recvfrom( Isdp, crcv, sizeof( crcv ), 0
,(struct sockaddr *)&Rcv, &ircvsiz) ;
if ( ists > 5 ){
if( crcv[ 4 ] == ’C’ && crcv[ 5 ] == ’E’ ||
crcv[ 4 ] == ’E’ && crcv[ 5 ] == ’E’ ){
return( -1 ) ;
/* Register write response error
*/
/* Register read request creation
*/
/* Register read command setup
*/
/* Set up the starting reg. no.
*/
}
memset( csnd, 0x00, sizeof( csnd ) ) ;
memset( crcv, 0x00, sizeof( crcv ) ) ;
sprintf( &csnd[ 0 ] , "(A01DR" );
sprintf( &csnd[ strlen(csnd)], "%s", REG_TYPE );
sprintf( &csnd[ strlen(csnd) ], "%04s", REG_ADR );
sprintf( &csnd[ strlen( csnd) ], "," ) ;
idat = DATASIZ ;
/* Set the data count
*/
/* Register read data length
*/
sprintf( &csnd[ strlen( csnd ) ], "%02d", idat ) ;
sprintf( &csnd[ strlen( csnd )], ")\r" ) ;
isndsiz = strlen(csnd) ;
/* Set up the data transmission length
*/
/* Send the register read command
*/
ists = sendto( Isdp, csnd, isndsiz, 0,
(struct sockaddr *)&Snd,sizeof( Snd ) );
if( ists == isndsiz ){
/* Set the BIT initial value
*/
memset(&ibits,0x00,sizeof(fd_set));
timeout.tv_sec = RECVTOUT;
/* Set the timeout time
*/
/* BIT setup
*/
/* If timeout and error:
*/
/* recvfrom timed out
*/
FD_SET(Isdp,&ibits);
ists = select( 1, &ibits,0,0,
(struct timeval *)&timeout);
if(ists <= 0){
return( -1 ) ;
70
Ethernet module User’s Manual
5.2 Sample Computer Link Protocol Program
}
/* Register read response reception
*/
ists = recvfrom( Isdp, crcv, sizeof( crcv ), 0
,(struct sockaddr *)&Rcv, &ircvsiz) ;
if ( ists > 5 ){
if( crcv[ 6 ] == ’C’ && crcv[ 7 ] == ’E’ ){
iret = -1 ;
/* Register read response error
*/
/* Register read response was normal
*/
}
else{
iret = 0 ;
}
}
5
}
}
}
}
return( iret ) ;
}
6F8C0904
71
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
5.3 PC Link Protocol Transmission (Data write)
The T series PC link protocol allows a local S controller to write register data to another S
controller/T3H/T2N on a network.
As is the case with the computer link protocol, the PC link protocol uses UDP/IP as its
transmission protocol.
The PC link main station uses a UDP socket for message transmission and transmits to
the slave station EN311 message transmission UDP socket. The user program that runs
on the main station is discussed later.
When this function is used on the PC link slave station, the S controller simply performs
the following as described in Chapter 4:
• Parameter setup and
• Operating mode control (message transmission permission)
5
There is no need to create any special user programs on the S controller.
Usage Recommendations
• Since UDP/IP does not provide control functions to guarantee communication reliability,
higher level protocols (such as retry) are required.
• No processing is performed if a PC link protocol transmission message is received at any
point other than a message transmission UDP socket.
72
Ethernet module User’s Manual
5.3 PC Link Protocol Transmission (Data write)
Register write request (using the USEND_T instruction)
The register data specified by the local station is written to the specified register on the
remote station.
(1) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0321)
CMD+2
DRID
Remote station register type code
CMD+3
DregNo
Remote station register number
CMD+4
TimeCnt
Timeout time
CMD+5
D-IP address: The input format is the same
as that for parameter setup
requests.
Remote station IP address
CMD+6
CMD+7
D-UDP PortNo
Remote station message
5
transmission UDP port number
• Local station register is specified by the input operand P of the USEND_T function
block.
• Transfer register size is specified by the input operand N of the USEND_T function
block.
Specify in words: 1 to 485 words
T register and C register: 1 to 323 words
<Error status>
F
STATUS
0
=0: Normal completion, ≠ 0: Error status
Error status examples
Error status number
Description
-5001(16#EC77)
Command type error
-5002(16#EC76)
Timeout (detected by the S controller)
2848(16#B20)
Timeout (detected by the EN311)
Supplemental Remarks
When the PC link is used and the EN311 detects an error, it means that the error occurred in the
local station if the highest bit of the error status shows 0 or it means that error occurred in the
remote station if the bit shows 1. Therefore, the error is in local station if the error status value is
positive or the error is in remote station if the value is negative.
6F8C0904
73
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
(2) Request command contents
• DRID(Remote station register type code)
... The remote station specifies the type of register to which transmission data is
written. The specifiable codes are listed in the following table.
If the remote station is an S controller, only the "D register: Type code 0004H"
can be specified. Any other registers can be specified only when the remote
station is PROSEC-T3H or T2N.
RID
5
Meaning
RID
Meaning
0000H
XW/YW registers
**05H
F register (0 - 32767)
*1
0001H
W register
**06H
F register (0 - 65535)
*2
0002H
LW register
0007H
T register
*3
0003H
RW register
0008H
C register
*3
0004H
D register
0009H
SW register
*1 Includes the expansion F registers (IC card). One bank has 8k words (0 to 8191).
05H
Bank number: 00H: Controller internal F register, F0000-F32767
01H-0FH: Expansion F register (IC card), F0000-F8191
*2 Includes the expansion F registers (IC card). One bank has 64k words (0 to 65535).
06H
Bank number: 00H: Controller internal F register, F0000-F32767
01H: Expansion F register (IC card), F0000-F65535
02H: Expansion F register (IC card), F0000-F57343
*3 The maximum transfer size is 323 words because the T and C registers hold data that
has flags attached. In case of T register, you cannot specify the ranges spreading
across the basic T (0-511) and expansion T (512-1023).
• DRegNo(Remote station register number)
.... The remote station specifies the start register to which the transmission data is
written.
• TimeCnt(Timeout value)
It is specified in 0.1-second unit to monitor the response time form the remote station.
F
E
0
CMD+4
0: User specified value is used (0.1 - 3276.7 seconds)
1: Default value (30 seconds)
74
Ethernet module User’s Manual
5.3 PC Link Protocol Transmission (Data write)
(3) Considerations
• The write operation is not synchronized with the remote station controller scan
operation. If synchronization is necessary, applications must perform synchronization, such as transferring the data to separate registers at the start of the controller scan.
• If the remote controller is PROSEC-T3H or T2N, write protection can be specified
for each register type on the local S controller by using the special coil settings. In
this case, a memory write protect error will occur. For more information about this,
refer to the PROSEC-T3H or T2N user's manual.
• When PC link transmission is used, if an application repeatedly transmits to a
nonexistent remote station at short intervals (less than 100 ms), an insufficient
resources error may occur. Applications should either stop transmitting to the nonexistent remote station or increase the interval between transmissions to prevent
this error.
5
6F8C0904
75
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
5.4 PC Link Protocol Transmission (Data read)
The T series PC link protocol allows an S controller to read register data from another S
controller/T3H/T2N on the network into its own registers.
As is the case with the computer link protocol, the PC link protocol uses UDP/IP as its
transmission protocol.
The PC link main station uses a UDP socket for message transmission and transmits to
the slave station EN311 message transmission UDP socket. The user program that runs
on the main station is discussed later.
When this function is used on the PC link slave station, the controller simply performs the
following as described in Chapter 4:
• Parameter setup and
• Operating mode control (message transmission permission)
5
There is no need to create any special user programs on the controller.
Usage Recommendations
• Since UDP/IP does not provide control functions to guarantee communication reliability,
higher level protocols (such as retry) are required.
• No processing is performed if a PC link protocol transmission message is received at any
point other than a message transmission UDP socket.
Register read request (using the URECV_T instruction)
The register data specified by the remote station is read to the specified register on the
local station.
(1) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0321)
CMD+2
DRID
Remote station register type code
CMD+3
DregNo
Remote station register number
CMD+4
TimeCnt
Timeout time
CMD+5
Remote station IP address
CMD+6
D-IP address: The input format is the same as
that for parameter setup
requests.
CMD+7
D-UDP PortNo
Remote station message
transmission UDP port number
• Local station register is specified by the input operand P of the URCV_T function
block.
• Transfer register size is specified by the input operand N of the URCV_T function.
Specify in words: 1 to 485 words
T register and C register: 1 to 323 words
76
Ethernet module User’s Manual
5.4 PC Link Protocol Transmission (Data read)
<Error status>
F
STATUS
0
=0: Normal completion, ≠ 0: Error status
Error status examples
Error status number
Description
-5001(16#EC77)
Command type error
-5002(16#EC76)
Timeout (detected by the S controller)
2848(16#B20)
Timeout (detected by the EN311)
Supplemental Remarks
When the PC link is used and the EN311 detects an error, it means that the error occurred in the
local station if the highest bit of the error status shows 0 or it means that error occurred in the
remote station if the bit shows 1. Therefore, the error is in local station if the error status value is
positive or the error is in remote station if the value is negative.
(2) Request command contents
• DRID(Remote station register type code)
... The remote station specifies the type of register to which transmission data is
written. The specifiable codes are listed in the following table.
If the remote station is an S controller, only the D register and SW register can
be specified. Any other registers can be specified only when the remote
station is PROSEC-T3H or T2N.
RID
Meaning
RID
Meaning
0000H
XW/YW registers
**05H
F register (0 - 32767)
*1
0001H
W register
**06H
F register (0 - 65535)
*2
0002H
LW register
0007H
T register
*3
0003H
RW register
0008H
C register
*3
0004H
D register
0009H
SW register
*1 Includes the expansion F registers (IC card). One bank has 8k words (0 to 8191).
F
8 7
0
05H
Bank num ber: 00H : C o ntroller internal F register, F0000-F32767
0 1 H -0 F H : E xp a n sio n F re g iste r (IC ca rd ), F 0 0 0 0 -F 8 1 9 1
*2 Includes the expansion F registers (IC card). One bank has 64k words (0 to 65535).
F
87
0
06H
Bank number: 00H: Controller internal F register, F0000-F32767
01H: Expansion F register (IC card), F0000-F65535
02H: Expansion F register (IC card), F0000-F57343
*3 The maximum transfer size is 323 words because the T and C registers hold data that
has flags attached. In case of T register, you cannot specify the ranges spreading
across the basic T (0-511) and expansion T (512-1023).
6F8C0904
77
5
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
• DRegNo(Remote station register number)
The remote station specifies the start register to which the transmission data is written.
• TimeCnt(Timeout value)
It is specified in 0.1-second unit to monitor the response time form the remote station.
F
E
0
CMD+4
0: User specified value is used (0.1 - 3276.7 seconds)
1: Default value (30 seconds)
(3) Considerations
5
• The read operation is not synchronized with the remote station controller scan
operation. If synchronization is necessary, applications must perform synchronization, such as transferring the data to separate registers at the start of the controller scan.
• When PC link transmission is used, if an application repeatedly transmits to a
nonexistent remote station at short intervals (less than 100 ms), an insufficient
resources error may occur. Applications should either stop transmitting to the nonexistent remote station or increase the interval between transmissions to prevent
this error.
78
Ethernet module User’s Manual
5.5 Sample PC Link Protocol Transmission Program
5.5 Sample PC Link Protocol Transmission Program
Sample program specification: Two EN311 modules, one in Slot 6 and another in Slot 7
on the base, are installed.
Slot 6
Local IP address: 133.113.93.10
Local message transfer UDP port number: 4002
Slot 7
Local IP address: 133.113.93.154
Local message transfer UDP port number: 4012
Number of words to be transferred: 100 words
Register write: Slot 6 (First: D register 500) Æ Slot 7 (First: D register 1000)
Register read: Slot 6 (First: D register 1500) ¨ Slot 7 (First: D register 1000)
5
Slot 6 side
Stop
Slot 7 side
Start
Start
Issue a reset request
Issue a reset request
Issue a parameter setup request
Issue a parameter setup request
Issue an operating mode control request
(run mode)
Issue an operating mode control request
(run mode)
Register write request
End
N
Normal completion?
Y
Register read request
Stop
N
Normal completion?
Y
End
6F8C0904
79
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
(1) Defining the variables
(*========================================
EN311 PC-LINK TEST PROGRAM
========================================*)
VAR
5
RST_START:
BOOL;
RST_CMP:
BOOL;
RST_ERR:
BOOL;
RST_STS:
INT; (* Slot 6 Reset request error status *)
RST_CMP2:
BOOL;
RST_ERR2:
BOOL;
RST_STS2:
INT; (* Slot 7 Reset request error status *)
CL_CMP:
BOOL;
CL_ERR:
BOOL;
CL_STS:
INT; (* Slot 6 Parameter setup request error status *)
CL_CMP2:
BOOL;
CL_ERR2:
BOOL;
CL_STS2:
INT; (* Slot 6 Run request error status *)
CL_CMP3:
BOOL;
CL_ERR3:
BOOL;
CL_STS3:
INT; (* Slot 7 Parameter setup request error status *)
CL_CMP4:
BOOL;
CL_ERR4:
BOOL;
CL_STS4:
INT; (* Slot 7 Run request error status *)
X_COMPLETE1:
BOOL;
TX_ERROR1:
BOOL;
TX_REQ1:
BOOL;
SND_STATUS1:
INT; (* Slot 6 Parameter setup request error status *)
RX_COMPLETE1:
BOOL;
RX_ERROR1:
BOOL;
RX_REQ1:
BOOL;
RCV_STATUS1:
INT; (* Slot 6 Register write request error status *)
USEND_T_1:
USEND_T;
USEND_T_2:
USEND_T;
USEND_T_3:
USEND_T;
USEND_T_4:
USEND_T;
USEND_T_5:
USEND_T;
USEND_T_6:
USEND_T;
USEND_T_7:
USEND_T;
URCV_T_1:
URCV_T;
END_VAR
80
Ethernet module User’s Manual
5.5 Sample PC Link Protocol Transmission Program
(2) Program
(*RESET REQUEST*)
%MW3.300
6
MOVE_UINT
ST
LD
%MW3.301
16#0311
MOVE_WORD
ST
LD
%MW3.302
7
MOVE_UINT
ST
LD
%MW3.303
16#0311
MOVE_WORD
ST
LD
5
(*SLOT6 RESET*)
RST_START
RST_CMP
USEND_T_1
RST_CMP
(S)
USEND_T
REQ DONE
%MW3.300
LD
RST_ERR
CMD
RST_STS
%MW3.300
LD
(S)
ERROR
P
STATUS
ST
TX_CONT
LD
N
(*SLOT7 RESET*)
RST_CMP
RST_CMP2
USEND_T_2
RST_CMP2
(S)
USEND_T
REQ DONE
%MW3.302
LD
RST_ERR2
CMD
RST_STS2
%MW3.302
LD
(S)
ERROR
P
STATUS
ST
TX_CONT
LD
6F8C0904
N
81
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
(*PARAMETER SETTING REQUEST SLOT6*)
%MW3.310
6
MOVE_UINT
ST
LD
%MW3.311
16#0312
MOVE_WORD
ST
LD
%MD3.312
16#8571_5D0A
MOVE_DWORD
ST
LD
%MW3.314
4002
MOVE_UINT
ST
LD
RST_CMP2
USEND_T_3
CL_CMP
5
CL_CMP
(S)
USEND_T
REQ DONE
%MW3.310
CL_ERR
CMD
LD
(S)
ERROR
CL_STS
%MW3.310
P
LD
ST
STATUS
TX_CONT
N
LD
(*MODE CONTROL REQUEST "RUN" SLOT6*)
%MW3.320
6
MOVE_UINT
ST
LD
%MW3.321
16#0313
MOVE_WORD
ST
LD
%MW3.322
16#1030
MOVE_WORD
ST
LD
CL_CMP
CL_CMP2
USEND_T_4
CL_CMP2
(S)
USEND_T
REQ DONE
%MW3.320
LD
CL_ERR2
CMD
CL_STS2
%MW3.320
LD
(S)
ERROR
P
STATUS
ST
TX_CONT
LD
82
N
Ethernet module User’s Manual
5.5 Sample PC Link Protocol Transmission Program
(*PARAMETER SETTING REQUEST SLOT7*)
%MW3.330
7
MOVE_UINT
ST
LD
%MW3.331
16#0312
MOVE_WORD
ST
LD
%MD3.332
16#8571_5D9A
MOVE_DWORD
ST
LD
%MW3.334
4012
MOVE_UINT
ST
LD
CL_CMP2
CL_CMP3
USEND_T_5
CL_CMP3
(S)
USEND_T
REQ DONE
%MW3.330
LD
CL_ERR3
CMD
(S)
ERROR
CL_STS3
%MW3.330
LD
5
P
STATUS
ST
TX_CONT
LD
N
(*MODE CONTROL REQUEST "RUN" SLOT7*)
%MW3.340
7
MOVE-UINT
ST
LD
%MW3.341
16#0313
MOVE_WORD
ST
LD
%MW3.342
16#1030
MOVE_WORD
ST
LD
CL_CMP3
CL_CMP4
USEND_T_6
CL_CMP4
(S)
USEND_T
REQ DONE
%MW3.340
LD
CL_ERR4
CMD
CL_STS4
%MW3.340
LD
(S)
ERROR
P
STATUS
ST
TX_CONT
LD
6F8C0904
N
83
Chapter 5 Computer Link Protocol and the PC Link Protocol Transmission
(*REGISTER WRITE REQUEST SLOT6 Æ SLO7*)
%MW3.350
6
MOVE_WORD
ST
LD
%MW3.351
16#0403
ST
LD
%MW3.352
16#0605
LD
16#0321
MOVE_WORD
LD
4
MOVE_UNIT
ST
LD
%MW3.353
16#0807
ST
ST
LD
%MW3.354
16#F9F8
ST
LD
%MD3.355
16#FBFA
ST
LD
%MW3.357
16#FDFC
MOVE_DWORD
LD
MOVE_UINT
%MW3.597
MOVE_WORD
LD
%MW3.358
16#FFFE
ST
%MW3.598
MOVE_WORD
MOVE_UINT
ST
%MW3.599
MOVE_WORD
ST
LD
CL_CMP4
ST
ST
LD
100
%MW3.596
MOVE_WORD
LD
4012
%MW3.503
ST
MOVE_UINT
16#8571_5D9A
%MW3.502
MOVE_WORD
LD
5
ST
MOVE_WORD
MOVE_UINT
100
%MW3.501
MOVE_WORD
ST
LD
1000
%MW3.500
16#0201
MOVE_UNIT
ST
LD
TX_REQ1
( )
TX_REQ1
USEND_T_7
TX_COMPLETE1
(S)
USEND_T
REQ DONE
%MW3.350
LD
TX-ERROR1
CMD
SND_STATUS1
%MW3.500
LD
(S)
ERROR
P
STATUS
ST
%MW3.358
LD
84
N
Ethernet module User’s Manual
5.5 Sample PC Link Protocol Transmission Program
(*REGISTER READ REQUEST SLOT6 ¨ SLOT7*)
%MW3.360
6
MOVE_UINT
ST
LD
%MW3.361
16#0321
MOVE_WORD
ST
LD
%MW3.362
4
MOVE_UINT
ST
LD
%MW3.363
1000
MOVE_UINT
ST
LD
%MW3.364
100
5
MOVE_UINT
ST
LD
%MD3.365
16#8571_5D9A
MOVE_DWORD
ST
LD
%MW3.367
4012
MOVE_UINT
ST
LD
%MW3.368
100
MOVE_UINT
ST
LD
TX_COMPLETE1
RX_REQ1
( )
URCV_T_1
RX_REQ1
RX-COMPLETE1
(S)
URCV_T
REQ DONE
%MW3.360
LD
RX_ERROR1
CMD
RCV_STATUS1
%MW3.1500
LD
(S)
ERROR
P
STATUS
ST
%MW3.368
LD
6F8C0904
N
85
Chapter 6 Socket Interface
Communication
This chapter describes the functions and positioning of the socket interface, and the
differences between the UDP socket interface and the TCP socket interface. Next t, this
chapter presents notes on using the EN311 socket interface and describes the
procedures for using this functionality.
Caution
• Make sure to understand the contents of this chapter thoroughly before writing programs that
use the EN311. The sample programs present basic examples of EN311 usage, and should
be reviewed carefully before using them in an actual system.
6F8C0904
87
Chapter 6 Socket Interface Communication
6.1 Overview
This section describes the functions and positioning of the socket interface, and the
differences between the UDP socket interface and the TCP socket interface.
(1) Positioning and functionality
The socket interface is a programming interface that allows user programs to use the
TCP/IP and UDP/IP functions. Socket interface communication is a communication
technique that has become standard on engineering workstations (EWS) and others.
The socket interface can be used for communication between host application
programs and user programs running on the S controller.
The EN311 socket interface provides eight sockets, and the communication protocol
(TCP/IP or UDP/IP) used with the remote destination can be specified for each
socket. User programs on the S controller use the USEND_T and URCV_T function
blocks to use the socket interface.
TCP/IP (Transmission Control Protocol/Internet Protocol)
UDP/IP (User Datagram Protocol/Internet Protocol)
6
Figure 6-1 shows the positioning of the socket interface.
EWS
S controller + EN311
Application program
S controller user program
System
USEND_T
calls
/URCV_T
S controller firmware
Socket interface
UDP/TCP
IP
CSMA/CD
OS(UNIX)
Socket interface
UDP/TCP
IP
CSMA/CD
Data send/receive
TCP
or
UDP
10BASE5/10BASE2
Figure 6-1 Positioning of the socket interface
(2) Differences between the UDP socket interface and the TCP socket interface
(a) UDP socket interface (See Figure 6-2.)
• Provides an in/out port (socket) for data communication between a transmission source node and a transmission destination node.
• Data for the transmission source and transmission destination (IP addresses
and port numbers) is specified in the send/receive data.
• Since the transmission source and transmission destination are specified in
each data item, a UDP socket can communicate with multiple remote UDP
sockets.
• The UDP socket interface provides no control functionality such as reception
verification using, e.g. ACK (acknowledge) responses, or retransmission processing to assure transmission reliability. Therefore, reliability must be
assured by higher level protocols implemented by user programs.
88
Ethernet module User’s Manual
6.1 Overview
Source node
Destination node
UDP socket
UDP socket
Data transmission
Reception verification
(only if implemented by the user
program)
Figure 6-2 UDP Sockets
(b) TCP socket interface (See Figure 6-3 and Figure 6-4.)
• In TCP communication, a pipe-like virtual communications line (connection)
is established between sockets on two nodes that are communicating (sending and receiving), and since the protocol handles control of reception verification and retransmission processing, it provides a highly reliable
communication.
• There are two methods for establishing a connection: passive open and
active open.
• In passive open, the local socket is put into a state in which it is waiting for a
request to establish a connection from another node. In active open, a
request is issued for the establishment of a connection with a socket in the
passive open state.
• When establishing a connection between two nodes, one node must first
open a socket in passive open mode, and the other node must perform an
active open on a local socket with respect to a remote socket that is in the
passive open state.
• Since the passive open socket node "provides" data transmission and other
services, it is called the "server."
• Since the active open socket node "requests" services, it is called the "client."
• A socket for which a connection has been established is unable to transfer
data with any other sockets unless that connection is first released.
• Since sockets are connected by connections, there is no need to specify the
transmission source or transmission destination with every data item transmitted.
Source node
Client
Destination node
TCP socket
TCP socket
Server
Connection
Active open
Data transmission
Passive open
Reception verification
Figure 6-3 TCP Socket (Connection)
6F8C0904
89
6
Chapter 6 Socket Interface Communication
Client side
(Active open)
Server side
(Passive open)
Closed state
Closed state
Connection establishment
request
Passive open
Active open
ACK (acknowledge) response
Connection established
6
Data transmission
Connection established
Data transmission
ACK (acknowledge) response
Data transmission
Data transmission
Data transmission
Data transmission
Data transmission
Close request
Data reception
Data reception
ACK (acknowledge) response
Close request
Close request
Closed state
Data reception
ACK (acknowledge) response
ACK (acknowledge) response
Data transmission
Data reception
Close request
Closed state
Figure 6-4 TCP Connection Communication Procedure (Outline)
90
Ethernet module User’s Manual
6.2 EN311 Socket Interface Usage Notes
6.2 EN311 Socket Interface Usage Notes
This section presents the points that require attention when using the socket interface on
the EN311.
6.2.1
Transmission/Reception Data Handling in UDP Socket Interface
(1) In UDP socket interface transmission, data sent in a single transmission is handled
by the receiving EN311 as a single data unit, and that data is transmitted to the S
controller in a batch operation by a receive request.
(2) The size of data units that can be handled by the EN311 socket interface in a single
operation is limited to a maximum of 2000 bytes. If the sending node sends a data
unit larger than 2000 bytes, the EN311 UDP socket interface will not be able to
receive that data. Users should determine the maximum size of the data units to be
sent or received at the system design stage.
(3) Transmitted data that exceeds 1472 bytes is divided (fragmented) into units of 1472
bytes. This is the limit of the length of packets (data units flowing on the network)
transmitted over the transmission line (see Figure 6-8).
For example, when transmitting 2000-byte data, the event shown in Figure 6-5 can
occur.
(a) The sending S controller user program requests a transmission of 2000 bytes.
(b) The transmitted data is divided into two fragments, A (with 1472 bytes) and B
(with 528 bytes).
(c) A and B are put onto the transmission line.
(d) The receiving side EN311 connects the received data A and B, restoring the
original data.
(e) The data is accepted by a receive request from the receiving side S controller for
2000 bytes of data and the data is stored in the specified register (see section
6.4.3, "UDP receive request (using the URECV_T instruction)").
(4) In the UDP socket interface, after the transmitted data is reassembled to the original
data it is passed to the user program and stored in the specified register (the
fragments A and B are reassembled to the original data by UDP/IP processing).
Sending
S controller
(1) Send request
2000 bytes
EN311
Transmission line
(2)
1472 bytes (A)
A
(3)
B
528 bytes (B)
EN311
Receiving
S controller
(5) Receive request
2000 bytes
(4)
A
B
Receive / Response
Figure 6-5 Transmission Data Fragmentation in the UDP Socket Interface
(5) In receive request programs from the S controller, set the size of reception data to a
value equal to or larger than that of the maximum size for the transmission data in a
single operation.
(6) Allocate an area one word larger than the transmitted data size as the S controller
register area that will hold the received data. As the result of a receive request,
information indicating the size of the transmitted data for the single operation plus the
data transmitted in the single operation will be stored in that area.
6F8C0904
91
6
Chapter 6 Socket Interface Communication
(7) If the size of the data transmitted in a single operation is larger than the size specified
for the received data in the receive request program, the receive request will end with
an error. The received data is stored in the reception data storage area of the S
controller, but from the beginning of the received data up to the reception data size
only. The excess data will not be transferred to the S controller nor remained on the
EN311 (it will be discarded).
6.2.2
Data handling and data segmentation in TCP socket interface
transmission and reception
(1) When using the TCP socket for data transmission, the data transmitted in a single
operation is handled by the receiving EN311 as one section of a continuous data
stream that comes from the sender (see Figure 6-6).
In this technique, the data is not handled as a single unit, as it is in UDP socket.
(2) The amount of data transmitted to the S controller from the TCP socket due to a S
controller receive request will vary depending on both the timing with which the S
controller issues the receive request, and the timing with which the data arrives at the
TCP socket.
6
(3) In the EN311 TCP socket, up to 5840 bytes of received data can be stored per
socket. Also note that up to 2000 bytes of data can be transferred to the S controller
for a single receive request.
For example, if the remote node sends 8000 bytes at a time, then the amount of
received data per socket may be either 800, 1600, 2400, 3200, or 4000 bytes. If the
amount of received data is 800 or 1600 bytes, those 800 or 1600 bytes can be
acquired by a receive request from the S controller. In cases where the amount of
received data is 2400, 3200, or 4000 bytes, 2000 bytes will be transferred by the first
receive request from the S controller, and the remaining 400, 1200, or 2000 bytes
can be transferred by issuing another receive request from the S controller.
(4) Therefore, to handle one unit of transmitted data as a single unit of data on the
receiving side as well, users must analyze both the data format (head/tail delimiting
codes, data sequencing) and the amount of data to be transmitted during the system
design stage, and provide routines to decode the transmitted data in the receiving S
controller user software.
(5) When the S controller user program issues the receive request, if amount of data
received by the socket is larger than the amount of data specified by the reception
data size, then only the reception data size of the received data from the beginning
will be transferred to the S controller.
The remaining data will be stored in the EN311. Issue another receive request to
receive the remaining data.
(6) When the S controller user program issues the receive request, if amount of data
received by the socket is smaller than the amount of data specified by the reception
data size, all of the received data is transferred to the S controller.
(7) Make sure to prepare the register area in which the transfer data is stored with
"receive data size + 1 word". If the register area in which the transferred data is
stored is smaller than this size, the transferred data will overwrite the contents of the
following registers.
92
Ethernet module User’s Manual
6.2 EN311 Socket Interface Usage Notes
EN311 TCP socket
Consecutive data (up to 5840 bytes)
S controller
Receive request
Data received so far
Max. 2000 bytes
Data received by the S controller
Transmitted data
Receive response
Transferred data
Figure 6-6 Handling of Transmitted/Received Data in the TCP Socket
(8) When the TCP socket interface is used, transmitted data is divided (fragmented) into
units of a size determined when the connection between the two sockets was
established. The upper limit of the fragment size is 1460 bytes. This is the limit of the
length of packets (data units flowing on the network) transmitted over the
transmission line (10BASE-5/2). See Figure 6-8.
For example, when transmitting 2000-byte data, the event shown in Figure 6-7 can
occur. The largest segment size that can be received in this case is 1460 bytes.
(a) The sending S controller user program requests a transmission of 2000 bytes.
(b) The transmitted data is divided into two units called segments, A (with 1460
bytes) and B (with 540 bytes) by the sending EN311.
(c) A and B are put onto the transmission line in order.
(d) The data that arrived at the receiving EN311 is acquired by a receive request for
2000 bytes from the S controller, and stored in the user specified register area
(see section 6.4.7, "TCP receive request (using the URCV_T instruction)").
The amount of data that can be acquired by a TCP receive request differs
depending on the timing with which the S controller issues the receive request
and the timing with which the data arrives at the EN311.
• If data has not yet arrived at the receiving side EN311 when the receive
request is issued:
Æ When segment A arrives at the EN311, only segment A will be passed to
the requester.
• If only segment A has arrived at the receive side EN311 when the receive
request is issued:
Æ Only segment A will be passed to the requester.
• If segments A and B have arrived at the receive side EN311 when the receive
request is issued:
Æ A data item consisting of A and B will be passed to the requester.
(e) If B was not received, another receive request can be issued from the S controller
to acquire B.
6F8C0904
93
6
Chapter 6 Socket Interface Communication
Sending
EN311
Transmission line
EN311
S controller
(1) Send request
2000 bytes
Receiving
S controller
(2)
1460 bytes
A
B
540 bytes
(4) First receive request
(3)
1460 bytes
A
B
540 bytes
2000 bytes
A
1460 bytes
(5) Second receive request
2000 bytes
B
540 bytes
Figure 6-7 Transmission Data Fragmentation in the TPC socket
(9) When the transmission data is fragmented as discussed above, the amount of data
transferred to the S controller in a TCP socket interface receive request differs
depending both on the timing with which the S controller issues the receive request
and the timing with which the data arrives at the EN311.
6
(10) To handle single units of transmission data on the receiving side as single units as
well, the user software on the receiving side must recognize the end of the
transferred data (either by using counts in the transmitted data or by including an
end marker in the transmitted data) and iterate receive requests until all the
transmitted data has been received. ("B" does not arrive at the EN311 earlier than
"A" through the TCP/IP processing.)
(11) User programs must store all incoming data so that the register area used to transfer
data to the S controller is not overwritten when using iterated receive requests.
94
Ethernet module User’s Manual
6.2 EN311 Socket Interface Usage Notes
Preamble (7 bytes)
Signal used to synchronize reception
SFD (Start Frame Delimiter) (1 byte)
Remote station address (6 bytes)
Local station address (6 bytes)
Ethernet type (2 bytes)
0800H:IP、0806H:ARP
IP header (20 bytes)
6
UDP header
(8 bytes)
Packets
flowing on the
transmission
line
(72 1526 bytes)
TCP header
(20 bytes)
IP datagram
(46 1500 bytes)
UDP data field
(up to 1472 bytes)
TCP data field
(up to 1460 bytes)
Data field of
IP data field
(up to
The packet
flowing on the 1480 bytes)
transmission
line
FCS (Frame Check Sequence) (4 bytes)
32-bit CRC code for the sections of the packet other
than the preamble, the SFD, and the FCS.
(Packet error detection)
Figure 6-8 Packet Format/IP Datagram
6F8C0904
95
Chapter 6 Socket Interface Communication
6.2.3
Socket port numbers
(1) Set the port numbers for local TCP and UDP sockets to values in the range 1024 to
65535. The EN311 will issue an error if any other values are used. This is because
the port numbers from 1 to 1023 are allocated for UNIX workstation standard
services.
(2) There are cases where there are reserved ports with numbers outside the 1 to 1023
range on specific workstations. Verify this on the workstations actually being used,
and be sure that these reserved port numbers are not duplicated on the EN311.
(3) The same port number cannot be assigned to multiple sockets for TCP and UDP
sockets. Be especially careful not to duplicate UDP port numbers used for message
transmission (computer link protocol/PC link protocol transmission).
(4) When TCP sockets and UDP sockets are used together in the same EN311, the
same port number cannot be used for both TCP and UDP sockets.
6.2.4
General precautions for UDP/TCP socket
(1) Careful attention to changes in bits in the socket status is required when using socket
transmission requests.
6
(2) Using multiple EN311 functions at the same time or particular user program may
cause slower communication processing.
(3) Communication efficiency may degrade if the network to which the EN311 is
connected is heavily loaded.
(4) Since processing a close request requires processing the send and receive requests
issued to that socket before the close request was issued, a significant amount of
time may be required to process some close requests.
(5) The EN311 includes a reception buffer (of about 60 Kbytes) to hold data addressed
to the local station. Since a TCP socket can receive up to a maximum of 5,840 bytes
of data, it is impossible even for eight TCP sockets to fill up this buffer, which is 60K
bytes.
With UDP sockets, there is no limit on the receive data quantity per socket; therefore,
in the event that data have been sent from other nodes to an open socket, the
receive buffer may become full unless the data being received by the socket is taken
over by the S controller side. In this case, the newly arrived data will be damaged
thus making data transmission impossible (the transmission request will end in
"Resource shortage error").
To avoid this situation, make sure to use the user program to issue constantly receive
requests to read data from the receive buffer or use the socket status (see section
6.3, "Socket Interface Information") to monitor the availability of receive data to
perform the receiving. If a "resource shortage error" occurs without taking over the
receive data, resolve the problem by closing the socket where the receive data has
accumulated.
(6) Since EN311 receive requests (both TCP and UDP) put the object socket in a wait
state waiting for data from the remote node, transmission over that socket is not
possible.
If full-duplex communication with the remote node is required, set up two sockets,
one for transmission and one for reception.
(7) There are a total of eight requests used for socket interface transmission. The S
controller waits internally for completion for the timeout for the following five types of
those:
• UDP open, send, and close requests
• TCP send and close requests
96
Ethernet module User’s Manual
6.2 EN311 Socket Interface Usage Notes
If the timeout time expires, the "transmission complete timeout (no instruction
response)" error occurs. Since this error has the same code as module failure errors,
first check whether or not the module has failed before attempting to recover from the
error.
(8) User programs specify the time limit until completion for the following three requests
used in socket interface transmission:
• UDP receive request/TCP open request/TCP receive request
If this time limit is exceeded, a "timeout" error occurs. In particular, the EN311 reports
the timeout error to the S controller.
(9) The EN311 uses a priority ordering in processing sockets 1 through 8. Therefore,
systems constructed so that socket 1 is activated frequently may not be able to
process socket 8, resulting in "Transmission completion timeout" errors. When
constructing a system, take the socket utilization conditions into account when
allocating sockets.
Since the send/receive processing for each socket requires about 50 ms,
applications that issue send or receive requests to a given socket should leave an
interval of at least 50 ms times the number of sockets used between each request.
6
Interval between send (receive)requests to the same socket >= Number of
sockets used ¥ 50 ms
Similarly, the above intervals averaging 50 ms should be left between transmissions
from remote nodes to the local node.
Interval between remote node transmissions >= Number of remote nodes ¥ 50
ms
6.2.5
UDP socket interface notes
(1) In transmission using UDP sockets, the user program must implement any
processing required to assure transmission reliability, such as verifying the reception
of transmitted data and retransmission.
(2) It is possible to broadcast to all nodes on the network using UDP sockets. It is
convenient to prepare a dedicated socket in advance if broadcast transmission is to
be used.
For more information, see the "UDP send request" section and "UDP receive
request" section.
(3) Data transmission between sockets on the same node is not supported.
6.2.6
Considerations for TCP socket
(1) A connection is established by an active open from another socket applied to a
socket in the passive open state. A connection cannot be established by a passive
open from another socket applied to a socket in the passive open state. Similarly, a
connection cannot be established by an active open from another socket applied to a
socket in the active open state. That is, the roles of two sockets for which a
connection is to be established must be determined in advance.
(2) When a passive open is executed, the specified socket is put in the active open wait
state.
If the remote IP address (DIPAddress) and the remote node object socket TCP port
number (DTCP_PORTNO) values are set to 0, the socket will be able to handle
active opens from any remote node.
(3) For a socket in the passive open state, it is not possible to open multiple connections
from other nodes by issuing multiple active open.
(4) Connections cannot be established between sockets on the same node.
6F8C0904
97
Chapter 6 Socket Interface Communication
(5) When ending the connection from the EN311, the open request should be issued
after waiting at least 20 seconds to open again with the same port number even the
TCP close request had been completed normally.
If the open request is issued within 20 seconds using the same port number, an error
will occur.
(6) When ending the connection from the EN311, the EN311 that has received the close
request of the S controller waits for the end request (TCP level) on the remote station
side for 15 seconds after sending the end request (FIN) to the remote station.
If there is the end request from the remote station side during the wait time, the
EN311 performs the own-station close processing.
If a timeout occurs, the EN311 also performs the own-station close processing.
(7) If a close request comes from the remote node TCP socket, the local node must also
close the socket. As a technique for checking for the reception of close requests from
the remote TCP socket, user programs should monitor the RCLOSE and CONN bits
in the socket status (see section 6.3, "Socket Interface Information"). RCLOSE is set
to 1 and CONN is set to 0 when a close request is received from the remote TCP
socket.
6
(8) The EN311 will return an error if send or receive requests is issued in this state. A
receive request in the receive wait state also returns an error. However, the
remaining data will be acquired by issuing a receive request if there is data remained
on the EN311.
(9) When ending the connection form the remote node, the open request should be
issued after waiting at least 10 seconds to open again with the same port number
even the S controller close request had been completed normally.
If the open request is issued within 10 seconds using the same port number, an error
will occur.
(10)The EN311 in the current state does not support a keep alive function for TCP
connections. Verification from the EN311 side to other nodes is not performed.
However, the EN311 does respond to verifications from other nodes. (Responding to
verifications from other nodes is performed independently of user programs.)
Therefore, the disappearance of remote nodes cannot be detected at the TCP level.
We recommend using the detection techniques described in items (11) and (12)
below to detect this condition.
Keep alive function: A function that checks, at the TCP protocol level, whether or not
the connection is operating normally if there has been no activity
over the connection for a certain fixed period.
(11)For a TCP receive request, the EN311 simply waits for data from the remote node. In
situations where data is sent periodically from the remote node, reception wait
timeouts, i.e. no response from the remote node states, can be detected by setting a
reception wait time limit. The following techniques, among others, can be used to
detect no response states when data is sent irregularly.
• Periodic execution of existence verification requests (see section 7.3, "Remote
Station Verification Request").
• The techniques described in the next section, which use a separate TCP connection
One of the following problems may have occurred when there is no response from
the remote node:
• The remote node may have gone down.
• Power may have been lost.
• The remote and local nodes may have become disconnected from the network.
98
Ethernet module User’s Manual
6.2 EN311 Socket Interface Usage Notes
(12)With a connection established, if the no response state from the remote node
continues when data is sent and the EN311 internal resend processing times out (the
timeout time is about 1 minute), the NOACK bit in the socket status (see section 6.3,
"Socket Interface Information") will be set to 1. User programs should close such
sockets.
Also note that the EN311 will return an error if send or receive requests are issued in
this state.
(13)User program send requests are seen as completed as soon as they are received by
the EN311. This means that even if the remote node goes to the no response state, a
number of send requests equal to the EN311 internal storage capacity will complete
normally.
When the number of send requests exceed the EN311 internal storage capacity,
errors will be returned for all further send requests.
(14)The window size of the remote socket may become smaller during the transmission
from the EN311. The TCP send request data size which is requested by the S
controller is larger the window size of the remote node, the EN311 will return an error.
Once it enters this state, TCP send requests will repeatedly cause errors unless the
remote node itself notifies the window size expansion.
In this case, it is recommended to reestablish the connection after closing it.
Window size: The technique used to notify the available space in the receive buffer
of the local socket to the remote socket. It is possible that the window
size becomes smaller because the receive data has not been
processed for some reason or other.
(15)When the EN311 receives a segment with the reset bit (RST) set to 1 (reset
segment), the RCLOSE bit will be set to 1 and the CONN bit will be set to 0 in the
socket status (see section 6.3, "Socket Interface Information"). If the socket status
shows these bits, such sockets should be closed.
Reset segment: A transmitted segment used to forcibly close a connection from one
of the nodes. Connections are forcibly closed in this manner if an
error that cannot be recovered from by normal means such as
retransmission has occurred, or if a node has recovered after
having gone down.
(16)ACK transmission timing in the EN311 TCP socket
When the internal reception data in the EN311 is read out by the TCP receive
request, the EN311 sends an ACK (acknowledge response) to the node that sent the
data. Note that the EN311 will send an ACK every second to the source node even if
it does not issue the TCP receive request. However, if it does not issue the TCP
receive request, the data reached to the destination socket will be stored in the TCP
receive buffer. The receive buffer on the TCP socket has the limit of 5840 bytes per
packet. The data should be received by the TCP receive request.
6F8C0904
99
6
Chapter 6 Socket Interface Communication
6.3 Socket Interface Information
The information for the eight socket interface sockets held by the EN311 can be read out
with the MREAD instruction. The EN311 holds five words of socket status information for
each socket. User programs should access this information as necessary when using
socket transmission.
• Remote node TCP/UDP port number
• Remote node IP address
• TCP/UDP port number for this socket
• Socket status
Table 6-1 lists the structure of the socket interface information and the extended memory
area addresses.
Table 6-1 Socket Interface Information Storage Address (Word Address)
Socket identifier
6
1
2
3
4
Remote node port number (TCP only)
16#7E43
16#7E4B
16#7E53
16#7E5B
Remote node IP address (TCP only)
16#7E44
16#7E45
16#7E4C
16#7E4D
16#7E54
16#7E55
16#7E5C
16#7E5D
Local node TCP/UDP port number
16#7E46
16#7E4E
16#7E56
16#7E5E
Socket status
16#7E47
16#7E4F
16#7E57
16#7E5F
Socket identifier
5
6
7
8
Remote node port number (TCP only)
16#7E63
16#7E6B
16#7E73
16#7E7B
Remote node IP address (TCP only)
16#7E64
16#7E65
16#7E6C
16#7E6D
16#7E74
16#7E75
16#7E7C
16#7E7D
Local node TCP/UDP port number
16#7E66
16#7E6E
16#7E76
16#7E7E
Socket status
16#7E67
16#7E6F
16#7E77
16#7E7F
For UDP sockets, the remote node port number and IP address data are invalid.
The socket status has the following structure.
F
TCP
E
D
C
AOPEN
UDP
B
CONN
POPEN
A
9
8
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
RCLOSE
RCV
NOACK
The conditions for each bit to become 1 as well as those for becoming 0 are listed in
Table 6-2.
100
Ethernet module User’s Manual
6.3 Socket Interface Information
Important note
This area is a read-only area. Do not attempt to write data to it using the MWRITE
instruction. If you do, data may no longer be read correctly.
TCP connection established
Table 6-2 Condition of Socket status bits
Bit no.
Bit
Condition under which the bit is set
to 1
Condition under which the bit is
reset to 0
F
TCP
TCP used by the socket
The socket closed in response
to a close request
E
UDP
UDP used by the socket
The socket closed in response
to a close request
D
AOPEN
TCP socket in active open state The socket closed in response
to a close request
C
POPEN
TCP socket in passive open
state or UDP socket in open
state
B
CONN
Disconnected by the local node Disconnected by the remote
with a close request
node
A
RCV
Received text present
9
RCLOSE
An established TCP connection The socket closed in response
disconnected by the remote
to a close request
node
8
NOACK
No response received from the When the socket closed in
remote node for a local node
response to a close request:
send operation in a state where
a TCP connection was
established, and the TCP
resend function resulted in a
timeout (because the remote
node was down, etc.).
The socket closed in response
to a close request
6
No received text
When the wait time exceeds the When a TCP active open
set value during a TCP active
request is reissued.
open request:
This bit is not set to 1 for a TCP
passive open request timeout.
A socket status in which neither AOPEN or POPEN is set to 1 indicates that the socket is
in the closed state.
6F8C0904
101
Chapter 6 Socket Interface Communication
6.4 Using the EN311 Socket Interface
This section describes the requests used by user programs to use UDP and TCP
sockets. There are eight types of request as listed below.
• UDP socket (open request, send request, receive request, close request)
• TCP socket (open request, send request, receive request, close request)
Even when performing transmission by using the socket, it is necessary to set the
module of the EN311 in the same manner as the computer link/PC link procedure
transmission.
Caution
• Make sure to understand the contents of this chapter thoroughly before writing programs that
use the EN311. The sample programs present basic examples of EN311 usage, and should
be reviewed carefully before using them in an actual system.
6
102
Ethernet module User’s Manual
6.4 Using the EN311 Socket Interface
6.4.1
UDP open request (using the USEND_T instruction)
(1) Function
This request opens any of the eight sockets.
Transmission protocol:UDP/IP
(2) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0331)
CMD+2
Socket identifier
Value:1-8
CMD+3
Specified socket UDP port number of the local node
Value:1024-65535
<Error status>
F
STATUS
0
6
Socket identifier (1-8) or Error status
Error status examples
Error status number
Description
-5004(16#EC74)
Destination EN311 module slot number is missing or socket identifier
is out of range
2912(16#B60)
Transmission disabled
2944(16#B80)
Already open
(3) Considerations
• After this request completes normally, UDP send, receive or close requests can be
sent to the socket.
• An error is returned if an open request is issued for an already open socket.
Error status: Already opened ••• 2944(16#B80)
• An error is returned if a socket identifier other than 1 to 8 is specified.
Error status: Invalid socket identifier ••• 5004(16#EC74)
• An error is returned if a value other than a local node specified socket UDP port
number is specified.
Error status: Port number error ••• 2929(16#B71)
• Not only must the specified socket UDP port number on the local station not overlap
with UDP port numbers used for message transmission and previously used UDP port
numbers, but it also must not overlap with any TCP port number. An error will occur if
the port number overlaps.
Error status: Already open ••• 2944(16#B80)
• If the S controller internal completion wait time limit (2 seconds) is exceeded for this
request, the error listed below is returned.
Error status: Send completion timeout ••• 5002(16#EC76)
In this case, first verify that the module is not in the down state by checking the station
status, and then verify the open/closed state of the socket in the socket status.
6F8C0904
103
Chapter 6 Socket Interface Communication
6.4.2
UDP send request/broadcast send request (using the USEND_T
instruction)
(1) Function
This request sends local node register data using an open UDP socket.
(2) Request command structure and error status
<Request command>
F0
CMD
Request destination EN311 module
slot number
CMD+1
Command (16#0332)
CMD+2
Socket identifier
Value:1-8
CMD+3
Transmission destination IP address
(The input format is the same as that for
the parameter setup request.)
Specified socket UDP port number of
the local node
Value:1024-65535
CMD+4
CMD+5
6
• Local station register is specified by the input operand P of the USEND_T function
block.
• Transfer register size is specified by the input operand N of the USEND_T function.
Specify in words: 1 to 1000 words
• If the transmission destination IP address is set to "255.255.255.255", it will be
broadcast.
<Error status>
F
STATUS
0
Socket identifier (1-8) or Error status
Error status examples
Error status number
Description
-5004(16#EC74)
Destination EN311 module slot number is missing or socket identifier is out
of range
2819(16#B03)
Local node standby
2864(16#B30)
Length error
2912(16#B60)
Transmission disabled
2945(16#B81)
Socket not opened yet
3008(16#BC0)
Resource insufficient error
(3) Considerations
• An error is returned if a send request is issued for a socket that is not yet opened.
Error status: Unopened ••• 2945(16#B81)
• An error is returned if a socket identifier other than 1 to 8 is specified.
Error status: Invalid socket identifier ••• 2946(16#B82)
• If the IP address of the local node is specified as the transmission destination IP
address, it will be possible to send data, but it will not be possible to receive that data
with a receive request.
104
Ethernet module User’s Manual
6.4 Using the EN311 Socket Interface
• Values in the range 1024 to 65535 can be specified as the object socket UDP port
number for the transmission destination. An error will be returned if a value outside
that range is specified.
Error status: Port number error ••• 2929(16#B71)
• An error will be returned if a value of 0 words or 1001 or more words is specified as the
transmission data size.
Error status: Transmission word count error ••• 5059(16#EC3D)
• The S controller performs an area check for the register area based on the
transmission data storage register type and number, and if an error is found it returns
an error.
Error status: Boundary error ••• 5060(16#EC3C)
• If the S controller internal completion wait time limit (2 seconds) is exceeded for this
request, the error listed below is returned.
Error status: Send completion timeout ••• 5002(16#EC76)
In this case, first verify that the module is not in the down state by checking the station
status, and then verify the open/close by checking the socket status.
• The EN311 uses a priority ordering in processing sockets 1 through 8. Therefore,
systems constructed so that socket 1 is activated frequently may not be able to
process socket 8, resulting in the following error response:
Error status: Send completion timeout ••• 5002(16#EC76)
When constructing a system, take the socket utilization conditions into account when
allocating sockets.
Since the send/receive processing for each socket requires about 50 ms, applications
that issue send or receive requests to a given socket should leave an interval of at
least 50 ms times the number of sockets used between each request.
Interval between send (receive)requests to the same socket >= Number of
sockets used ¥ 50 ms
Similarly, the above intervals averaging 50 ms should be left between transmissions
from remote nodes to the local node.
Interval between remote node transmissions >= Number of remote nodes ¥ 50
ms
• If a transmission request is issued to a nonexistent remote station, an error will occur.
Error status: Timeout ••• 2848(16#B20)
(4) Broadcast transmission
It is possible to broadcast to all nodes on the network using UDP sockets.
Send side: Set the transmission destination address to "255.255.255.255",
("FF.FF.FF.FF" in hexadecimal).
The "0.0.0.0" used by some UNIX versions (in particular, 4.2 BSD)
cannot be used.
Specify the UDP port number for the socket to which you want to issue a
broadcast as the transmission destination object socket UDP port
number.
6F8C0904
105
6
Chapter 6 Socket Interface Communication
6.4.3
UDP receive request (using the URECV_T instruction)
(1) Function
If an opened UDP socket receives data, read the received data into registers on the
local node. If no data has been received, wait until data arrives (the wait time can be
set) and then read the received data into the local node registers.
(2) Request command structure and error status
<Request command>
F
0
CMD
Request destination EN311 module slot
number
CMD+1
Command (16#0333)
CMD+2
Socket identifier
Value:1-8
CMD+3
Transmission destination IP address
(The input format is the same as that
for the parameter setup request.)
CMD+5
Specified socket UDP port number of
the local node
Value:1024-65535CMD+6
CMD+6
Receive wait timeout time
CMD+4
6
• Local station register is specified by the input operand "receive data P" of the URCV_T
function block.
• Transfer register size is specified by the input operand "number of received data
words N" of the URCV_T function block.
Specify in words: 1 to 1001 words
The value specified as "number of received data words N" is the size of the transmitted
data in a single operation to the socket (number of words) + 1 word.
• If the transmission source IP address is set to "0.0.0.0", it will be broadcast.
<Error status>
F
STATUS
0
Socket identifier (1-8) or Error status
Error status examples
Error status number
Description
-5002(16#EC76)
Timeout (detected by the S controller)
-5004(16#EC74)
Destination EN311 module slot number is missing or socket identifier is
out of range
2819(16#B03)
Local node standby
2848(16#B20)
Timeout (detected by the EN311)
2945(16#B81)
Socket not opened yet
3009(16#BC1)
Receive request (number of words) error in the S controller
(3) Request command details
• Receive data length: Set this parameter to a value greater than or equal to the largest
size for transmission data that could be sent to the object socket
in a single operation.
• Receive wait timeout time: Specified in 0.1-second units. (1 to 65535)
If zero is specified, the system is set to an unlimited
(infinite) wait state.
106
Ethernet module User’s Manual
6.4 Using the EN311 Socket Interface
(4) Methods for storing receive data
• The value specified as "number of received data words N" is the size of the transmitted
data in a single operation to the socket (number of words) + 1 word. The S controller
checks for register area with the value of N and returns error status:
Boundary error ••• 5060(16#EC3C)
• In this case, data is not transferred to the register area, and the data is discarded. The
data is not retained in the EN311 either.
• Allocate a reception data storage register area with a size equal to the size of the
reception data plus one word. The reception data count (the size of the transmission
data for a single operation) and the transmission data for a single operation will be
stored in this area as shown in the figure below.
Receive data size (bytes)
←Head of the
specified register
Transmission data sent to the
socket in a single operation
Receive data storage
register area
6
(5) Important notes
• An error is returned if a receive request is issued for a socket that is not yet opened.
Error status: Unopened ••• 2945(16#B81)
• An error is returned if a socket identifier other than 1 to 8 is specified.
Error status: Invalid socket identifier ••• 2946(16#B82)
• It is not possible to receive data sent from the local node, even if the local node IP
address is specified at the transmission source IP address.
• Values in the range 1024 to 65535 can be specified as the object socket UDP port
number for the transmission source. An error will be returned if a value outside that
range is specified.
Error status: Port number error ••• 2929(16#B71)
• An error will be returned if a value of 0 words or 1001 or more words is specified as the
receive data size.
Error status: Transmission word count error ••• 5059(16#EC3D)
• An error will be returned if the reception timeout time is exceeded.
Error status: Timeout ••• 2848(16#B20)(0020H)
• If the size of data transmitted in a single operation > the number of data words
received (N-1), then the receive request will cause an error.
Error status: Receive request (number of words) error in the S controller •••
3009(16#BC1)
Only the reception data size of the received data from the beginning will be transferred
to the receive data storage register area of the S controller. The remaining data will not
be stored in the EN311 either.
• The EN311 uses a priority ordering in processing sockets 1 through 8. Therefore,
systems constructed so that socket 1 is activated frequently may not be able to
process socket 8, resulting in the following error response:
Error status: Send completion timeout UDP ••• 5002(16#EC76)
When constructing a system, take the socket utilization conditions into account when
allocating sockets.
6F8C0904
107
Chapter 6 Socket Interface Communication
Since the send/receive processing for each socket requires about 50 ms, applications
that issue send or receive requests to a given socket should leave an interval of at
least 50 ms times the number of sockets used between each request.
Interval between send (receive)requests to the same socket >= Number of
sockets used ¥ 50 ms
Similarly, the above intervals averaging 50 ms should be left between transmissions
from remote nodes to the local node.
Interval between remote node transmissions >= Number of remote nodes ¥ 50
ms
(6) When multiple sockets send the data to the EN311 socket
• If you give a specific value to "transmission source IP address" and "transmission
source object socket UDP port number", the EN311 checks the "transmission source
IP address" and "transmission source object socket UDP port number" of the data
received on the socket. If the received data has different "transmission source IP
address" and "transmission source object socket UDP port number", the data will not
be transferred to the S controller.
• If there are three received data packets on the EN311 UDP socket (assuming all of the
source sockets are different) and the specified "transmission source IP address" and
"transmission source object socket UDP port number" match with the third received
data packet, the third data packet will be transferred to the S controller but the first and
the second will be discarded.
6
• To prevent the checking of the source IP address against the received data, set the
source IP address to "0.0.0.0".
• To prevent the checking of the source object socket UDP port number against the
received data, set the source object socket UDP port number to "0".
(7) Broadcast reception
It is possible to broadcast to all nodes on the network using UDP sockets.
Receive side:Specify the transmission source IP address to be "0.0.0.0".
Specify the transmission source UDP port number to be the UDP port number of
broadcast transmitting socket.
108
Ethernet module User’s Manual
6.4 Using the EN311 Socket Interface
6.4.4
UDP close request (using the USEND_T instruction)
(1) Function
Close the open UDP socket.
Release the (unlimited wait state) receive request and terminate the UDP socket.
(2) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0334)
CMD+2
Socket identifier
Value:1-8
<Error status>
F
STATUS
0
Socket identifier (1-8) or Error status
6
Error status examples
Error status number
Description
-5004(16#EC74)
Destination EN311 module slot number is missing or socket
identifier is out of range
2912(16#B60)
Transmission disabled
2945(16#B81)
Socket not opened yet
(3) Important notes
• UDP close requests are processed with the highest priority and other executing
requests are discarded, even if the object socket is executing a UDP open, send, or
receive request. Other requests during the execution of this request will be discarded.
• The next open request for the object socket can be executed as soon as the close
request completes normally.
• An error is returned if a close request is issued for a socket that is not yet opened.
Error status: Unopened ••• 2845(16#B81)
• An error is returned if a value other than 1 to 8 is specified as the socket identifier.
Error status: Invalid socket identifier ••• 2846(16#B82)
• A UDP receive request will result in an error being returned if an unlimited wait state
UDP receive request is terminated with this request.
Error status: Transmission completion timeout ••• 5002(16#EC76)
Supplemental Remarks
The S controller sees its requests (module control and socket transmission) to the EN311 as
being "transmission" requests. As a result, when a request is forcibly terminated and a response
is not received from the EN311, the result is a send request timeout even if the instruction was a
receive request.
• If the S controller internal completion wait time limit (2 seconds) is exceeded for this
request, the error listed below is returned.
Error status: Send completion timeout ••• 5002(16#EC76)
In this case, first verify that the module is not in the down state by checking the station
status, and then verify the open/closed state of the socket with the socket status.
6F8C0904
109
Chapter 6 Socket Interface Communication
6.4.5
TCP open request (using the USEND_T instruction)
(1) Function
This request opens (active/passive) any of the eight sockets.
Transmission protocol:TCP/IP
(2) Request command structure and error status
<Request command>
F
0
CMD
Request destination EN311 module slot number
CMD+1
Command (16#0334)
CMD+2
Socket identifier
CMD+3
Open type
CMD+4
Transmission destination IP address
(The input format is the same
as that for the parameter setup
request.)
CMD+6
Remote object socket TCP port number
Value:1024-65535
CMD+7
Receive wait timeout time
Value:1024-65535
CMD+8
Timeout time
Value:1-8
CMD+5
6
<Error status>
F
STATUS
0
Socket identifier (1-8) or Error status
Error status examples
Error status number
Description
-5002(16#EC76)
Timeout (detected by the S controller)
-5004(16#EC74)
Destination EN311 module slot number is missing or socket identifier
is out of range
2848(16#B20)
Timeout (detected by the EN311)
2944(16#B80)
Socket already opened
(3) Request command details
• Open type 1: Active open (client side)
2: Passive open (server side)
Timeout time: Specified in 0.1- second units (1 to 65535).
If zero is specified, the system is set to an unlimited (infinite) wait state.
Active open is not allowed to set to an unlimited (infinite) wait state.
(4) Important notes
• After this request completes normally, TCP send, receive or close requests can be
sent to the socket.
• An error is returned if an open request is issued for an already open socket.
Error status: Already open ••• 2944(16#B80)
• An error is returned if a value other than 1 to 8 is specified as the socket identifier.
Error status: Invalid socket identifier ••• 2946(16#B82)
• An error will be returned if a value outside the range 1024 to 65535 is specified for the
local node specified socket TCP port number.
Error status: Port number error ••• 2929(16#B71)
110
Ethernet module User’s Manual
6.4 Using the EN311 Socket Interface
• Not only must the specified socket TCP port number on the local station not overlap
with any TCP port number already in use in a local station socket, but it also must not
overlap with any UDP port numbers or UDP port numbers used for message
transmission. An error will occur if the port number overlaps.
Error status: Already open ••• 2944(16#B80)
• A connection to the local node itself cannot be established, even if the local node IP
address is specified as the remote node IP address.
• Values in the range 1024 to 65535 can be specified as the object socket TCP port
number for the remote node. An error will be returned if a value outside that range is
specified.
Error status: Port number error ••• 2929(16#B71)
• An error will be returned if the open timeout time is exceeded.
Error status: Timeout ••• 2848(16#B20)
• While the open wait timeout limit can be set to any value in the range 0.1 to 6553.5
seconds or unlimited (infinite), we recommend that the timeout limit be set in the range
0.1 to 32 seconds for active opens.
This is because the EN311 processing continuation time for active open processing is
32 seconds. Even if the timeout limit is set to a value over 32 seconds, once 32
seconds has elapsed, the open processing will never actually be performed. The
system will be in an idle state until the specified time has elapsed.
• Although there will be no error even if you set the timeout time to 32 seconds or more,
do not set the timeout time to unlimited (infinite). If you do so, the socket remains to be
waiting for active open when no connection is established within 32 seconds from the
request. In this case, if you issue a close request to the object socket, the open waiting
state is released and the socket will be able to accept the open request again.
• A connection is established by an active open from another socket applied to a socket
in the passive open state. A connection cannot be established by a passive open from
another socket applied to a socket in the passive open state. Similarly, a connection
cannot be established by an active open from another socket applied to a socket in the
active open state.
• For a socket in the passive open state, it is not possible to open multiple connections
from other nodes by issuing multiple active open requests.
• If an active open request is issued to a nonexistent remote station, an error will occur.
Error status: Transmission complete timeout ••• 5002(16#EC76)
• If you reissue an active open request, you should wait 5 seconds or longer after the
previous timeout. If you reissue it within 5 seconds, the following error will occur.
Error status: LAN controller driver error ••• 2960(16#B90)
• In case of passive open, if you set the remote node IP address to "0.0.0.0", the IP
address of the active open node will not be checked.
• In case of passive open, if you set the remote object socket TCP port number to "0",
the port number of the active open node will not be checked.
6F8C0904
111
6
Chapter 6 Socket Interface Communication
6.4.6
TCP send request (using the USEND_T instruction)
(1) Function
This request sends local node register data using an open TCP socket.
(2) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0337)
CMD+2
Socket identifier
Value:1-8
• Local station register is specified by the input operand P of the USEND_T function
block.
• Transfer register size is specified by the input operand N of the USEND_T function.
Specify in words: 1 to 1000 words
6
<Error status>
F
STATUS
0
Socket identifier (1-8) or Error status
Error status examples
Error status number
Description
-5004(16#EC74)
Destination EN311 module slot number is missing or socket identifier is
out of range
2819(16#B03)
Local node standby
2864(16#B30)
Length error
2912(16#B60)
Transmission disabled
2945(16#B81)
Socket not opened yet
3011(16#BC3)
Transmission buffer full
3012(16#BC4)
Remote node window size is too small
(3) Important notes
• An error is returned if a send request is issued for a socket that is not yet opened.
Error status: Socket unopened ••• 2945(16#B81)
• An error is returned if a value other than 1 to 8 is specified as the socket identifier.
Error status: Invalid socket identifier ••• 2946(16#B82)
• An error will be returned if a value of 0 words or 1001 or more words is specified as the
transmission data size.
Error status: Transmission word count error ••• 5059(16#EC3D)
• The S controller performs an area check for the register area based on the
transmission data storage register type and number, and if an error is found it returns
an error.
Error status: Boundary error ••• 5060(16#EC3C)
• If a close request from the remote node TCP socket has arrived while a connection is
established, and the user program issues a send request, the EN311 returns the
following error.
Error status: Socket unopened ••• 2945(16#B81)
Verify the socket status (see section 6.3, "Socket Interface Information") RCLOSE and
CONN bits, and close the socket.
112
Ethernet module User’s Manual
6.4 Using the EN311 Socket Interface
• With a connection established, if a no response state from the remote node continues
when data is sent and the EN311 internal resend processing times out (the timeout
time is about 1 minute), the NOACK bit in the socket status will be set to 1. User
programs should close such sockets. Errors will be returned for send/receive requests
issued in this state.
Error status: Timeout error ••• 2848(16#B20)
However, note that the EN311 will return normal complete responses for TCP send
requests issued prior to the timeout, since the send requests from the S controller are
stored internally by the EN311.
When the number of send requests that can be stored is exceeded before the NOACK
bit becomes "1", errors will be returned for that and all following send requests.
Error status: Transmission buffer full ••• 3011(16#BC3)
• One of the following problems may have occurred when there is no response from the
remote node:
• The remote node may have gone down.
• Power may have been lost.
• The remote and local nodes may have become disconnected from the network.
• A send request is seen as completed as soon as it is stored in the EN311. This is done
because the send request should be transmitted later if it is not transmitted
immediately due to network congestions or other reasons when the send request is
executed. A number of send requests that can be stored is three and if no more can be
stored (i.e. when the number of send requests exceeds the EN311 internal storage
capacity), errors will be returned for all further send requests.
Error status: Transmission buffer full ••• 3011(16#BC3)
• The window size of the remote socket may become smaller during the transmission
from the EN311. The TCP send request data size which is requested by the S
controller is larger the window size of the remote node, the EN311 will return an error.
Once it enters this state, TCP send requests will repeatedly cause errors unless the
remote node itself notifies the window size expansion.
In this case, it is recommended to reestablish the connection after closing it.
Error status: Remote node window size is too small ••• 3012(16#BC4)
• Window size: The technique used to notify the available space in the receive buffer of
the local socket to the remote socket. It is possible that the window size becomes
smaller because the receive data has not been processed for some reason or other.
• If the S controller internal completion wait time limit (2 seconds) is exceeded for this
request, the error listed below is returned.
Error status: Send completion timeout ••• 5002(16#EC76)
In this case, first verify that the module is not in the down state by checking the station
status, and then perform the required error handling.
• The EN311 uses a priority ordering in processing sockets 1 through 8. Therefore,
systems constructed so that socket 1 is activated frequently may not be able to
process socket 8, resulting in the following error response:
Error status: Send completion timeout ••• 5002(16#EC76)
• When constructing a system, take the socket utilization conditions into account when
allocating sockets. Since the send/receive processing for each socket requires about
50 ms, applications that issue send or receive requests to a given socket should leave
an interval of at least 50 ms times the number of sockets used between each request.
Interval between send (receive)requests to the same socket >= Number of
sockets used ¥ 50 ms
• Similarly, the above intervals averaging 50 ms should be left between transmissions
from remote nodes to the local node.
Interval between remote node transmissions >= Number of remote nodes ¥ 50 ms
6F8C0904
113
6
Chapter 6 Socket Interface Communication
6.4.7
TCP receive request (using the URCV_T instruction)
(1) Function
If an opened TCP socket receives data, read the received data into registers on the
local S controller. If no data has been received, wait until data arrives (the wait time
can be set) and then, after reception, read the received data into the local S controller
registers.
(2) Request command structure and error status
<Request command>
F
0
CMD
Request destination EN311 module slot number
CMD+1
Command (16#0338)
CMD+2
Socket identifier
CMD+2
imeout value
Value:1-8
• The register where the received data will be stored is specified by the input operand
"receive data P" of the URCV_T function block.
6
• Transfer register size (number of words) is specified by the input operand "number of
received data words N" of the URCV_T function block.
Specify in words: 1 to 1001 words
••• The value specified as "number of received data words N" is the size of the
transmitted data in a single operation to the socket (number of words) + 1 word.
<Error status>
F
STATUS
0
Socket identifier (1-8) or Error status
Error status examples
Error status number
Description
-5002(16#EC76)
Timeout (detected by the S controller)
-5004(16#EC74)
Destination EN311 module slot number is missing or socket identifier is out
of range
2819(16#B03)
Local node standby
2848(16#B20)
Timeout (detected by the EN311)
2945(16#B81)
Socket not opened yet
3009(16#BC1)
Receive request (number of words) error in the S control
(3) Request command details
• Reception data length: The data has been received by the socket. Set the amount of
data to be transferred to the S controller.
• Reception wait timeout time: specified in 0.1-second units (1 to 65535).
If zero is specified, the system is set to an unlimited
(infinite) wait state.
(4) Methods for storing reception data
• The value specified as "number of received data words N" is the size of the transmitted
data in a single operation to the socket (number of words) + 1 word. The S controller
checks for register area with the value of N and returns a
Error status: Boundary error ••• 5060(16#EC3C)
In this case, data is not transferred to the register area, and the data is discarded. The
data is not retained in the EN311 either.
114
Ethernet module User’s Manual
6.4 Using the EN311 Socket Interface
• Allocate a reception data storage register area with a size equal to "the size of the data
that you want to transfer from the socket" + 1 word. The received data size (bytes) and
the data received by the target socket when the receive request is issued are
transferred to this area as shown below.
Received data size (bytes)
←Head of the
specified register
Data received by the target socket
Receive data storage
when the receive request is issued
register area
(5) Important notes
• An error is returned if a receive request is issued for a socket that is not yet opened.
Error status: Socket unopened ••• 2945(16#B81)
• An error is returned if a socket identifier other than 1 to 8 is specified.
6
Error status: Invalid socket identifier ••• 2946(16#B82)
• An error will be returned if a value of 0 words or 1002 or more words is specified as the
receive data size.
Error status: Transmission word count error ••• 5059(16#EC3D)
• An error will be returned if the reception timeout time is exceeded.
Error status: Timeout ••• 2848(16#B20)
• If a close request from the remote node TCP socket has arrived while a connection is
established, and the user program issues a send request, the EN311 returns the
following error.
Error status: Socket unopened ••• 2945(16#B81)
However, the remaining data will be acquired by issuing a receive request if there is
data remained on the EN311.
• For a TCP receive request, if the following condition is satisfied;
Amount of data received by the socket > the number of data words received (N-1)
Then only the reception data size of the received data from the beginning will be
transferred to the S controller. The remaining data will be stored in the EN311. Issue
another receive request to receive the remaining data.
• For a TCP receive request, if the following condition is satisfied;
Amount of data received by the socket < the number of data words received (N-1)
Then all of the received data will be transferred to the S controller.
• Since a TCP receive request merely places the socket in the receive wait state, it
cannot detect remote nodes that are not responding. Use one of the following methods
to prevent this state.
• Monitor for a no-response state by sending data periodically over a separate (different) TCP connection.
• Execute a remote node presence verification request for the remote node periodically (see section 7.3, "Remote Station Verification Request").
• Monitor the interval between data receptions when data is being received periodically.
(Receive request issued first type: specify a limited timeout limit.)
(Socket status-monitoring type: monitor the interval between points when the
received text present bit is set to the on state.)
• One of the following problems may have occurred when there is no response from the
remote node:
6F8C0904
115
Chapter 6 Socket Interface Communication
• The remote node may have gone down.
• Power may have been lost.
• The remote and local nodes may have become disconnected from the network.
• ACK transmission timing in the EN311 TCP socket
When reception data in the EN311 is read out by a receive request from the S
controller, the EN311 sends an ACK (acknowledge response) to the node that sent the
data. Note that the EN311 will send an ACK every second to the source node even if it
does not issue the TCP receive request. However, if it does not issue the TCP receive
request, the data reached to the destination socket will be stored in the TCP receive
buffer. The receive buffer on the TCP socket has the limit of 5840 bytes per packet.
The data should be received by the TCP receive request.
• With TCP receive requests, the amount of data transferred to the reception data
storage register area will differ with both the timing with which the S controller issued
the receive request and the timing with which the data arrives at the EN311.
To handle single units of transmission data on the receiving side as single units as
well, the user software on the receiving side must recognize the end of the transferred
data (either by using counts in the transmitted data or by detecting the end mark
included in the transmitted data) and iterate receive requests.
6
• User programs must save all incoming data so that the register area used to transfer
data to the S controller is not overwritten when using iterated receive requests.
• The EN311 uses a priority ordering in processing sockets 1 through 8. Therefore,
systems constructed so that socket 1 is activated frequently may not be able to
process socket 8, resulting in the following error response:
Error status: Send completion timeout ••• 5002(16#EC76)
When constructing a system, take the socket utilization conditions into account when
allocating sockets. Since the send/receive processing for each socket requires about
50 ms, applications that issue send or receive requests to a given socket should leave
an interval of at least 50 ms times the number of sockets used between each request.
Interval between send (receive)requests to the same socket >= Number of
sockets used ¥ 50 ms
Similarly, the above intervals averaging 50 ms should be left between transmissions
from remote nodes to the local node.
Interval between remote node transmissions >= Number of remote nodes ¥ 50
ms
116
Ethernet module User’s Manual
6.4 Using the EN311 Socket Interface
6.4.8
TCP close request (using the USEND_T instruction)
(1) Function
Close the open TCP socket.
Release the (unlimited wait state) receive request and terminate the TCP socket.
(2) Request command structure and error status
<Request command>
F
0
CMD
Request destination EN311 module slot number
CMD+1
Command (16#0339)
CMD+2
Socket identifier
Value:1-8
<Error status>
F
STATUS
0
Socket identifier (1-8) or Error status
6
Error status examples
Error status number
Description
-5004(16#EC74)
Destination EN311 module slot number is missing or socket identifier is out
of range
2912(16#B60)
Transmission disabled
2945(16#B81)
Socket not opened yet
(3) Important notes
• TCP close requests are processed with the highest priority and other executing
requests are discarded, even if the object socket is executing a TCP open, send, or
receive request. Other requests during the execution of this request will be discarded.
• An error is returned if a close request is issued for a socket that is not yet opened.
Error status: Socket unopened ••• 2945(16#B81)
• An error is returned if a value other than 1 to 8 is specified as the socket identifier.
Error status: Invalid socket identifier ••• 2946(16#B82)
• A TCP receive requests will result in an error being returned if an unlimited wait state
TCP open request/receive request is terminated with this request.
Error status: Transmission completion timeout ••• 5002(16#EC76)
Supplemental Remarks
The S controller sees its requests (module control and socket interface transmission) to the
EN311 as being "transmission" requests. As a result, when a request is forcibly terminated and
a response is not received from the EN311, the result is a send request timeout even if the
instruction was a "receive request".
• If the S controller issues the TCP close request to the EN311, the EN311 sends the
connection end request (FIN) at the TCP level to the remote node. At this stage, the
EN311 replies the completion of the close request to the S controller.
6F8C0904
117
Chapter 6 Socket Interface Communication
• Every bit of the socket becomes "0" when the TCP close request is completed.
• The internal completion wait time limit of the S controller for this request is 15 seconds.
If the EN311 was not able to reply the completion within this time limit, the following
error is returned.
Error status: Send completion timeout ••• 5002(16#EC76)
In this case, first verify that the module is not in the down state by checking the station
status, and then verify the open/closed state of the socket with the socket status.
When ending the connection from the EN311
• The EN311 which has received the close request of the S controller waits 10 seconds
after sending the end request to the remote station waits for the end request (TCP
level) of the remote station side.
• If there is the end request of the remote station side during the wait time, the EN311
performs the own-station close processing.
• If the wait time is up, the EN311 performs the own-station close processing.
• The open request should be issued after waiting at least 20 seconds to open again
with the same port number even the S controller completed the close request. If the
open request is issued within 20 seconds using the same port number, the following
error is returned.
6
Error status: Already open •••2944(16#B80) or
Error status: LAN controller driver error ••• 2960(16#B90)/2962(16#B92)
• When the remote station sends the end request after more than 10 seconds have
elapsed since the EN311 sent the end request to the remote station, the EN311
responds with "Reset packet (the TCP packet with it's reset bit is set to ON): Used to
force the disconnection".
When ending the connection from the remote
• When ending the connection form the remote station, the local station should also
close the socket. User programs should monitor the RCLOSE and CONN bits in the
socket status (see section 6.3, "Socket Interface Information"). RCLOSE is set to 1
and CONN is set to 0 when a close request is received from the remote station.
•
When ending the connection form the remote station, the open request should be
issued after waiting at least 10 seconds to open again with the same port number even
the S controller completed the close request.
If the open request is issued within 10 seconds using the same port number, the
following error is returned.
Error status: LAN controller driver error ••• 2960(16#B90)/2962(16#B92)
118
Ethernet module User’s Manual
6.5 Sample Programs
6.5 Sample Programs
This section presents sample programs using UDP and TCP sockets.
6.5.1
UDP socket sample programs
Two EN311 modules are mounted, one to Slot 6 and another to Slot 7 on the base. The
program for each module is to be registered as separate program.
• Transmission is performed via Slot 6, Socket 1 (Port number = 3000) ••• Open Æ Send
Æ Close
• Reception is performed via Slot 7, Socket 1 (Port number = 3001) ••• Open Æ Send Æ
Close
• Socket status address of Socket 1: 16 # 7E47 (word address)
(1) Initialization routine
Slot 6
Local station IP address: 133.113.90.10
6
Local station message transmission UDP port number: 3000
Slot 7
Local station IP address: 133.113.90.20
Local station message transmission UDP port number: 3001
6F8C0904
119
Chapter 6 Socket Interface Communication
Start
Read the station status
N
Run mode ?
7EFFH on DPRAM
(word address)
Is the result of ANDing 1000H
is 1000H ?
Y
Issue the operating mode control request
(Standby)
Issue the reset request
6
Issue the parameter setting request
Issue the operating mode control request
(Run)
Read the station status
N
Requested operating
mode ?
Y
End
120
Ethernet module User’s Manual
6.5 Sample Programs
(2) UDP transmission
Start (Sending side)
Read the socket status
Are bits C and D
"0" ?
N
Stop
Y
Issue the UDP open request
Normal completion ?
N
6
Stop
Y
Issue the UDP send request
Normal completion ?
N
Stop
Y
Issue the UDP close request
Normal completion ?
N
Stop
Y
End (Sending side)
6F8C0904
121
Chapter 6 Socket Interface Communication
(a) Defining the variables
(*========================================
EN311 UDP SOCKET TEST PROGRAM (SEND)
========================================*)
VAR
6
122
SLOTW:
WORD; (* Slot specification *)
OPEN_READ:
BOOL;
MREAD_CMP:
BOOL;
MREAD_CMPX:
BOOL;
STN_STS:
WORD; (* Station status *)
SOCKSTS:
WORD; (* Socket status *)
STBY_REQ:
BOOL;
PARA_REQ:
BOOL;
REQ_MODE:
BOOL;
CMP_MODE:
BOOL;
ERR_MODE:
BOOL;
STS_MODE:
INT; (* Standby request error status *)
CMP_RESET:
BOOL;
ERR_RESET:
BOOL;
STS_RESET:
INT; (* Reset request error status *)
CMP_PARA:
BOOL;
ERR_PARA:
BOOL;
STS_PARA:
INT; (* Parameter setup request error status *)
CMP_MODE2:
BOOL;
ERR_MODE2:
BOOL;
STS_MODE2:
INT; (* Run request error status *)
MREAD_CMP2:
BOOL;
NOT_RUN:
BOOL;
RUN1:
BOOL;
MREAD_CMP3:
BOOL;
OK_STS:
BOOL;
OPEN_CMP:
BOOL;
OPEN_ERR:
BOOL;
OPEN_STS:
INT; (* UDP open request error status *)
TX_REQ:
BOOL;
TX_CMP:
BOOL;
TX_ERR:
BOOL;
TX_STS
INT; (* UDP send request error status *)
CLOSE_CMP:
BOOL;
CLOSE_ERR:
BOOL;
CLOSE_STS:
INT; (* UDP close request error status *)
Ethernet module User’s Manual
6.5 Sample Programs
USEND_T_1:
USEND_T;
USEND_T_2:
USEND_T;
USEND_T_3:
USEND_T;
USEND_T_4:
USEND_T;
USEND_T_5:
USEND_T;
USEND_T_6:
USEND_T;
USEND_T_7:
USEND_T;
END_VAR
(b) Program
(*STATION STATUS CHECK*)
SLOTW
6
MOVE_WORD
ST
LD
6
OPEN_READ
MREAD
E
MREAD_CMP
( )
SLOTW
LD
T
16#7EFF
LD
TADDR
STN_STS
LD
P
1
LD
MREAD_CMP
STBY_REQ
N
PARA_REQ
MREAD_CMPX
( )
MREAD_CMPX
STN_STS
STN_STS
AND_WORD
LD
ST
16#1000
LD
STN_STS
EQ_WORD
STBY_REQ
(S)
LD
16#1000
LD
STN_STS
NE_WORD
LD
PARA_REQ
(S)
16#1000
LD
6F8C0904
123
Chapter 6 Socket Interface Communication
(*OPERATION MODE CONTROL REQUEST "STANDBY"*)
%MW3.310
6
MOVE_WORD
ST
LD
%MW3.311
16#0313
MOVE_WORD
ST
LD
%MW3.312
16#2000
MOVE_WORD
LD
ST
STBY_REQ
USEND_T_1
CMP_MODE
(S)
USEND_T
REQ DONE
%MW3.310
LD
ERR_MODE
CMD
STS_MODE
%MW3.290
LD
6
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
N
(*RESET REQUEST*)
%MW3.300
6
MOVE_WORD
ST
LD
%MW3.301
16#0311
MOVE_WORD
ST
LD
USEND_T_2
CMP_MODE
USEND_T
REQ DONE
%MW3.300
LD
ERR_RESET
CMD
(S)
ERROR
STS_RESET
%MW3.290
LD
CMP_RESET
(S)
P
STATUS
ST
%MW3.290
LD
124
N
Ethernet module User’s Manual
6.5 Sample Programs
(*PARAMETER SETTING REQUEST*)
%MW3.320
6
MOVE_WORD
ST
LD
%MW3.321
16#0312
MOVE_WORD
ST
LD
%MD3.322
16#85715A0A
MOVE_DWORD
ST
LD
%WM3.324
2000
MOVE_WORD
ST
LD
USEND_T_3
CMP_RESET
CMP_PARA
(S)
USEND_T
REQ DONE
PARA_REQ
%MW3.320
LD
ERR_PARA
CMD
6
STS_PARA
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
N
(*OPERATION MODE CONTROL REQUEST "RUN"*)
%MW3.310
6
MOVE_WORD
ST
LD
%MW3.311
16#0313
MOVE_WORD
ST
LD
%MW3.312
16#1010
MOVE_WORD
ST
LD
CMP_PARA
NOT_RUN
USEND_T_4
USEND_T
REQ DONE
%MW3.310
LD
ERR_MODE2
CMD
(S)
ERROR
STS_MODE2
%MW3.290
LD
CMP_MODE2
( )
P
STATUS
ST
%MW3.290
LD
6F8C0904
N
125
Chapter 6 Socket Interface Communication
(*STATION STATUS CHECK*)
SLOTW
6
MOVE_WORD
ST
LD
CMP_MODE2
MREAD
E
MREAD_CMP2
( )
SLOTW
LD
T
16#7EFF
LD
TADDR
STN_STS
LD
P
1
LD
6
MREAD_CMP2
N
STN_STS
STN_STS
AND_WORD
LD
ST
16#1000
LD
STN_STS
NE_WORD
NOT_RUN
( )
LD
16#1000
LD
STN_STS
EQ_WORD
LD
RUN1
(S)
16#1000
LD
126
Ethernet module User’s Manual
6.5 Sample Programs
(*SOCKET STATUS CHECK "SOCKET 1"*)
SLOTW
6
MOVE_WORD
ST
LD
RUN1
MREAD_CMP3
( )
MREAD
E
SLOTW
LD
T
16#7E47
LD
TADDR
SOCKSTS
LD
P
1
LD
MREAD_CMP3
N
6
SOCKSTS
SOCKSTS
AND_WORD
ST
LD
16#3000
LD
SOCKSTS
EQ_WORD
OK_STS
(S)
LD
0
LD
(*UDP OPEN REQUEST*)
%MW3.330
6
MOVE_UINT
LD
%MW3.331
16#0331
MOVE_WORD
LD
ST
%MW3.332
1
MOVE_WORD
LD
ST
%MW3.333
3000
MOVE_UINT
LD
OK_STS
ST
ST
USEND_T_5
OPNE_CMP
(S)
USEND_T
REQ DONE
%MW3.330
LD
OPEN_ERR
CMD
OPEN_STS
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
6F8C0904
N
127
Chapter 6 Socket Interface Communication
(*UDP SEND REQUEST*)
6
%MW3.340
16#2211
ST
LD
%MW3.341
16#4433
MOVE_UNIT
LD
16#0332
%MW3.1001 16#BBBB
ST
MOVE_WORD
LD
16#8571_5A14
LD
LD
3001
%MD3.343
16#8877
LD
%MW3.345
16#AA99
%MW3.1097
MOVE_WORD
ST
LD
%MW3.1004 16#EEEE
MOVE_WORD
ST
ST
LD
%MW3.1003 16#DDDD
ST
ST
%MW3.1096
MOVE_WORD
MOVE_WORD
MOVE_UINT
LD
%MW3.1002 16#CCCC
ST
MOVE_DWORD
ST
LD
MOVE_WORD
ST
%MW3.1095
MOVE_WORD
LD
%MW3.342 16#6655
1
ST
LD
MOVE_WORD
ST
%MW3.1094
MOVE_WORD
ST
MOVE_WORD
LD
%MW3.1000 16#AAAA
MOVE_WORD
LD
%MW3.1098
MOVE_WORD
ST
LD
ST
%MW3.999
100
MOVE_UINT
6
ST
LD
OPEN_CMP
OPEN_CMP2
OPEN_CMP2
( )
USEND_T_6
TX_CMP
(S)
USEND_T
REQ DONE
%MW3.340
LD
TX_ERR
CMD
TX_STS
%MW3.1000
LD
(S)
ERROR
P
STATUS
ST
%MW3.999
LD
N
(*UDP CLOSE REQUEST*)
%MW3.360
6
MOVE_UINT
LD
%MW3.361
16#0334
MOVE_WORD
LD
ST
%MW3.362
1
MOVE_UINT
LD
TX_CMP
ST
ST
USEND_T_7
CLOSE_CMP
(S)
USEND_T
REQ DONE
%MW3.360
LD
CLOSE_ERR
CMD
CLOSE_STS
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
128
N
Ethernet module User’s Manual
6.5 Sample Programs
(3) UDP reception
Start (Receiving side)
Read the socket status
Are bits C and D
"0" ?
N
Stop
Y
Issue the UDP open request
6
Normal completion ?
N
Stop
Y
Read the socket status
N
Is bit A "1" ?
Y
Issue the UDP receive request
Normal completion ?
N
Stop
Y
Issue the UDP close request
Normal completion ?
N
Stop
Y
End (Receiving side)
6F8C0904
129
Chapter 6 Socket Interface Communication
(a) Defining the variables
(*=============================================
EN311 UDP SOCKET TEST PROGRAM (RECEIVE)
=============================================*)
VAR
6
130
SLOTW:
WORD; (* Slot specification *)
OPEN_READ:
BOOL;
MREAD_CMP:
BOOL;
MREAD_CMPX:
BOOL;
STN_STS:
WORD; (* Station status *)
SOCKSTS:
WORD; (* Socket status *)
STBY_REQ:
BOOL;
PARA_REQ:
BOOL;
REQ_MODE:
BOOL;
CMP_MODE:
BOOL;
ERR_MODE:
BOOL;
STS_MODE:
INT; (* Standby request error status *)
CMP_RESET:
BOOL;
ERR_RESET:
BOOL;
STS_RESET:
INT; (* Reset request error status *)
CMP_PARA:
BOOL;
ERR_PARA:
BOOL;
STS_PARA:
INT; (* Parameter setup request error status *)
CMP_MODE2:
BOOL;
ERR_MODE2:
BOOL;
STS_MODE2:
INT; (* Run request error status *)
MREAD_CMP2:
BOOL;
NOT_RUN:
BOOL;
RUN1:
BOOL;
MREAD_CMP3:
BOOL;
OK_STS:
BOOL;
OPEN_CMP:
BOOL;
OPEN_ERR:
BOOL;
OPEN_STS:
INT; (* UDP open request error status *)
MREAD_CMP4:
BOOL;
OK_OPEN:
BOOL;
NOT_OPEN:
BOOL;
RX_REQ:
BOOL;
RX_CMP:
BOOL;
RX_ERR:
BOOL;
RX_STS:
INT; (* UDP receive request error status *)
CLOSE_CMP:
BOOL;
CLOSE_ERR:
BOOL;
CLOSE_STS:
INT; (* UDP close request error status *)
Ethernet module User’s Manual
6.5 Sample Programs
USEND_T_1:
USEND_T;
USEND_T_2:
USEND_T;
USEND_T_3:
USEND_T;
USEND_T_4:
USEND_T;
USEND_T_5:
USEND_T;
URCV_T_1:
URCV_T;
USEND_T_6:
USEND_T;
END_VAR
(b) Program
(*STATION STATUS CHECK*)
SLOTW
7
MOVE_WORD
ST
LD
6
OPEN_READ
MREAD
E
MREAD_CMP
(S)
SLOTW
LD
T
16#7EFF
LD
TADDR
STN_STS
LD
P
1
LD
6F8C0904
N
131
Chapter 6 Socket Interface Communication
MREAD_CMP
PARA_REQ
STBY-REQ
MREAD_CMPX
( )
MREAD_CMPX
STN_STS
STN_STS
AND_WORD
ST
LD
16#1000
LD
STN_STS
STBY_REQ
EQ_WORD
(S)
LD
16#1000
LD
STN_STS
PARA_REQ
NE_WORD
(S)
LD
16#1000
6
LD
(*MODE CONTROL REQUEST "STANDBY"*)
%MW3.410
7
MOVE_WORD
ST
LD
%MW3.411
16#0313
MOVE_WORD
ST
LD
%MD3.412
16#2000
MOVE_WORD
ST
LD
USENT_T_1
STBY_REQ
CMP_MODE
(S)
USEND_T
REQ DONE
%MW3.410
LD
ERR_MODE
CMD
STS_MODE
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
132
N
Ethernet module User’s Manual
6.5 Sample Programs
(*RESET REQUEST*)
%MW3.400
7
MOVE_WORD
ST
LD
%MW3.401
16#0311
MOVE_WORD
ST
LD
USEND_T_2
CMP_MODE
CMP_RESET
(S)
USEND_T
REQ DONE
%MW3.400
LD
ERR_RESET
CMD
STS_RESET
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
N
6
(*PARAMETER SETTING REQUEST*)
%MW3.420
7
MOVE_WORD
ST
LD
%MW3.421
16#0312
MOVE_WORD
ST
LD
16#8571_5A14
LD
%MD3.422
MOVE_DWORD
ST
%MW3.424
ST
2001
MOVE_UINT
LD
USEND_T_3
CMP_RESET
CMP_PAPA
(S)
USEND_T
REQ DONE
PAPA_REQ
%MW3.420
LD
ERR_PAPA
CMD
STS_PAPA
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
6F8C0904
N
133
Chapter 6 Socket Interface Communication
(*MODE CONTROL REQUEST "RUN"*)
%MW3.410
7
MOVE_WORD
ST
LD
%MW3.411
16#0313
MOVE_WORD
ST
LD
%MW3.412
16#1010
MOVE_WORD
ST
LD
CMP_PAPA
NOT_RUN
USEND_T_4
CMP_MODE2
( )
USEND_T
REQ DONE
%MW3.410
ERR_MODE2
CMD
LD
STS_MODE2
%MW3.290
P
LD
6
(S)
ERROR
STATUS
ST
%MW3.290
N
LD
(*STATION STATUS CHECK*)
SLOTW
7
MOVE_WORD
ST
LD
CMP_MODE2
MREAD
E
MREAD_CMP2
(S)
SLOTW
LD
T
16#7EFF
LD
TADDR
STN_STS
LD
P
1
LD
MREAD_CMP2
N
STN_STS
STN_STS
AND_WORD
LD
ST
16#1000
LD
STN_STS
NE_WORD
LD
NOR_RUN
( )
16#1000
LD
STN_STS
EQ_WORD
LD
RUN1
(S)
16#1000
LD
134
Ethernet module User’s Manual
6.5 Sample Programs
(*SOCKET STATUS CHECK "SOCKET 1"*)
SLOTW
7
MOVE_WORD
ST
LD
RUN1
MREAD
E
MREAD_CMP3
( )
SLOTW
LD
T
16#7E47
LD
TADDR
SOCKSTS
LD
P
1
LD
MREAD_CMP3
N
6
SOCKSTS
SOCKSTS
AND_WORD
LD
ST
16#3000
LD
SOCKSTS
EQ_WORD
OK_STS
(S)
LD
0
LD
(*UDP OPEN REQUEST*)
%MW3.430
7
MOVE_UNIT
ST
LD
%MW3.431
16#0331
MOVE_WORD
LD
%MW3.432
1
MOVE_WORD
LD
ST
%MW3.433
3001
MOVE_UNIT
LD
OK_STS
ST
ST
USEND_T_5
OPEN_CMP
USEND_T
REQ DONE
(S)
%MW3.430
LD
OPEN_ERR
CMD
OPEN_STS
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
6F8C0904
N
135
Chapter 6 Socket Interface Communication
(*SOCKET STATUS CHECK "SOCKET 1"*)
SLOTW
7
MOVE_WORD
ST
LD
OPEN_CMP
MREAD
E
MREAD_CMP4
( )
SLOTW
LD
T
16#7E47
LD
TADDR
SOCKSTS
LD
P
1
LD
6
MREAD_CMP4
N
SOCKSTS
SOCKSTS
AND_WORD
LD
ST
16#0400
LD
SOCKSTS
EQ_WORD
OK_OPEN
( )
LD
16#0400
LD
SOCKSTS
NE_WORD
LD
NOT_OPEN
( )
16#0400
LD
(*UDP RECEIVE REQUEST*)
%MW3.450
7
MOVE_UINT
ST
LD
%MW3.451
16#0333
MOVE_WORD
LD
%MW3.452
1
MOVE_WORD
LD
MOVE_DWORD
LD
ST
%MW3.455
3000
MOVE_UINT
LD
ST
%MW3.456
0
MOVE_WORD
LD
ST
%MW3.2999
101
MOVE_UINT
136
ST
%MW3.453
16#8571_5A0A
LD
ST
ST
Ethernet module User’s Manual
6.5 Sample Programs
OK_OPEN
RX_REQ
RX_REQ
( )
URCV_T_1
RX_CMP
(S)
URCV_T
REQ DONE
%MW3.450
LD
RX_ERR
CMD
RX_STS
%MW3.3000
LD
(S)
ERROR
P
STATUS
ST
%MW3.2999
LD
N
(*UDP CLOSE REQUEST*)
%MW3.460
7
MOVE_UINT
LD
%MW3.461
16#0334
MOVE_WORD
LD
ST
%MW3.462
1
MOVE_UINT
LD
RX_CMP
6
ST
ST
USEND_T_6
CLOSE_CMP
(S)
USEND_T
REQ DONE
%MW3.460
LD
CLOSE_ERR
CMD
CLOSE_STS
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
6F8C0904
N
137
Chapter 6 Socket Interface Communication
6.5.2
TCP socket sample programs
Two EN311 modules are mounted, one to Slot 6 and another to Slot 7 on the base. The
program for each module is to be registered as separate program.
• Transmission is performed via Slot 6, Socket 1 (Port number = 4000) ••• Active open
(timeout is 30 seconds) Æ Send Æ Close first
• Reception is performed via Slot 7, Socket 1 (Port number = 4001) ••• Passive open
(timeout is 30 seconds) Æ Receive Æ Close when RCLOSE is set to 1
• Number of send/receive words: 100 words
• Socket status address of Socket 1: 16 # 7E47 (word address)
(1) Initialization routine
Slot 6
Local station IP address: 133.113.90.10
Local station message transmission UDP port number: 4000
Slot 7
Local station IP address: 133.113.90.20
Local station message transmission UDP port number: 4001
6
138
Ethernet module User’s Manual
6.5 Sample Programs
Start
Read the station status
N
Run mode ?
7EFFH on DPRAM
(word address)
Is the result of ANDing 1000H
is 1000H ?
Y
Issue the operating mode control request
(Standby)
Issue the reset request
6
Issue the parameter setting request
Issue the operating mode control request
(Run)
Read the station status
N
Requested operating
mode ?
Y
End
6F8C0904
139
Chapter 6 Socket Interface Communication
(2) TCP transmission
Start (Sending side)
Read the socket status
Are bits C and D
"0" ?
N
Stop
Y
Issue the TCP open request: Active
6
Normal completion ?
N
Y
Timeout ?
N
Y
Issue the TCP send request
Normal completion ?
Stop
N
Stop
Y
Issue the TCP close request
Normal completion ?
N
Stop
Y
End (Sending side)
140
Ethernet module User’s Manual
6.5 Sample Programs
(a) Defining the variables
(*=================================================
EN311 TCP SOCKET TEST PROGRAM (SEND)
=================================================*)
VAR
6F8C0904
SLOTW:
WORD; (* Slot specification *)
OPEN_READ:
BOOL;
MREAD_CMP:
BOOL;
MREAD_CMPX:
BOOL;
STN_STS:
WORD; (* Station status *)
SOCKSTS:
WORD; (* Socket status *)
STBY_REQ:
BOOL;
PARA_REQ:
BOOL;
REQ_MODE:
BOOL;
CMP_MODE:
BOOL;
ERR_MODE:
BOOL;
STS_MODE:
INT; (* Socket status *)
CMP_RESET:
BOOL;
ERR_RESET:
BOOL;
STS_RESET:
INT; (* Reset request error status *)
CMP_PARA:
BOOL;
ERR_PARA:
BOOL;
STS_PARA:
INT; (* Parameter setup request error status *)
CMP_MODE2:
BOOL;
ERR_MODE2:
BOOL;
STS_MODE2:
INT; (* Run request error status *)
MREAD_CMP2:
BOOL;
NOT_RUN:
BOOL;
RUN1:
BOOL;
MREAD_CMP3:
BOOL;
OK_STS:
BOOL;
OPEN_REQ:
BOOL;
OPEN_REQ2:
BOOL;
OPEN_CMP:
BOOL;
OPEN_ERR:
BOOL;
OPEN_STS:
INT; (* TCP open request error status *)
TX_REQ:
BOOL;
TX_CMP:
BOOL;
TX_ERR:
BOOL;
TX_STS:
INT; (* TCP send request error status *)
CLOSE_CMP:
BOOL;
CLOSE_ERR:
BOOL;
CLOSE_STS:
INT; (* TCP close request error status *)
6
141
Chapter 6 Socket Interface Communication
USEND_T_1:
USEND_T;
USEND_T_2:
USEND_T;
USEND_T_3:
USEND_T;
USEND_T_4:
USEND_T;
USEND_T_5:
USEND_T;
USEND_T_6:
USEND_T;
USEND_T_7:
USEND_T;
END_VAR
(b) Program
(*STATION STATUS CHECK*)
SLOTW
6
MOVE_WORD
ST
LD
6
OPEN_READ
MREAD
E
MREAD_CMP
( )
SLOTW
LD
T
16#7EFF
LD
TADDR
STN_STS
LD
P
1
LD
142
N
Ethernet module User’s Manual
6.5 Sample Programs
MREAD_CMP
STBY_REQ
PARA_REQ
MREAD_CMPX
( )
MREAD_CMPX
STN_STS
STN_STS
AND_WORD
ST
LD
16#1000
LD
STN_STS
STBY_REQ
EQ_WORD
(S)
LD
16#1000
LD
STN_STS
PARA_REQ
NE_WORD
(S)
LD
16#1000
6
LD
(*MODE CONTROL REQUEST "STANDBY"*)
%MW3.310
6
MOVE_WORD
ST
LD
%MW3.311
16#0313
MOVE_WORD
ST
LD
%MW3.312
16#2000
MOVE_WORD
LD
ST
STBY_REQ
USEND_T_1
CMP_MODE
(S)
USEND_T
REQ DONE
%MW3.310
LD
ERR_MODE
CMD
_
STS MODE
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
6F8C0904
N
143
Chapter 6 Socket Interface Communication
(*RESET REQUEST*)
%MW3.300
6
MOVE_WORD
ST
LD
%MW3.301
16#0311
MOVE_WORD
ST
LD
CMP_MODE
ERR_MODE
USEND_T_2
USEND_T
REQ DONE
CMP_RESET
(S)
%MW3.300
LD
ERR_RESET
CMD
(S)
ERROR
%MW3.290
LD
6
STS_RESET
P
ST
STATUS
%MW3.290
LD
N
(*PARAMETER SETTING REQUEST*)
%MW3.320
6
MOVE_WORD
ST
LD
%MW3.321
16#0312
MOVE_WORD
ST
LD
%MW3.322
16#85715ADA
MOVE_DWORD
ST
LD
%MW3.324
2000
MOVE_WORD
ST
LD
USEND_T_3
USEND_T
REQ DONE
CMP_RESET
PARA_REQ
CMP_PARA
(S)
%MW3.320
LD
ERR_PARA
CMD
(S)
ERROR
%MW3.290
LD
STS_PARA
P
STATUS
ST
%MW3.290
LD
144
N
Ethernet module User’s Manual
6.5 Sample Programs
(*MODE CONTROL REQUEST "RUN"*)
%MW3.310
6
MOVE_WORD
ST
LD
%MW3.311
16#0313
MOVE_WORD
ST
LD
%MW3.312
16#1010
MOVE_WORD
ST
LD
CMP_PARA
NOT_RUN
USEND_T_4
USEND_T
REQ DONE
CMP_MODE2
( )
CMD
ERR_MODE2
(S)
%MW3.310
LD
ERROR
%MW3.290
LD
STS_MODE2
P
STATUS
6
ST
%MW3.290
LD
N
(*STATION STATUS CHECK*)
SLOTW
6
MOVE_WORD
ST
LD
CMP_MODE2
MREAD
E
MREAD_CMP2
( )
SLOTW
LD
T
16#7EFF
LD
TADDR
STN_STS
LD
P
1
LD
MREAD_CMP2
N
STN_STS
STN_STS
AND_WORD
LD
ST
16#1000
LD
STN_STS
NE_WORD
NOT_RUN
( )
EQ_WORD
RUN1
(S)
LD
16#1000
LD
STN_STS
LD
16#1000
LD
6F8C0904
145
Chapter 6 Socket Interface Communication
(*SOCKET STATUS CHECK "SOCKET 1"*)
SLOTW
6
MOVE_WORD
ST
LD
RUN1
MREAD
E
MREAD_CMP3
( )
SLOTW
LD
T
16#7E47
LD
TADDR
SOCKSTS
LD
P
1
LD
6
MREAD_CMP3
N
SOCKSTS
SOCKSTS
AND_WORD
LD
ST
16#3000
LD
SOCKSTS
EQ_WORD
LD
OK_STS
(S)
0
LD
146
Ethernet module User’s Manual
6.5 Sample Programs
(*TCP OPEN REQUSET "ACTIVE"*)
%MW3.630
6
MOVE_UINT
LD
%MW3.631
16#0335
MOVE_WORD
LD
ST
%MW3.632
1
MOVE_WORD
LD
ST
%MW3.633
1
MOVE_WORD
LD
ST
%MW3.634
16#8571_5A14
MOVE_DWORD
LD
ST
%MW3.636
4001
MOVE_UINT
LD
ST
6
%MW3.637
4000
MOVE_UINT
LD
ST
%MW3.638
300
MOVE_UINT
LD
OK_STS
ST
ST
OPEN_REQ
OPEN_REQ2
( )
OPEN_REQ2
USEND_T_5
OPNE_CMP
USEND_T
REQ DONE
(S)
OPEN_ERR
%MW3.630
LD
CMD
OPEN_STS
%MW3.290
LD
( )
ERROR
P
STATUS
ST
%MW3.290
LD
OPEN_ERR
N
OPEN_STS
EQ_INT
LD
OPEN_REQ
( )
16#0B20
LD
6F8C0904
147
Chapter 6 Socket Interface Communication
(*TCP SEND REQUEST*)
%MW3.640 16#1111
6
MOVE_UINT
%MW3.1000 16#BBBB
MOVE_WORD
ST
LD
%MW3.641 16#2222
16#0337
MOVE_WORD
LD
%MW3.1001 16#CCCC
LD
MOVE_WORD
LD
%MD3.999
16#4444
LD
100
%MW3.1002 16#DDDD
ST
LD
LD
%MW3.1004
16#FFFF
ST
LD
LD
MOVE_WORD
ST
%MW3.1099
MOVE_WORD
USEND_T_6
USEND_T
REQ DONE
ST
TX_CMP
(S)
%MW3.640
LD
%MW3.1098
MOVE_WORD
ST
LD
OPEN_CMP
ST
LD
%MW3.1003 16#EEEE
16#5555
6
%MW3.1097
MOVE_WORD
ST
MOVE_WORD
MOVE_WORD
ST
LD
MOVE_WORD
ST
%MW3.1096
MOVE_WORD
ST
%MW3.642 16#3333
1
ST
LD
MOVE_WORD
ST
%MW3.1095
MOVE_WORD
ST
LD
TX_ERR
(S)
CMD
ERROR
TX_STS
%MW31000
LD
P
STATUS
ST
%MW3.999
LD
N
(*TCP CLOSE REQUEST*)
%MW3.660
6
MOVE_UNIT
ST
LD
16#0339
LD
%MW3.661
MOVE_WORD
ST
%MW3.662
1
MOVE_UNIT
ST
LD
TX_CMP
TX_ERR
USEND_T_7
USEND_T
REQ DONE
%MW3.660
LD
CLOSE_CMP
(S)
CLOSE_ERR
(S)
CMD
ERROR
CLOSE_STS
%MW3.290
LD
P
STATUS
ST
%MW3.290
LD
148
N
Ethernet module User’s Manual
6.5 Sample Programs
(3) TCP reception
Start (Receiving side)
Read the socket status
Are bits C and D
"0" ?
N
Stop
Y
Issue the TCP open request: Passive
Normal completion ?
6
Y
N
Timeout ?
N
Y
Stop
Read the socket status
N
Is bit A "1" ?
Y
Issue the TCP receive request
Normal completion ?
N
Stop
Y
N
Read the socket status
Issue the TCP close request
Is bit B "0" and bit 9
"1" ?
Normal completion ?
N
Stop
Y
Y
End (Receiving side)
6F8C0904
149
Chapter 6 Socket Interface Communication
(a) Defining the variables
(*=============================================
EN311 TCP SOCKET TEST PROGRAM (RECEIVE)
=============================================*)
VAR
6
150
SLOTW:
WORD; (* Slot specification *)
OPEN_READ:
BOOL;
MREAD_CMP:
BOOL;
MREAD_CMPX:
BOOL;
STN_STS:
WORD; (* Station status *)
SOCKSTS:
WORD; (* Socket status *)
STBY_REQ:
BOOL;
PARA_REQ:
BOOL;
REQ_MODE:
BOOL;
CMP_MODE:
BOOL;
ERR_MODE:
BOOL;
STS_MODE:
INT; (* Standby request error status *)
CMP_RESET:
BOOL;
ERR_RESET:
BOOL;
STS_RESET:
INT; (* Reset request error status *)
CMP_PARA:
BOOL;
ERR_PARA:
BOOL;
STS_PARA:
INT; (* Parameter setup request error status *)
CMP_MODE2:
BOOL;
ERR_MODE2:
BOOL;
STS_MODE2:
INT; (* Run request error status *)
MREAD_CMP2:
BOOL;
NOT_RUN:
BOOL;
RUN1:
BOOL;
MREAD_CMP3:
BOOL;
OK_STS:
BOOL;
OPEN_REQ:
BOOL;
OPEN_REQ2:
BOOL;
OPEN_CMP:
BOOL;
OPEN_ERR:
BOOL;
OPEN_STS:
INT; (* TCP open request error status *)
ERR_STS:
BOOL;
MREAD_CMP4:
BOOL;
OK_STS2:
BOOL;
RX_REQ:
BOOL;
RX_CMP:
BOOL;
RX_ERR:
BOOL;
RX_STS:
INT; (* TCP receive request error status *)
MREAD_CMP5:
BOOL;
ERR_STS2:
BOOL;
OK_STS3:
BOOL;
CLOSE_CMP:
BOOL;
Ethernet module User’s Manual
6.5 Sample Programs
CLOSE_ERR:
BOOL;
CLOSE_STS:
INT; (* TCP close request error status *)
USEND_T_1:
USEND_T;
USEND_T_2:
USEND_T;
USEND_T_3:
USEND_T;
USEND_T_4:
USEND_T;
USEND_T_5:
USEND_T;
USEND_T_6:
USEND_T;
URCV_T_1:
URCV_T;
END_VAR
6
6F8C0904
151
Chapter 6 Socket Interface Communication
(b) Program
(*STATION STATUS CHECK*)
SLOTW
7
MOVE_WORD
ST
LD
OPEN_READ
MREAD
E
MREAD_CMP
( )
SLOTW
LD
T
16#7EFF
LD
TADDR
STN_STS
LD
P
1
6
LD
MREAD_CMP
STBY_REQ
N
PARA_REQ
MREAD_CMPX
( )
MREAD_CMPX
STN_STS
STN_STS
AND_WORD
LD
ST
16#1000
LD
STN_STS
EQ_WORD
STBY_REQ
(S)
NE_WORD
PARA_REQ
(S)
LD
16#1000
LD
STN_STS
LD
16#1000
LD
152
Ethernet module User’s Manual
6.5 Sample Programs
(*MODE CONTROL REQUEST "STANDBY"*)
%MW3.410
7
MOVE_WORD
ST
LD
%MW3.411
16#0313
MOVE_WORD
ST
LD
%MW3.412
16#2000
MOVE_WORD
LD
ST
STBY_REQ
USEND_T_1
CMP_MODE
(S)
USEND_T
REQ DONE
%MW3.410
LD
ERR_MODE
CMD
STS_MODE
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
6
%MW3.290
LD
N
(*RESET REQUEST*)
%MW3.400
7
MOVE_WORD
ST
LD
%MW3.401
16#0311
MOVE_WORD
ST
LD
USEND_T_2
CMP_MODE
USEND_T
REQ DONE
%MW3.400
LD
ERR_RESET
CMD
(S)
ERROR
STS_RESET
%MW3.290
LD
CMP_RESET
(S)
P
STATUS
ST
%MW3.290
LD
6F8C0904
N
153
Chapter 6 Socket Interface Communication
(*PARAMETER SETTING REQUEST*)
%MW3.420
7
MOVE_WORD
ST
LD
%MW3.421
16#0312
MOVE_WORD
ST
LD
%MD3.422
16#8571_5A14
MOVE_DWORD
ST
LD
%WM3.424
2001
MOVE_WORD
ST
LD
USEND_T_3
CMP_RESET
CMP_PARA
(S)
USEND_T
REQ DONE
PARA_REQ
%MW3.420
LD
6
ERR_PARA
CMD
STS_PARA
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
N
(*MODE CONTROL REQUEST "RUN"*)
%MW3.410
7
MOVE_WORD
ST
LD
%MW3.411
16#0313
MOVE_WORD
ST
LD
%MW3.412
16#1010
MOVE_WORD
ST
LD
CMP_PARA
NOT_RUN
USEND_T_4
USEND_T
REQ DONE
%MW3.410
LD
CMD
ERROR
ERR_MODE2
(S)
STS_MODE2
%MW3.290
LD
CMP_MODE2
( )
P
STATUS
ST
%MW3.290
LD
154
N
Ethernet module User’s Manual
6.5 Sample Programs
(*STATION STATUS CHECK*)
SLOTW
7
MOVE_WORD
ST
LD
CMP_MODE2
MREAD
E
MREAD_CMP2
( )
SLOTW
LD
T
16#7EFF
LD
TADDR
STN_STS
LD
P
1
LD
MREAD_CMP2
N
6
STN_STS
STN_STS
AND_WORD
LD
ST
16#1000
LD
STN_STS
NE_WORD
NOT_RUN
( )
EQ_WORD
RUN1
(S)
LD
16#1000
LD
STN_STS
LD
16#1000
LD
6F8C0904
155
Chapter 6 Socket Interface Communication
(*SOCKET STATUS CHECK "SOCKET 1"*)
SLOTW
7
MOVE_WORD
ST
LD
RUN1
MREAD
E
MREAD_CMP3
( )
SLOTW
LD
T
16#7E47
LD
TADDR
SOCKSTS
LD
P
1
LD
6
MREAD_CMP3
N
SOCKSTS
SOCKSTS
AND_WORD
LD
ST
16#3000
LD
SOCKSTS
EQ_WORD
LD
OK_STS
(S)
0
LD
156
Ethernet module User’s Manual
6.5 Sample Programs
(*TCP OPEN REQUEST "PASSIVE"*)
%MW3.730
7
MOVE_UINT
LD
ST
%MW3.731
16#0335
MOVE_WORD
LD
ST
%MW3.732
1
MOVE_WORD
LD
ST
%MW3.733
2
MOVE_WORD
LD
ST
%MW3.734
16#8571_5A0A
MOVE_DWORD
LD
ST
%MW3.736
4000
MOVE_UINT
LD
ST
6
%MW3.737
4001
MOVE_UINT
LD
ST
%MW3.738
300
MOVE_UINT
LD
ST
OPEN_REQ
OK_STS
OPEN_REQ2
( )
OPEN_REQ2
USEND_T_5
OPEN_CMP
(S)
USEND_T
REQ DONE
%MW3.730
LD
OPEN_ERR
CMD
OPEN_STS
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
OPEN_ERR
N
OPEN_STS
EQ_INT
LD
OPEN_REQ
( )
16#0B20
LD
6F8C0904
157
Chapter 6 Socket Interface Communication
(*SOCKET STATUS CHECK "SOCKET 1"*)
SLOTW
7
MOVE_WORD
ST
LD
OPEN_CMP
MREAD_CMP4
( )
MREAD
E
SLOTW
LD
T
16#7E47
LD
TADDR
SOCKSTS
LD
P
1
LD
6
MREAD_CMP4
N
SOCKSTS
SOCKSTS
AND_WORD
ST
LD
16#0400
LD
SOCKSTS
NE_WORD
ERR_STS
( )
EQ_WORD
OK_STS2
(S)
LD
16#0400
LD
SOCKSTS
LD
16#0400
LD
(*TCP RECEIVE REQUEST*)
%MW3.740
7
MOVE_UINT
LD
%MW3.741
16#0330
MOVE_WORD
LD
ST
%MW3.742
1
MOVE_WORD
LD
ST
%MW3.2999
101
MOVE_WORD
LD
OK_STS
ST
ST
URCV_T__1
RX_CMP
(S)
URCV_T
REQ DONE
%MW3.740
LD
RX_ERR
CMD
RX_STS
%MW3.3000
LD
(S)
ERROR
P
STATUS
ST
%MW3.2999
LD
158
N
Ethernet module User’s Manual
6.5 Sample Programs
(*SOCKET STATUS CHECK "SOCKET 1"*)
SLOTW
7
MOVE_WORD
ST
LD
ERR_STS2
RX_CMP
MREAD_CMP5
( )
MREAD
E
SLOTW
LD
T
16#7E47
LD
TADDR
SOCKSTS
LD
P
1
LD
MREAD_CMP5
N
6
SOCKSTS
SOCKSTS
AND_WORD
ST
LD
16#0A00
LD
SOCKSTS
NE_WORD
ERR_STS2
( )
EQ_WORD
OK_STS3
( )
LD
16#0200
LD
SOCKSTS
LD
16#0200
LD
(*TCP CLOSE REQUEST*)
%MW3.760
7
MOVE_UINT
LD
%MW3.761
16#0339
MOVE_WORD
LD
ST
%MW3.762
1
MOVE_UINT
LD
OK_STS3
ST
ST
USEND_T_6
CLOSE_CMP
(S)
USEND_T
REQ DONE
%MW3.760
LD
CLOSE_ERR
CMD
CLOSE_STS
%MW3.290
LD
(S)
ERROR
P
STATUS
ST
%MW3.290
LD
6F8C0904
N
159
Chapter 7 RAS Information
This chapter describes the following RAS functions provided by the EN311:
(1) EN311 status information
• Station status (S controller interface memory)
• Down information (S controller interface memory)
(2) Test functions from user programs
• Remote station verification request (corresponds to the UNIX ping command)
(3) Time setting function
(4) Information provided by RAS information readout
• LAN controller (network line) information
• Protocol state
• State of the S controller/EN311 interface
• Event traces
Caution
• Be sure to understand the contents of Chapter 7 thoroughly before writing programs. The
sample programs present basic examples of EN311 usage, and should be reviewed carefully before use in an actual system.
6F8C0904
161
Chapter 7 RAS Information
7.1 Station Status Information
The EN311 status information is displayed on the S controller interface memory and
should be read out to the S controller side using the MREAD instruction.
Each bit of the station status has the following meaning. Note that a register value is
should be used when determining the Initialization mode, Run mode or Standby mode.
• Status area address (word address) --- 16#7EFF (Decimal: 32511)
• Station status format
F
E
DOWN
D
C
B
A
9
8
7
6
0
0
0
0
0
0
STBY
INZ
4
3
2
1
0
0
0
MTEN
RUN
0
TEST
STEN
Bit F: DOWN (down)
7
5
1: Down mode,
0: Other than down mode
Bit E: INZ (initialization)
1: Initialization in progress
0: Initialization completed
Bit D: STBY (standby)
1: Standby mode
0: Other than standby mode
Bit C: RUN (run)
1: Run mode,
0: Other than run mode
Bit 5: MTEN (Message transmission)
1: Enabled,
0: Disabled
Bit 4: STEN (socket interface transmission) 1: Enabled,
0: Disabled
Bit 0: TEST (test)
1: Test function execution in progress
0: Test function completed or request
acceptance-waiting state
• EN311 operation modes and station statuses
EN311 Mode
162
Station Status
Initialization being processed (Power-ON, Reset request, Reset SW)
4000H
Standby mode (Initialization processing completed normally)
2000H
Run mode: Message transmission permit
1020H
Run mode: Socket I/F transmission permit
1010H
Run mode: Message transmission; socket I/F transmission permit
1030H
Ethernet module User’s Manual
7.1 Station Status Information
Important note
This area is a read-only area. Do not attempt to write data to it using the MWRITE
instruction. If you do, data may no longer be read correctly.
7
6F8C0904
163
Chapter 7 RAS Information
7.2 Down Information
When an EN311 goes down, the factor that caused that transition is stored in the S
controller interface memory as one word of data. This data can be read by the S
controller with the MREAD instruction.
Table 7-1 lists the down information error codes and the factors that caused the transition
to down mode.
Table 7-1 Down Information
Error code (H)
7
Description
0010
Watchdog timeout
0020
Memory bus stall
0030
A TRAP occurred
0040
Jabbering timeout
0050
LAN controller check error
0160
ROM BCC check data match error
0260
System RAM area check error
0360
S controller interface memory check error
0500, 0501
Semaphore acquisition error
0502, 0503
Semaphore acquisition error
0504
MBX receive error
0505
MBX send error
0506
TCP resend queue full
0507
Acquired buffer in use
0508
Error in acquiring initial buffer
Important note
This area is a read-only area. Do not attempt to write data to it using the MWRITE
instruction. If you do, data may no longer be read correctly.
164
Ethernet module User’s Manual
7.3 Remote Station Verification Request
7.3 Remote Station Verification Request
This request verifies the existence of the specified remote station, and corresponds to
the UNIX ping command. This request can be issued when the EN311 operating mode is
either run or standby mode. The EN311 will respond to this request if its operating mode
is either run or standby mode.
Remote station verification request (using the USEND_T instruction)
This is a request that verifies the existence of the specified remote station.
(1) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0315)
CMD+2
D-IP address: IP address of the remote station
to be verified
CMD+3
CMD+4
The input method of the remote station IP address to be verified is same as
the parameter setup request.
<Error status>
F
STATUS
0
=0: Normal completion, ± 0: Error status
Error status examples
Error status number
Description
-5001(16#EC77)
Command type error
2848(16#B20)
Timeout occurred
(2) Important notes
• This request is possible in run and standby modes if the local IP address is set up.
• The EN311 returns a response to this request in run and standby modes if the local IP
address is set up.
• If the remote station exists:Normal completion
• If the remote station does not exist (within 4 seconds):
Error status: Timeout occurred --- 2848(16#B20)
6F8C0904
165
7
Chapter 7 RAS Information
(3) Sample program
(a) Defining the variables
VAR
PING_REQ1:
BOOL;
PING_CMP1:
BOOL;
PING_ERR1:
BOOL;
PING_STS1:
INT; (* Remote station verification request error status *)
USEND_T_11:
USEND_T;
END_VAR
(b) Program
%MW3.380
6
MOVE_UINT
ST
LD
%MW3.381
16#0314
MOVE_WORD
ST
LD
%MW3.382
16#85715D9A
7
MOVE_DWORD
LD
ST
PING_REQ1
USEND_T_11
PING_CMP1
(S)
USEND_T
REQ DONE
%MW3.380
LD
CMD
PING_STS1
%MW3.370
LD
PING_ERR1
(S)
ERROR
P
STATUS
ST
TX_CONT
LD
166
N
Ethernet module User’s Manual
7.4 Time Setting
7.4 Time Setting
The EN311 internal time is set from the S controller. This information is used as the time
information in the EN311 event trace.
Time set request (using the USEND_T instruction)
This request sets the EN311 internal time from a user program. This information is used
as the time information in the EN311 event trace(read out using the RAS information
readout request).
(1) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0318)
CMD+2
Month
Year
CMD+3
Hour
Day
CMD+4
Second
Minute
7
<Error status>
F
STATUS
0
=0: Normal completion, ± 0: Error status
Error status examples
Error status number
Description
-5001(16#EC77)
Command type error
2831(16#B73)
Format error: Year
2832(16#B74)
Format error: Month
2833(16#B75)
Format error: Day
2834(16#B76)
Format error: Hour
2835(16#B77)
Format error: Minute
2836(16#B78)
Format error: Second
(2) Time specification format
• Enter the year, month, day, hour, minute, and second as BCD codes.
The date May 4, 2000 14:30:00 would be entered as:
6F8C0904
A+2
16#0500
A+3
16#1404
A+4
16#0030
167
Chapter 7 RAS Information
(3) Important notes
• This request can be executed in run or standby mode.
• The time set here is updated by the EN311 internal timer, and thus may get out of
synchronization with the S controller time. We recommend setting the EN311 time
once a day.
(4) Sample program
(a) Defining the variables
VAR
TIME_REQ1:
BOOL;
TIME_CMP1:
BOOL;
TIME_ERR1:
BOOL;
TIME_STS1:
INT; (* Time setting request error status *)
STACK:
WORD; (* For time data calculation *)
USEND_T_12:
USEND_T;
END_VAR
7
168
Ethernet module User’s Manual
7.4 Time Setting
(b) Program
%MW3.560
6
MOVE_UNIT
ST
LD
%MW3.561
16#0318
MOVE_WORD
ST
LD
%MW2.17
LD
STACK
SHL_WORD
IN
STACK
STACK
OR_WORD
ST
8
LD
ST
%MW2.16
LD
N
LD
%MW3.562
STACK
MOVE_WORD
ST
LD
%MW2.19
LD
STACK
SHL_WORD
IN
ST
8
STACK
STACK
OR_WORD
LD
ST
7
%MW2.18
LD
N
LD
%MW3.563
STACK
MOVE_WORD
ST
LD
%MW2.21
LD
STACK
SHL_WORD
IN
ST
8
STACK
STACK
OR_WORD
LD
ST
%MW2.20
LD
N
LD
%MW3.564
STACK
MOVE_WORD
ST
LD
USEND_T12
TIME_REQ1
USEND_T
REQ DONE
TIME_CMP1
(S)
CMD
TIME_ERR1
(S)
%MW3.560
LD
ERROR
TIME_STS1
%MW3.570
LD
P
STATUS
ST
TX_CONT
LD
6F8C0904
N
169
Chapter 7 RAS Information
7.5 RAS Information Readout
This request reads out the EN311 RAS information (internal error information and event
history) from a user program.
RAS information readout request (using the URCV_T instruction)
(1) Request command structure and error status
<Request command>
F
0
CMD
Destination EN311 module slot number
CMD+1
Command (16#0318)
CMD+2
RAS information type
CMD+3
Start position
CMD+4
Number of items read out
<Error status>
F
STATUS
7
0
=0: Normal completion, ± 0: Error status
Error status examples
Error status number
-5001(16#EC77)
Description
Command type error
(2) Request command details
• RAS request type:Specifies the type of RAS information read out.
1: RAS counter ••• LAN controller (line) information (see Table 7-2)
2: MIB information ••• LAN controller interface, IP, TCP, UDP, and ICMP information
(see Table 7-3 to Table 7-6)
3: Maintenance data (cannot be used)
4: Event trace information (see Table 7-7)
5: RAS information clear
• Start position:Only valid when the readout request type is 2 (MIB information) or 4
(trace information).
MIB information (2) ••• 0 = MIB_IF
1 = MIB_IP
2 = MIB_TCP
3 = MIB_UDP
4 = MIB_ICMP
Trace information (4) ••• 0 to 160; 0 corresponds to the most recent information.
170
Ethernet module User’s Manual
7.5 RAS Information Readout
(3) Important notes
• This request can be used in run and standby modes.
• The read out RAS information is stored in the specified register area as shown below.
RAS information word count
RAS information
← Specified register start address
← A register area whose size is the size of the read
out RAS information plus one word must be
allocated.
• A boundary error occurs if it is not possible to allocate an area that is the size of the
read out RAS information plus one word for the RAS information storage area.
Error status : -5060(16#EC3C)
• A parameter error occurs on any of the following transfer parameter settings.
Error status : -5001(16#EC77)
If the RAS request type is out of range (a value other than 1 to 5).
If the start position is out of range (a value of 4 or larger) for MIB information.
If the start position is out of range (a value of 161 or larger) for event trace information.
If the read count is out of range (a value of 31 or larger) for event trace information.
(4) Sample program
(a) Defining the variables
VAR
RAS_REQ1:
BOOL;
RAS_COMPLETE1:
BOOL;
RAS_ERROR1:
BOOL;
RCV_STATUS1:
INT; (* RAS information readout request error status *)
URCV_T_11:
URCV_T;
END_VAR
6F8C0904
171
7
Chapter 7 RAS Information
(b) Program
%MW3.350
6
MOVE_UINT
LD
ST
%MW3.351
16#0315
MOVE_WORD
LD
ST
%MW3.352
4
MOVE_WORD
ST
LD
%MW3.353
0
MOVE_UINT
LD
%MW3.354
30
MOVE_UINT
LD
RAS REQ1
ST
ST
URCV_T_11
RAS_COMPLETE1
(S)
URCV_T
REQ DONE
%MW3.350
7
LD
RAS ERROR1
CMD
RCV_STATUS1
%MW3.3967
LD
(S)
ERROR
P
STATUS
ST
%MW3.350
LD
172
N
Ethernet module User’s Manual
7.5 RAS Information Readout
(5) RAS information details
(a) RAS counters and LAN controller (line) information
Reads out 128 words of data using RAS information readout.
Table 7-2 RAS Counters
Symbol
Description
RAS_CNT [0]
Normal reception count
RAS_CNT [1]
Bus read error (reception buffer read failure) count
RAS_CNT [2]
Remote reset packet reception count
(Packets whose Ethernet header type was set to 0900H.)
RAS_CNT [3]
Short packet (packet length under 60 bytes) receptions count
RAS_CNT [4]
Alignment error (The number of bits in the received data was not divisible by
8) count
RAS_CNT [5]
CRC error (received packet CRC check error) count
RAS_CNT [6]
Overflow (incoming packets discarded due to full receive buffer) count
RAS_CNT [7]
Normal transmission count
RAS_CNT [8]
16 collisions occurred
•
•
•
RAS_CNT [127]
The following counters are reserved.
•
•
7
•
(b) MIB_IF ••• LAN controller interface information
Reads out 13 words of data using RAS information readout.
Table 7-3 MIB_IF
Symbol
Description
MIB_IF [0]
Interface number available to this system
MIB_IF [1]
Reserved
MIB_IF [2]
Interface type of the protocol under the IP layer
MIB_IF [3]
Time elapsed after the interface state changes
MIB_IF [4]
Total number of packets received by the interface
MIB_IF [5]
Number of non-broadcast/non-multicast packets routed to higher level
protocol
MIB_IF [6]
Number of broadcast/multicast packets routed to higher level protocol
MIB_IF [7]
Number of packets discarded due to resource limitations
MIB_IF [8]
Number of packets discarded due to format errors
MIB_IF [9]
Number of packets sent to an undefined protocol
MIB_IF [10]
Total number of octets transmitted by the interface
MIB_IF [11]
Number of non-broadcast/non-multicast packets from upstream
MIB_IF [12]
Number of broadcast/multicast packets from upstream
Packet:A unit of data flowing on the transmission path (see Figure 7-1).
6F8C0904
173
Chapter 7 RAS Information
(c) MIB information: IP protocol information
Reads out 17 words of data using RAS information readout.
Table 7-4 MIB_IP
Symbol
7
Description
MIB_IP [0]
This flag indicates whether the IP gateway is operating or not.
MIB_IP [1]
Default TTL (Time to Live) of the IP packet.
MIB_IP [2]
Total number of IP datagrams received form LAN controller interface.
MIB_IP [3]
Number of IP datagrams discarded due to format errors.
MIB_IP [4]
Number of IP datagrams discarded due to misdelivery
MIB_IP [5]
Number of IP datagrams transferred.
MIB_IP [6]
Number of IP datagrams sent to an undefined protocol.
MIB_IP [7]
Number of IP datagrams transferred upstream
MIB_IP [8]
Number of IP datagrams routed from upstream.
MIB_IP [9]
Number of datagrams discarded because there was no route.
MIB_IP [10]
Maximum number of seconds while the received fragment is retained and
waiting for reassemble.
MIB_IP [11]
Number of received IP datagrams for which reassemble is necessary.
MIB_IP [12]
Number of IP datagrams that were reassembled successfully.
MIB_IP [13]
Number of IP datagrams for which fragmentation failed.
MIB_IP [14]
Number of IP datagrams that were fragmented successfully.
MIB_IP [15]
Number of IP datagrams for which fragmentation failed and discarded.
MIB_IP [16]
Number of created IP fragments
IP datagram: The IP header and IP data sections of a packet (see Figure 7-1).
IP fragment:
Items that are divided into multiple IP datagrams when sending over 1500
bytes of data.
Reassemble: Restoring data to its original form from fragmented IP datagrams.
174
Ethernet module User’s Manual
7.5 RAS Information Readout
(d) MIB_TCP ••• TCP protocol information
Reads out 10 words of data using RAS information readout.
Table 7-5 MIB_TCP
Symbol
Description
MIB_TCP [0]
Maximum retransmission timeout time (in milli-seconds)
MIB_TCP [1]
Number of active open connections
MIB_TCP [2]
Number of passive open connections
MIB_TCP [3]
Number of times the connection open failed
MIB_TCP [4]
Number of connections currently established
MIB_TCP [5]
Number of segments received
MIB_TCP [6]
Number of segments transmitted
MIB_TCP [7]
Number of segments retransmitted
MIB_TCP [8]
Number of segments discarded due to format errors
MIB_TCP [9]
Number of generated resets
Segment:
The TCP header and TCP data block in an IP datagram (see Figure 7-1).
7
(e) MIB_UDP ••• UDP protocol information
Reads out 4 words of data using RAS information readout.
Table 7-6 MIB_UDP
Symbol
Description
MIB_UDP [0]
Number of UDP datagrams transferred upstream
MIB_UDP [1]
Number of UDP datagrams addressed to unused ports
MIB_UDP [2]
Number of UDP datagrams discarded due to format errors
MIB_UDP [3]
Number of UDP datagrams transferred from upstream
UDP datagrams: The UDP header and UDP data block in an IP datagram (see Figure 71).
(f) MIB_ICMP ••• ICMP protocol information
Reads out 5 words of data using RAS information readout.
Table 7-7 MIB_ICMP
Symbol
6F8C0904
Description
MIB_ICMP [0]
Number of ICMP messages received
MIB_ICMP [1]
Number of ICMP messages assumed to be having ICMP specific errors
MIB_ICMP [2]
Total number of ICMP messages transmitted
MIB_ICMP [3]
Reserved
MIB_ICMP [4]
Reserved
175
Chapter 7 RAS Information
(g) Event trace information
• Record size:
16 bytes (8 words)
• Number of records: 160
• Operation on overflow: Old information is updated. This means that it is
always possible to verify the 160 most recent event
trace records.
• Format:
Since this format is for EN311 internal data, it is
binary codes. However, the time is expressed in
BCD.
• Event codes/Detail information: See Table 7-8.
F
0
Event code
Detailed information 1
Detailed information 2
Detailed information 3
Detailed information 4
7
176
Month
Year
Hour
Day
Seconds
Minute
Time information BCD
Ethernet module User’s Manual
7.5 RAS Information Readout
Table 7-8 Event Trace Items
Event
code
Detail
information 1 (H)
0001H
ROM error (0160)
RAM error (0260)
DPRAM error
(0360)
0002H
Program address
0004H
Detail
information 2 (H)
Detail
information 3 (H)
Detail
information 4 (H)
Content
Initialization error
Error code
NMI
(0000)
Read port
contents
TRAP (0001)
None
Watchdog timer
check (0002)
Watchdog timer
flag
Watchdog timer
check (0003)
Watchdog timer
flag
Power on (0001)
NMI occurrence
factor
Start type
Reset switch
(0002)
Software reset
(0003)
Request code
Station status
Initialization
(0000)
Mode prior to
change
Mode after change
Control request
(0001)
Mode prior to
change
Mode after change
0007H
Task ID
Memory pool
number
Error code
0008H
Task ID
Station status
0009H
Receive response
code
0100H
CMD number
(0011)
0005H
0200H
Write port contents
Mode change
(Station status)
Instruction
storage buffer
allocation error
Transmission
disabled
Controller driver
reception/
response code
error
Error code
Station status
Write port contents Controller/EN311
interface
UDP port number completion error
CMD number
(0012)
UDP port (0001)
Station status
(0002)
Station status
CMD number
(0013)
Mode prior to
change
Mode after change
Task start number
Task completion
status
MAC setting flag
IP setting flag
Task ID
Error code
socket (0001)
Message
transmission
completion error
bind (0002)
sendto (0003)
length (0004)
Length
recvfrom (0005)
0300H
6F8C0904
Task ID
Request code
Error code
Socket
transmission
completion error
177
7
Chapter 7 RAS Information
Preamble (7 bytes)
Signal used to synchronize reception
SFD (Start Frame Delimiter) (1 byte)
Remote station address (6 bytes)
Local station address (6 bytes)
Ethernet type (2 bytes)
0800H:IP, 0806H:ARP
IP header (20 bytes)
7
UDP header
(8 bytes)
Packet
flowing on
the
transmission
path
(72 to 1526
bytes)
TCP header
(20 bytes)
UDP data field
(up to 1472 bytes)
IP datagram
(46-1500 bytes)
= Data field of
the packet
flowing on the
transmission
path
IP data field
(up to 1480
bytes)
TCP data field
(up to 1460 bytes)
FCS (Frame Check Sequence) (4 bytes)
32-bit CRC code for the sections of the packet other than
the preamble, the SFD, and the FCS. (Packet error
detection)
178
Ethernet module User’s Manual
7.5 RAS Information Readout
Figure 7-1 Packet Format/IP Datagram
7
6F8C0904
179
Chapter 7 RAS Information
7
180
Ethernet module User’s Manual
Chapter 8 Error Handling
This chapter describes the error analysis and recovery procedures for errors that occur
while using the EN311. Also refer to the S controller user's manual when recovering from
EN311-related errors.
6F8C0904
181
Chapter 8 Error Handling
8.1 LED Display
The EN311 indicates its module status in the RUN, STBY, ACC, and EXT.POWER
LEDs.
Table 8-1 lists the states indicated by the RUN and STBY LEDs. Note that the EN311
operating mode can be determined by the combination of the RUN and STBY LED
display states as listed in Table 8-2.
User programs should read out and verify the down information error codes listed in
Table 8-2 using the MREAD instruction issued for the down information in the S controller
interface buffer (see section 7.2, "Down Information").
Modules that fail (go to the down state) should be replaced.
Table 8-1 States Indicated by the RUN and STBY LEDs
LED display
Description
RUN(Run)
Indicates the module normal/error (down mode) status.
On
Module normal
Off
Module error (down)
STBY(Standby)
Indicates the module operating mode when the module is operating
normally and an abbreviated error indication when the module is down.
On
Standby (normal mode)
Off
Run (normal mode)/Self-diagnostics error (down mode)
Blinking
Module went down during operation (down mode)
8
182
Ethernet module User’s Manual
8.1 LED Display
Table 8-2 Module Down States Indicated by RUN/STBY LED Combinations
LED combination
displayed
RUN On, STBY On
Module operating normally in standby mode (parameter setup waiting
state)
The module goes to this state after power is first applied and after a
reset.
RUN On, STBY Off
Module operating normally in run mode (transmission possible)
The module switches to this mode in response to an operating mode
control request. (Parameter setup is required to switch the module to
run mode.)
RUN Off, STBY Blinking
An error occurred during operation and the module is down.
RUN Off, STBY Blinking
RUN Off, STBY Off
6F8C0904
Description
Possible causes of the module going down
Down information
error code
Watchdog timeout occurred
0010H
Memory bus stall occurred
0020H
Trap occurred
0030H
Jabbering timeout occurred
0040H
Semaphore acquisition error
0500H, 0501H
Semaphore acquisition error
0502H, 0503H
MBX reception error
0504H
MBX transmission error
0505H
No empty TCP resend queue
0506H
Acquired buffer was in use
0507H
Initial buffer acquisition error
0508H
8
Down mode due to the occurrence of an error during self-diagnostics
at power on.
Possible causes of the module going down
Down information
error code
LAN controller check error
0050H
ROM BCC check found a discrepancy
0160H
System RAM area check error
0260H
S controller interface memory check error
0360H
183
Chapter 8 Error Handling
The ACC LED indicates when the S controller is accessing the EN311 and the
EXT.POWER LED indicates when 12-VDC power is supplied to the MAU power supply
terminals.
Table 8-3 States Indicated by the ACC and EXT.POWER LEDs
LED display
ACC(Access)
Description
Indicates whether or not the S controller is accessing the module.
• On ••• The S controller is accessing the module.
• Off ••• The S controller is not accessing the module.
• On after EN311 initialization completes when power is first
applied. (Access starts.)
If this LED does not turn on after power is turned on:
1) First, verify that the S controller and the EN311 are correctly
connected to the base unit. Then:
Check the modules by
2) Combining the EN311 with a different S controller.
3) Combining the S controller with a different EN311.
If this LED does not turn on at step 2 above, then the EN311 itself
is defective. Replace the EN311.
If this LED (in the alternate EN311) does not turn on at step 3
above, then the S controller firmware does not support the EN311
or the S controller itself is defective. If the S controller is defective
replace it.
8
Supplement:
We recommend keeping spares on hand to minimize the time
required determining the location of the fault using the above
procedure and to minimize the time required for recovery.
EXT.POWER
(External power)
Indicates whether or not 12-VDC power is supplied to the
MAU power supply terminals.
• On ••• 12-V power is supplied normally.
• Off ••• 12-V power is either not supplied, or is abnormal.
• If the S controller side power is not turned on, this LED will not
light.
If this LED does not turn on even if the S controller power is
turned on, check:
1) whether or not the external power supply is operating correctly
2) whether or not the external power supply is connected with reverse
polarity.
Replace the module if neither of the above caused the
problem.
184
Ethernet module User’s Manual
8.2 Error Status
8.2 Error Status
The error status indicates the status after USEND_T/URCV_T instruction execution
completes. If a USEND_T/URCV_T instruction does not complete normally, refer to the
error status and review the instruction word format at the S controller as well as the
EN311 states (operating modes).
For information on the error status, refer to Table 4-2 and Table 4-3.
8
6F8C0904
185
Chapter 8 Error Handling
8.3 Station Status
The statuses of the EN311 (station statuses) are indicated by the S controller interface
memory. The station statuses can be read out to the S controller side using the MREAD
instruction. For more information, refer to section 7.1, "Station Status Information".
8
186
Ethernet module User’s Manual
8.4 Socket Interface Information
8.4 Socket Interface Information
The information for the eight socket interface sockets held by the EN311 can be read out
with the S controller MREAD instruction (see section 6.3, "Socket Interface Information").
The EN311 holds five words of socket status information for each socket(see Table 6-1).
8
6F8C0904
187
Chapter 8 Error Handling
8.5 Troubleshooting
(1) f the module fails to start up normally (i.e., does not reach standby state.)
If the module is functional, then the EN311 can be initialized and brought to the
standby state (the RUN and STBY LEDs turn on) by applying power, by pressing the
reset switch, or by issuing a reset request.
Start
Is power supplied to the
power module ?
No
Apply the related line voltage to the
primary side of the power module
No
Insert the EN311 into its slot correctly
and tighten the lock screws.
Yes
Is the EN311 correctly
mounted in the base unit ?
Yes
8
Is the station status a value
other than that indicating
down mode ?
No
Yes
Can the EN311 be brought
up normally when used in
combination with other S
controller ?
Replace the module.
No
Read out the down information and
send it to Toshiba together with the
module.
Yes
Replace the S controller.
One of the possible
causes is the following:
・ The S controller failed.
End
(2) When the EN311 fails during operation
Recovery procedure
Replace the module.
Before replacing the module, read out the down information, and then send both that information
and the module to Toshiba.
188
Ethernet module User’s Manual
8.5 Troubleshooting
(3) When the EN311 fails to enter run mode
This section assumes that the module has started normally up to this point. Note that
the parameters must be set up with a parameter setup request before issuing the
operating mode control request used to switch the module from standby mode to run
mode.
(a) Parameter setup request
Start
Is the operating mode
control request executed ?
No
Set up the IP address and the
message transmission UDP port
number.
No
Confirm the status when the
USEND_T or URCV_T is not
completed.
Yes
Is the USEND_T instruction
completed ?
Fasten the setscrew.
Yes
8
Check the completion status and
eliminate the cause of the error.
End
6F8C0904
To the operating mode control request
189
Chapter 8 Error Handling
(b) Operating mode control request
Start
Is the operating mode
control request executed ?
No
Set up the correct information as
specified and issue an operating
mode control request.
Yes
Is the USEND_T instruction
completed ?
No
Confirm the status when the
USEND_T or URCV_T is not
completed.
Yes
Have the parameters not
been set up yet ?
8
No
The EN311 internal MAC address has
been corrupted.
Replace the module.
Yes
Check the completion status and
eliminate the cause of the error.
End
190
Ethernet module User’s Manual
8.5 Troubleshooting
(4) When computer link protocol transmission fails
(a) Host computer side (main station)
Start
Is the transmission
destination IP address set
to that of the slave station
EN311 ?
No
Check the slave station EN311 IP
address.
Yes
Is the slave station message
transmission UDP port number
correct ?
No
Note: There are separate send and
receive ports that each have
their own message transmission
UDP port number.
Yes
Is there any error on the
computer link protocol ?
Check the slave station message
transmission UDP port number.
No
Check the computer link protocol
format.
8
Yes
Does a response come
back if a PING is issued
to the slave station
EN311 ?
Yes
No
1) Check the slave station IP address
and message transmission UDP
port number again.
2) Configure the router if there is a
router on the transmission line.
3) Check the network verification
items.
Check the network verification items
(except the items related to the
EN311).
End
6F8C0904
191
Chapter 8 Error Handling
(b) EN311 side (slave station)
Start
Is the station status
such that run + message
transmission is
enabled ?
No
Set the station to run + message
transmission enabled using an
operating mode control request.
Yes
Does a response come
back if a PING is
issued to the host
computer ?
1) Check the host computer IP
address.
No
2) Configure the router if there is a
router on the transmission line.
3) Check the network verification
items.
Yes
Is the error counter read out
from the RAS information
constant ?
8
Yes
No
It is possible that there is an error on
the network itself. Check the network
verification items.
AS error counters:
Alignment error,
Short packet,
CRC error
End
192
Ethernet module User’s Manual
8.5 Troubleshooting
(5) When PC link protocol transmission fails
(a) Main station EN311
Start
Is the USEND_T or
URCV_T instruction
completed ?
No
Confirm the status when the USEND_T
or URCV_T is not completed.
Yes
A response timeout
occurred ?
No
Error status --- 5052
Is the station status
such that run +
message transmission
is enabled ?
Yes
Yes
Refer to the completion status and
eliminate the cause of the error.
Is the transmission
destination IP address set
to that of the slave station
EN311 ?
No
No
Set the station to run + message
transmission enabled using an
operating mode control request.
Verify the slave station EN311
transmission destination IP address.
8
Yes
Is the slave station
message transmission UDP
port correct ?
No
Verify the slave station EN311
message transmission UDP port
number.
Note: There are separate send and
receive ports that each have their own
message transmission UDP port
number.
Yes
Does a response come
back if a PING is issued
to the slave station
EN311 ?
No
Yes
Is the error counter read out
from the RAS information
constant ?
Yes
No
1) Check the slave station IP address
and message transmission UDP
port number again.
2) Configure the router if there is a
router on the transmission line.
3) Check the network verification
items.
It is possible that there is an error on
the network itself. Check the network
verification items.
RAS error counters: Alignment error
Short packet,
CRC error
End
6F8C0904
193
Chapter 8 Error Handling
(b) EN311 side (slave station)
Start
Is the station status
such that run +
message transmission
is enabled ?
No
Set the station to run + message
transmission enabled using an
operating mode control request.
Yes
1) Check the main station IP address.
Does a response come
back if a PING is issued
to the main station
EN311 ?
No
2) Configure the router if there is a
router on the transmission line.
3) Check the network verification
items.
Yes
Is the error counter read out
from the RAS information
constant ?
8
Yes
No
It is possible that there is an error on
the network itself. Check the network
verification items.
RAS error counters: Alignment error
Short packet
End
194
CRC error
Ethernet module User’s Manual
8.5 Troubleshooting
(6) When transmission using UDP sockets fails
(a) Open and close requests
Start
Is the USEND_T instruction
completed ?
No
Confirm the status when the
USEND_T or URCV_T is not
completed.
Yes
s the station status such
that run + socket
transmission is
enabled ?
No
Set the station to run + socket
transmission enabled using an
operating mode control request.
Yes
Refer to the completion status and
eliminate the cause of the error.
8
End
6F8C0904
195
Chapter 8 Error Handling
(b) Send request
Start
Is the USEND_T instruction
completed ?
No
Confirm the status when the
USEND_T or URCV_T is not
completed.
Yes
Is the station status such that
run + socket transmission is
enabled ?
No
Set the station to run + socket
transmission enabled using an
operating mode control request.
No
Verify the remote station IP address.
No
Open the UDP ports on the local and
remote nodes.
No
Refer to the completion status and
eliminate the cause of the error.
Yes
Is the transmission
destination IP correct ?
8
Yes
Are the UDP ports on the local
and remote nodes opened ?
Yes
Does the status indicate a
normal completion ?
Yes
Does a response come
back if a PING is issued
to the slave station
EN311 ?
1) Check the slave station IP address
and message transmission UDP
port number again.
No
3) Check the network verification
items.
Yes
Is the error counter read out
from the RAS information
constant ?
Yes
2) Configure the router if there is a
router on the transmission line.
No
Is the error counter read out from the
RAS information constant ?
RAS error counters: Alignment error
Short packet,
CRC error
End
196
Ethernet module User’s Manual
8.5 Troubleshooting
(c) Receive request
Start
Is the URCV_T
instruction completed ?
No
Is the waiting time set
to unlimited ?
Yes
A timeout occurred ?
Is the station status
such that run + socket
transmission is
enabled ?
No
Confirm the status when the
USEND_T or URCV_T is not
completed.
Yes
①
Error status --- 2848
No
No
Set the station to run + socket
transmission enabled using an
operating mode control request.
Yes
Yes
①
Has the local port been
opened ?
No
Open the local UDP port.
Yes
Refer to the completion status
and eliminate the cause of the
error.
Is the remote station
transmitting data ?
No
Transmit data from the remote station.
No
Verify the remote node IP address
and UDP port number.
8
Yes
Are the remote node
IP address and UDP port
number correct ?
Yes
Does a response come
back if a PING is issued to the
remote station ?
No
1) Check the remote station IP
address and message transmission
UDP port number again.
2) Configure the router if there is a
router on the transmission line.
3) Check the network verification
items.
No
It is possible that there is an error on
the network itself. Check the network
verification items.
Yes
Is the error counter
read out from the RAS information
constant ?
Yes
RAS error counters:
Short packet,
Alignment error
CRC error
End
6F8C0904
197
Chapter 8 Error Handling
(7) When Transmission Using TCP Sockets Fails
When troubleshooting TCP sockets, also refer to the "TCP Socket Notes" section.
(a) Open request
Start
Is the URCV_T
instruction completed ?
No
Is the waiting time set
to unlimited ?
Yes
A timeout occurred ?
Is the station status
such that run + socket
transmission is
enabled ?
No
Yes
①
Is the program
attempting to issue an active
open to a socket in the passive
open state ?
8
Confirm the status when the
USEND_T or URCV_T is not
completed.
No
Set the station to run + socket
transmission enabled using an
operating mode control request.
Yes
①
Error status --- 2848
No
Yes
Refer to the completion status
and eliminate the cause of the
error.
No
Decide which role each socket will
play when establishing a connection
between a pair of sockets.
No
Verify the remote node IP address
and UDP port number.
Yes
Are the remote node
IP address and UDP port
number correct ?
Yes
Does a response come
back if a PING is issued to the
remote station ?
1) Check the slave station IP address
and message transmission UDP
port number again.
No
3) Check the network verification
items.
Yes
Is the error counter
read out from the RAS information
constant ?
Yes
2) Configure the router if there is a
router on the transmission line.
No
It is possible that there is an error on
the network itself. Check the network
verification items.
RAS error counters:
Short packet,
Alignment error
CRC error
End
198
Ethernet module User’s Manual
8.5 Troubleshooting
(b) Close request
Start
Is the USEND_T
instruction completed ?
No
Confirm the status when the
USEND_T or URCV_T is not
completed.
No
Set the station to run + socket
transmission enabled using an
operating mode control request.
Yes
Is the station status
such that run + socket
transmission is
enabled ?
Yes
Refer to the completion status and
eliminate the cause of the error.
8
End
6F8C0904
199
Chapter 8 Error Handling
(c) Send request
Start
Is the USEND_T
instruction completed ?
No
Confirm the status when the
USEND_T or URCV_T is not
completed.
No
Set the station to run + socket
transmission enabled using an
operating mode control request.
No
Establish the connection between the
local TCP and the remote TCP.
Yes
Is the station status such
that run + socket transmission
is enabled ?
Yes
Is the TCP connection
established ?
Yes
Is the socket status
RCLOSE bit 1 or 0 ?
8
1
Close the socket.
0
Is the socket status
NOACK bit 1 or 0 ?
1
Close the socket.
0
Does a response come
back if a PING is issued to the
remote station ?
No
1) Check the remote station IP
address and message transmission
UDP port number again.
2) Configure the router if there is a
router on the transmission line.
3) Check the network verification
items.
No
It is possible that there is an error on
the network itself. Check the network
verification items.
Yes
Is the error counter
read out from the RAS information
constant ?
Yes
RAS error counters:
Short packet,
Alignment error
CRC error
Refer to the completion status and
eliminate the cause of the error.
End
200
Ethernet module User’s Manual
8.5 Troubleshooting
(d) Receive request
Start
Is the USEND_T
instruction completed ?
No
Is the waiting time set
to unlimited ?
Yes
A timeout occurred ?
Error status --- 2848
①
Yes
Confirm the status when the
USEND_T or URCV_T is not
completed.
Yes
Is the station status
such that run + socket
transmission is
enabled ?
No
No
No
Set the station to run + socket
transmission enabled using an
operating mode control request.
Yes
Is the connection
established ?
①
No
Establish the connection with
the remote node.
Yes
Refer to the completion status
and eliminate the cause of the
error.
Is the remote node
transmitting ?
No
Yes
Does a response come
back if a PING is issued to the
remote station ?
Yes
8
1) Check the slave station IP address
and message transmission UDP
port number again.
No
2) Configure the router if there is a
router on the transmission line.
3) Check the network verification
items.
Yes
Is the error counter
read out from the RAS information
constant ?
Transmit a message to the remote
node.
No
It is possible that there is an error on
the network itself. Check the network
verification items.
RAS error counters:
Short packet,
Alignment error
CRC error
End
6F8C0904
201
Chapter 8 Error Handling
(8) Network verification items (EN311)
Verification items
Resolution
EN311 external 1) Is the 10BASE5/10BASE2 switch
1) Set the 10BASE5/10BASE2 switch
power supply
set to the position corresponding to
to the correct position.
the transmission medium actually
used?
2) Does the EXT.POWER LED turn on 2) Check whether or not the 12-VDC
?
power is supplied to the MAU power
supply terminals.
If the LED does not turn on even
when the 12-VDC power is
supplied, → replace the module.
Transmission
medium
installation
10BASE5
1) Is the AUI cable connected between 1) Verify the AUI cable connections
the EN311 and the MAU ?
between the EN311 and MAU units.
2) Are the MAU units installed with a
spacing of 2.5 meters of coaxial
cable between units ?
2) Connect the MAU units correctly at
the marked sections of the coaxial
cable.
Marked section spacing: 2.5 meters
3) Does the MAU 12-VDC power
supply LED turn on ?
3) Replace the AUI cables and the
MAUs with other units to verify their
operation.
Supplement:
We recommend keeping spares on
hand to minimize the time required
determining the location of the fault
using the above procedure and to
minimize the time required for
recovery.
4) How long (in meters) are the AUI
cable ?
4) The maximum AUI cable length is
50 meters.
8
5) How long (in meters) are the coaxial 5) The maximum segment length for
cable (i.e. segment lengths) ?
10BASE5 cabling is 500 meters.
Transmission
medium
installation
10BASE2
1) Is the coaxial cable connected to
the EN311 ?
1) Verify the AUI cable connections
between the EN311 and MAU units.
(These are the T-connector
connections.)
2) Is the spacing between stations
(nodes) as mounted at least 0.5
meter ?
2) Set the cable length so that the
mounting spacing is at least 0.5
meter.
3) How long (in meters) are the coaxial 3) The maximum segment length for
cable (i.e. segment lengths) ?
10BASE2 cabling is 185 meters.
202
Ethernet module User’s Manual
8.5 Troubleshooting
Network cable
check
Verification items
Resolution
1) Is the coaxial cable (10BASE5 or
10BASE2) grounded to a single
point with a resistance to ground of
100Ω or less ?
1) Coaxial cables must be grounded to
a single point with a resistance to
ground of 100Ω or less.
2) Do all nodes on the network
respond to PING correctly?
2) Inspect the coaxial cables for missing
termination resistors and damage.
3) Is the collision (COL) indicator
blinking frequently?
3) Since network loading is heavy:
• Transmission efficiency can be
degraded (TCP), and
• There is an increased possibility of
packet loss (UDP).
Therefore, the circuit usage conditions
should be reviewed.
4) Are the error counters read out from 4) Check whether there are any
the RAS information increasing as
defective (or substandard)
time passes?
connections on the cables and at
Error counters:
the MAUs and T-connectors.
Alignment error, Short packet, CRC
Check for the presence of noise
error
sources in the vicinity of the
network cables.
8
6F8C0904
203
Chapter 9 Installation and Wiring
9.1 Installation Environment and Base Unit Mounting
The EN311 must be used in the installation environment described in "Installation
Environment" section of the S3 User's Manual - Hardware. Also, the EN311 panel must
be installed according to the guideline included in "Installation Environment" section.
The S controller base unit must also be mounted according to the guideline included in
section 4.2, "Registering the EN311" of the T3 User's Manual - Hardware.
Caution
• Only use this equipment in the environment described in the S3 User's Manual - Hardware.
Using this equipment in any other environment can cause electrical shocks, fires, failures,
and malfunctions.
• Mount this equipment according to the mounting procedure specified in the S3 User's Manual - Hardware.
Mounting in any direction other than the specified direction, or defective or inadequate
mounting, can result in the equipment falling, fires, failures, and malfunctions.
6F8C0904
205
Chapter 9 Installation and Wiring
9.2 Mounting and Removing Modules
Be sure to follow the guideline included in "Mounting Modules" section in the S3 User's
Manual - Hardware.
Caution
• The EN311 is designed specially for the S controller and should only be mounted and used
in an S controller base unit. Do not use this module independently or mounted in any other
equipment. Such usage could result in electrical shocks, personal injury, or damage to the
EN311 and other equipment.
• The EN311 itself should only be mounted or removed when all power is turned off. Similarly,
connections to the terminal block should only be made or removed when all power is turned
off. Not observing this precaution could result in electrical shocks, malfunctions, or damage
to the EN311 or other equipment.
• Do not allow foreign objects such as wire shreds to get into the EN311. This could result in
fire, breakdown, or malfunction.
• Verify that connectors, cables, and the mounting of the EN311 itself in the base unit are all
secured with screws or stops and that there is no play, missing screws, or disconnections in
any of these parts.
If any of these parts is inadequately secured, breakdown or malfunction could occur as the
result of vibration.
9
206
Ethernet module User’s Manual
9.3 Power Supply Wiring and Grounding
9.3 Power Supply Wiring and Grounding
(1) Power supply wiring
(a) S controller power supply wiring
Wire the S controller power according to the items presented in "Wiring of the
Power Supply" section in the S3 User's Manual - Hardware.
Use shielded transformers and noise filters if the power supply has a high noise
level.
(b) Power supply wiring for the MAU power supply terminals
See section 3.5, "MAU Power Supply" in this document.
(2) Grounding
(a) S controller Grounding
Wire the S controller power according to the items presented in "Grounding"
section in the S3 User's Manual - Hardware.
(b) Grounding for the MAU power supply terminals
See section 3.5, "MAU Power Supply". This ground is critical for noise prevention
for the 10BASE5 AUI cables.
Warning
• Turn off all power before wiring or connecting any cables.
Wiring or connecting cables with the power on can lead to electrical shocks.
• Either use crimp-on connectors with sheaths or wrap exposed conductors with insulating
tape so that no conductors are exposed.
Also, handle the terminal block cover so that it is not lost or damaged. When the wiring operations are done, do not fail to reinstall the terminal block cover on the terminal block.
Leaving conductors exposed can lead to electrical shocks.
• Ground the equipment.
Electrical shocks and malfunctions are possible if equipment is not grounded correctly. In
particular, the MAU power supply terminal grounding is critical for AUI cable noise prevention.
Caution
• Connect a power source that matches the ratings for the MAU power supply terminal block.
Be sure to connect the 12-VDC power + and - sides correctly. Use of incorrect wiring or a
power supply with an incorrect rating can cause explosions or fires.
• Only the qualified personnel should perform all wiring operations.
Incorrect wiring can cause fires, breakdowns, and electrical shocks.
6F8C0904
207
9
Chapter 9 Installation and Wiring
9.4 Network Wiring
See section 3.6, "Network Wiring Equipment" for details on the equipment that makes up
the network. This section presents an outline of the wiring laid inside the control panel
and outside the control panel. This section also presents individual notes on the coaxial
cables used, the AUI cables, and the MAUs.
Caution
• When laying network cable, take adequate safety measures and perform all operations in
accordance with the relevant standards. See the ISO/IEC 8802-3 standard for details on laying networks.
• We strongly recommend hiring a qualified contractor who has specialized knowledge about
safety precautions and standards.
• Avoid installing 10BASE5 or 10BASE2 networks in environments that have high noise levels.
If this is unavoidable, adopt the noise prevention measure described below.
(1) Overview of wiring outside the control panel
(a) Layout environment and required work
Lay out cables in a manner appropriate for the environment. The steps listed in
the following table are generally required.
Table 9-1 Wiring Environment and Work Operations
Environment in which cable is laid
9
Minor categories
Work operations
Major categories
Locations where cables will not
be damaged
Location where cables could
be damaged
Locations where there is a
likelihood of electromagnetic
interference
Installation without protective
pipes
Installation with protective
pipes
Places where there is normally Installation with protective
motion of people and objects
pipes
Places where humidity,
chemicals, oils may influence
cables, or heat
Installation with protective
metal pipes
Places where cables may be
damaged by rats, mice, or
other animals.
Installation with protective
pipes
Places where cables may
receive strong mechanical
shocks, or where heavy
physical loads may be placed
on the cables.
Installation with protective
metal pipes
Protective installation and
separation of cables.
Installation with protective
metal pipes
The term "installation with protective pipes" means that either metal or PVC pipes may be
used.
208
Ethernet module User’s Manual
9.4 Network Wiring
(b) Overview of wiring without protective pipes
1) To protect the cables, cables should be passed through flooring ducts or wire
protecting cable covers should be used.
Note that these cables should not be laid adjacent to cables carrying high
currents.
2) Lay cables in gaps in the walls so that they will not be damaged, and run
cables under the flooring under equipment so that electromagnetic
interference will not occur.
3) Observe the applicable cable separation standards when running cables in
parallel with, when crossing, or when approaching low-voltage indoor power
lines.
4 Fasten cables every 3 meters so that the cables are not damaged when
attaching cables to walls to position the away from the floor, or when running
cables vertically.
5) When bending cables, be sure that the radius of curvature of the bend does
not exceed the bending limit for the cable used.
(c) Notes on piped cabling
1 Do not run coaxial cable and lines carrying high currents in the same pipe.
2 When bending pipes, do not bend pipes to an angle sharper than 90 degrees.
3 When bending pipes, the radius of curvature must be at least 6 times the
internal diameter of the pipe, and must be no smaller than the minimum radius
of curvature for bending of the enclosed cables.
4 Ground metal pipes.
(d) Separation from other wiring
As a general principle, coaxial cable should be separated by at least 2 meters
from power lines and equipment that generates electric or magnetic fields. If it is
difficult to achieve a separation of 2 meters, look up the actual voltage and
current of the induction source in the table below to determine the separation
distance. However, since transmitted signals are weak signals, restrict induction
sources to no more than 440 volts and 100 amperes.
Table 9-2 Recommended Minimum Separation Distance
Induction source:
Voltage/Current
Minimum separation for parallel lines (mm)
Over 100 A
Up to 100 A
Up to 50 A
Up to 10 A
Over 440 V
2000
2000
2000
2000
Up to 440 V
2000
600
600
600
Up to 220 V
2000
600
600
500
Up to 110 V
2000
600
500
300
Up to 60 V
2000
500
300
150
Considering resistance to noise, we recommend using either covered metal cable ducts
or protective steel pipe. Table 9-3 lists the recommended minimum separations for
parallel lines in this case.
6F8C0904
209
9
Chapter 9 Installation and Wiring
Table 9-3 Recommended Minimum Separation Distance
(Covered metal ducts and metal pipe) (Units: mm)
Cable installation method
Up to 10
meters
501
Up to 25 Up to 100 Up to 200 Up to 500
meters or
meters
meters
meters
meters
over
Up to 125 V, up to 10 A
10
10
50
100
200
250
Up to 250 V, up to 50 A
10
50
150
200
250
250
Up to 400 V, up to 100 A 50
100
200
250
250
250
Up to 500 V, up to 200 A 100
200
250
250
250
250
Parallel separation
Power cable
Covered metal ducts or metal pipe
Levels exceeding the
above
At least 500
<<Microcomputer Application Measurement/Control Installation Environment
Guideline>>
(Source: Japan Electric Measuring Instruments Manufacturers' Association)
When using cable ducts, install steel separators to separate power cables from
coaxial cables as shown in the figure below.
Metal duct
Separator
9
Power cable
Instrumentation power line
Transmission cable
Solenoid and other control signals
Figure 9-1 Duct Internal Layout Example
When laying cables in a pit, use separators in the same manner as when ducts are
used.
Separator (steel)
Signal lines
Power source
Ω
Ground (with a resistance to
ground of 100
or less)
Figure 9-2 Pit Internal Layout Example
210
Ethernet module User’s Manual
9.4 Network Wiring
(e) Wiring routes
The desirable routes for laying the transmission cable can be ordered as follows.
• Using a dedicated route
• Using a route dedicated to computer system related lines
• Using a route dedicated to general measurement equipment
• Using a route dedicated to plant control related lines
(2) Overview of panel internal wiring
When 10BASE2 cable is used with the EN311, coaxial cable is connected to the
EN311, and when 10BASE5 cable is used, AUI cable is connected to the EN311.
Keep the following points in mind when wiring inside the control panel.
(a) Wiring path
Use the weak-signal route within the panel for wiring the coaxial cable.In
particular, keep the coaxial cable at least 50 cm away from power supply cables.
(b) Securing coaxial cable
Secure the coaxial cable with clamp materials so that the weight of the cable is
not applied to the cable's connectors.
Remember that the cable not must be bent beyond its minimum-bending radius.
(3) Notes on laying and wiring 10BASE2 and 10BASE5 coaxial cable
(a) Only use this coaxial cable indoors. Consult with a specialist contractor if coaxial
cable must be routed outdoors.
(b) Connect terminators to both ends of the coaxial cable.
(c) Insulate all exposed metal parts other than the coaxial cable installation point
from ground and other metal parts.
10BASE5:
Plugs, adapters, terminators
10BASE2:
BNC plugs, adapters, terminators, T connectors.
(d) For safety, ground, at a single point, the coaxial cable's external conductor to a
point with a resistance to ground of 100W or less.
Also, prepare a dedicated network system ground that is not shared with other
equipment.
(e) Contact the manufacturer of the cable with regard to the physical characteristic
value of the coaxial cable allowable minimum-bending radius.
(f) Avoid locations with high temperature, high humidity, dust, or oil mist when
installing coaxial cable.
(4) Notes on laying and wiring AUI cable
(a) When connecting the AUI cable to the EN311 or MAU connectors, use the slide
latches to secure the connectors firmly.
(b) Since the AUI cable external conductor is connected to the EN311 MAU power
supply connection terminal block FG pin, be sure to ground the FG pin with a
resistance to ground of 100 W or less.
(c) Contact the manufacturer of the cable with regard to the physical characteristic
value of the AUI cable allowable minimum bending radius.
(d) Avoid locations with high temperature, high humidity, dust, or oil mist when
installing AUI cable.
6F8C0904
211
9
Chapter 9 Installation and Wiring
(5) Notes on MAU (10BASE5) installation
(a) Attach MAUs at the 2.5-meter separated marks on the coaxial cable.
(b) Since the procedure for attaching MAUs to coaxial cable differs between
manufacturer, refer to the MAU user's manual.
(c) Since the coaxial cable is grounded, the MAU main unit should be mounted
insulated from ground.
(d) Do not install MAUs in the vicinity of equipment that generates electrical noise. If
a MAU must be installed in such a location, provide a MAU enclosure box, and
mount the MAU inside the box insulated from that box. Be sure to ground the
MAU enclosure box.
(e) Avoid locations with high temperature, high humidity, dust, or oil mist when
installing MAU cable.
9
212
Ethernet module User’s Manual
Appendix A Maintenance and
Inspection
Periodic Inspection
Check the following items periodically, once every six months. Also, check these points if
any surrounding conditions or any environmental aspect changes.
Table A-1 Periodic Inspection Items
Inspection item
Inspection
Criterion
Resolution procedure
Measure the powersupply voltage at the
power-supply terminals.
Voltages must be within
the stipulated ranges.
Adjust the input voltages
to be within the
stipulated ranges.
Check for loose screws
at the power-supply
terminals.
There must be no
looseness.
Turn off (remove power
from) the power supply
and tighten down the
screws with a
screwdriver.
Check for damage to the There must be no
power-supply cables.
damage.
Turn off (remove power
from) the power supply
and replace the
damaged cables.
Installation state
Is the module firmly
locked in place?
Tighten down the screws
with a screwdriver.
Transmission
cable
connections
10BASE5:
There must be no
Are the AUI cables firmly looseness or play. The
locked in place?
10BASE5 connector
slide latches must be in
their locked positions.
First press the cable
firmly into the connector
and then slide the slide
latch to the locked
position.
10BASE2:
Are the coaxial cables
firmly locked in place?
There must be no
looseness or play. The
T-connector locks must
be engaged.
First press the Tconnector firmly into
position and then
engage the T-connector
lock.
There must be no
damage.
Stop the system, turn off
(remove power from) the
power supply and
replace the damaged
cables.
Power supply
systems (S
controller power
supply/MAU
power supply)
Transmission
10BASE5/2: Check for
cable wiring (See damage to the cables.
Section 9.4,
"Network
Wiring".)
Ambient
conditions
6F8C0904
There must be no
looseness or play.
Are the cables installed
near any power or other
cables?
There must be no power Separate the cables
or other similar cables in from the power lines.
the vicinity.
Shield the cables.
Verify that temperature,
humidity, vibration, and
dust levels are all within
the stipulated ranges.
The values must be
within the ranges from
the general
specifications for the
module.
Improve the
environment so that all
aspects are within the
ranges stipulated in the
specifications.
213
Appendix A Maintenance and Inspection
Warning
• Always turn off the power before attaching or removing modules, the terminal block, or
cables.
Electrical shock, malfunctions, and breakdowns are possible if these operations are performed with the power on.
• When measuring the voltages at the module terminal block during inspections, use adequate
caution.
There is a danger of electrical shock during this operation.
• Always turn off the power completely before replacing modules.
Exchanging modules with the power on can lead to malfunctions, breakdowns, and electrical
shock.
• Do not disassemble or modify the module hardware, and do not modify the module software.
Breakdowns or malfunctions may lead to fire, electrical shock, or injury.
Caution
• To keep the system operating normally at all times and to prevent trouble in advance, perform daily inspections, periodic inspections, and cleaning.
• Refer to the section on error recovery in this document if the EN311 does not operate correctly.
Contact your local Toshiba dealer or service representative if a breakdown occurs, and
request that the module be repaired or returned to Toshiba.
Operation and safety cannot be guaranteed if service is performed by anyone other than an
authorized Toshiba service representative.
• Do not continue to use the module if it emits smoke or unusual odors, or if it is in an abnormal state of any type.
Using the module in an abnormal state can lead to malfunctions, breakdowns, and electrical
shock.
In such cases, immediately turn of all power and contact your local Toshiba dealer or service
representative.
Customers should never attempt repairs or modifications to this equipment themselves:
repair and modification operations are extremely dangerous.
A
214
Ethernet module User’s Manual
Appendix B Socket Service
Command Table
The following table lists the socket service commands used with USEND_T/URCV_T
instructions sent to the EN311. Refer to the section/item indicated in the reference
column in the table for detailed explanations of the request codes.
Table B-1 Request Codes to the EN311
Command/Code
6F8C0904
Function
Instruction
Class
Reference
Reset request/16#0311
Resets the module.
USEND_T
(1)
Section 4.3
Parameter setup
request/16#0312
Sets up the EN311 parameters. USEND_T
(1)
Section 4.4
Operating mode control Sets the operating mode.
request/16#0313
USEND_T
(1)
Section 4.5
Remote station
verification request/
16#0314
Verifies the existence of
another node on the network.
USEND_T
(1)
Section 7.3
RAS information
readout request/
16#0315
Reads out the module RAS
information.
URCV_T
(1)
Section 7.5
Time set request/
16#0318
Sets the module internal clock USEND_T
Time information for event trace
(1)
Section 7.4
Register read request
(PC link function)/
16#0321
Reads register data from
remote station into registers in
the local station.
URCV_T
(2)
Section 5.4
Register write request
(PC link function)/
16#0321
Writes register data from the
local station to registers in
remote station.
USEND_T
(2)
Section 5.3
UDP open request/
16#0331
Opens a UDP socket.
USEND_T
(3)
Section 6.4.1
UDP send request/
16#0332
Transmits data from a UDP
socket.
USEND_T
(3)
Section 6.4.2
UDP receive request/
16#0333
Reads out data received by a
UDP socket.
URCV_T
(3)
Section 6.4.3
UDP close request/
16#0334
Closes (terminates) a UDP
socket.
USEND_T
(3)
Section 6.4.4
TCP open request/
16#0335
Opens a TCP socket.
USEND_T
(3)
Section 6.4.5
TCP send request/
16#0337
Transmits data from a TCP
socket.
USEND_T
(3)
Section 6.4.6
TCP receive request/
16#0338
Reads out data received by a
TCP socket.
URCV_T
(3)
Section 6.4.7
TCP close request/
16#0339
Closes (terminates) a TCP
socket.
USEND_T
(3)
Section 6.4.8
215
Appendix B Socket Service Command Table
• The socket service code (CMD) classes (1) to (3) have the following meanings.
Class (1) is module control, (2) is PC link protocol transmission, and (3) is socket
interface transmission.
• For a single EN311 module, it is not possible to request another class (1) command
while a class (1) command is executing. If such a request is issued, the command
issued later will be ignored. This is also true for class (2) commands.
• For a single EN311 module, when requesting a class (3) command, it is not possible to
request another class (3) command for a socket for which an instruction is executing. If
such a request is issued, the command issued later will be ignored.
• There are eight sockets, and each can independently accept and execute a class (3)
command.
B
216
Ethernet module User’s Manual
Appendix C Error Status Table
Tables C.1 and C.2 list the contents of the error status generated from STATUS at the
completion of USEND_T/URCV_T function block.
Table C-1 Contents of Completion Statuses
STATUS
0
-5001
Name
Explanation
Normal completion
Parameter error
• Occurs if a slot number other than 03xxH is specified.
• Occurs if a non-existent command number is specified
in a USEND_T/URCV_T function block.
• Occurs if a value other than 1 to 8 is specified for the
socket identifier.
• Occurs if an incorrect parameter is specified in a RAS
information readout request.
6F8C0904
-5002
Transmission
complete timeout
• Occurs if an S3 internal timer times out when issuing
one of the following commands:
UDP open, UDP send, UDP close, TCP send, TCP
close
-5051
Register specification
error
• In a register read request, a register type not valid for
the local station register (except D and SW) is specified.
-5071
Register specification
error
• In a register write request, a register type not valid for
the remote station register (except D and SW) is specified.
-5052
Response timeout
• Occurs if a response is not received within the specified
time for a register read/write request.
-5054
Memory write protect
error
• In a register read request, a SW register is specified for
the reception data storage area of the local station.
-5074
Memory write protect
error
• In a register write request, a SW register is specified for
the data storage area of the remote station.
-5057
No send channel
• Occurs if the corresponding EN311 is not installed.
-5058
Reserved
-5059
Incorrect transmission • Occurs if either 0 or 1001 words or more were specified
word count
for a UDP/TCP socket send/receive request.
-5060
Boundary error
• Occurs if the specified data storage area does not exist
on the S3 in case of the following commands:
RAS information readout, UDP send/receive, TCP
send/receive, register read/write
-5080
Boundary error
• Occurs if the specified data storage area does not exist
on the S3 in case of the following command (occurred
in the remote station):
Register write
-5062
No I/O response
• Occurs if a command is issued when the S3 cannot
access the EN311.
-5064
Send data capacity
exceeded
• Occurs if a transmission is repeated to a non-existent
remote station with a rapid cycle.
-5050
Error during reset
• Occurs if another command is issued during a reset
request execution.
217
Appendix C Error Status Table
Table C-1 Contents of Completion Statuses
STATUS
0BxxH
Name
Explanation
Transmission error
• Occurs if the EN311 detects an error and responds.
For more information, see Table C.2 below.
Table C-2 Detailed Information
Error
Code
Description
Normal
completion
01H
Local station fault
02H
The local station is in down mode
Local station
standby
03H
Data transmission in standby mode was requested.
Timeout
20H
Timeout occurred during TCP open processing or receive
processing, or during UDP receive processing.
Length error
30H
Incorrect transmission data length
Station mode
error
40H
One of the following requests was issued in a mode other than
standby mode:
a. Parameter setup,b. MAC address setup,c. Reset
MAC/IP not set up
50H
Occurs if the MAC address or IP address is not set up.
Transmission
prohibited state
60H
• Occurs if a PC link request was issued in run mode in the message transmission prohibited state.
• Occurs if a socket open, close, send, or receive request is
issued in run mode in the socket interface transmission prohibited state.
Format error
C
70H
Occurs when there is a format error in the request text.
71H
Port number error/IP address error
72H
Request code error
73H
Time setting: Year
74 Time setting: Month
H
75H
Time setting: Day
76 Time setting: Hour
H
77H
Time setting: Minute
78 Time setting: Second
H
Opened
80H
Occurs if an open request is issued for an already open socket.
Unopened
81H
• Occurs if send, receive, or close request is issued for an
unopened socket.
• The TCP socket was used to make the transmit/receive request
to the socket that is receiving CLOSE from the remote station.
Incorrect socket
identifier
82H
Occurs if the socket identifier is out of range (1 to 8).
Incorrect control
request
specification
83H
Occurs if a request that was prohibited by an operating mode
control request is issued.
• Occurs if a run request is issued in run mode.
• Occurs if a standby request is issued in standby mode.
• Occurs if a run request and a standby request are issued at the
same time.
218
Ethernet module User’s Manual
Table C-2 Detailed Information
Error
LAN controller
driver error
Code
Description
90H
• Occurs if the setting of the local station IP address and port
number in the area reserved for transmission fails.
91H
• Error in the TCP or UDP protocol (such as a transmission phase
error)
• The TCP socket was used to make the transmit request to the
socket (with the NOACK bit of the socket status is ON) due to
remote-station down.
92H
• Occurs if the setting of the remote station IP address in the
remote station information area fails.
• Occurs if the remote station IP address network address differs
from the local station IP address network address.
Memory pool
allocation failure
A0H
Occurs if the EN311 internal OS fails to allocate memory.
Port 2 task start
failure
A1H
Occurs if computer link or PC link socket identifier acquisition fails.
Broadcast
specification error
A2H
If the remote destination was specified to be broadcast in a remote
station verification request.
MAC address
specification error
B0H
BCC error
B1H
Occurs if an error occurs after address saving on a MAC setup
request.
Insufficient
resources error
C0H
• Occurs if transmission is repeated to a non-existent remote station with a cycle less than 100 ms.
• The UDP socket was used to make the transmit request when
the buffer in the EN311 became full without taking the receive
data over to the S3 side.
6F8C0904
Error in the
receive request
from S3 (Number
of words)
C1H
Occurs if the data size
specified by the user program
<
the data size received by the
EN311
C2H
Occurs if the size specified by the user program is out of range
(1 to 1000 words).
Transmission
buffer full
C3H
Occurs if the remaining transmission buffer of the socket in which
the transmission request data is accumulated is smaller than the
data size of the transmission request for the TCP socket
transmission.
Remote station
window size is too
small
C4H
Occurs if the window size of the remote station ACK is smaller than
the data size of the transmission request for the TCP socket
transmission.
219
C
Appendix D USEND_T and
URCV_T Execution Times
Since execution of the USEND_T and URCV_T instructions involves instruction
processing that extends across multiple scans, the execution times differ in each of the
states at instruction activation time, response wait time, and instruction completion time.
(1) For PC link transmission
The following operations are performed for PC link transmission:
Scan during instruction activation: Transmission request or reception request to the
remote station
During the next and later scans:
Checking the response wait state from the remote
station or completion processing
Table D-1 Instruction Execution Times for PC Link Transmission
N: Number of words transmitted (1-485)
Execution time (µs)
Register write (USEND_T)
Register read (URCV_T)
At instruction
activation
315 + 0.3 × N
At instruction
activation
305
During response wait
200
During response wait
200
At completion
235
At completion
235 + 0.4 × N
(2) For EN311 module control
The follow operations are performed during EN311 module control:
Scan during instruction activation: Execution of commands to the local station
(EN311)
During the next and later scans:
Checking the response wait state from the local
station (EN311) and completion processing
Table D-2 Module Control Request Instruction Execution Times
Command/Code
Reset request/
16#0311
Parameter setup
request/16#0312
6F8C0904
Execution time (µs)
Function block
USEND_T
USEND_T
At instruction
activation
290
During response wait
200
At completion
220
At instruction
activation
295
During response wait
200
At completion
220
221
Appendix D USEND_T and URCV_T Execution Times
Table D-2 Module Control Request Instruction Execution Times
Command/Code
Execution time (µs)
Function block
Operating mode
control request/
16#0313
USEND_T
Remote station
confirm request/
16#0314
USEND_T
RAS information
readout request/
16#0315
URCV_T
Time set request/
16#0318
USEND_T
At instruction
activation
290
During response wait
200
At completion
220
At instruction
activation
300
During response wait
200
At completion
220
At instruction
activation
315
During response wait
200
At completion
280
At instruction
activation
295
During response wait
200
At completion
220
(3) For socket transmission
The following operations are performed during socket transmission (TCP/UDP):
Scan during instruction activation: Transmission requests or reception requests to
local stations
During the next and later scans:
Checking the response wait state from local
stations or completion processing
Table D-3 Socket Transmission Instruction Execution Times
N: Number of words transmitted (1-1000)
Command/Code
UDP open request/
16#0331
UDP send request/
16#0332
USEND_T
USEND_T
D
UDP receive request/
16#0333
UDP close request/
16#0334
TCP open request/
16#0335
222
Execution time (µs)
Function block
URCV_T
USEND_T
USEND_T
At instruction
activation
300
During response wait
200
At completion
240
At instruction
activation
330 + 0.4 × N
During response wait
200
At completion
250
At instruction
activation
330
During response wait
200
At completion
260 + 0.35 × N
At instruction
activation
290
During response wait
200
At completion
240
At instruction
activation
310
During response wait
200
At completion
240
Ethernet module User’s Manual
Table D-3 Socket Transmission Instruction Execution Times
N: Number of words transmitted (1-1000)
Command/Code
TCP send request/
16#0337
TCP receive request/
16#0338
TCP close request/
16#0339
Execution time (µs)
Function block
USEND_T
URCV_T
USEND_T
At instruction
activation
330 + 0.4 × N
During response wait
200
At completion
250
At instruction
activation
330
During response wait
200
At completion
260 + 0.35 × N
At instruction
activation
290
During response wait
200
At completion
240
D
6F8C0904
223
Appendix E Computer Link/PC Link Protocol
Minimum Transmission Delay Times
(1) Minimum delay time for computer link protocol transmission
The minimum delay time from the point the host computer issues a request to the S
controller to the point a response is received for computer link protocol transmission
is:
(Computer link protocol transmission minimum delay time)
= (Host computer transmission processing time) + ("S controller response time)
The S controller response time depends on the following three instructions:
• Request commands of the computer link
• Instructions included in the user program of the S controller
• S controller main task - scan time
The processing time required for response text creation differs for each request
command as listed in Table E.1. If this processing is not completed in the empty
space within the first scan it will be divided across multiple scans continuing with the
next scan.
Table E-1 Computer Link Response Text Creation Processing Times
Command
Type
Response text creation time (ms)
DR
1 word
1.6
Continuous, 32 words
2.7
Multiple types, 16 words
6.2
1 word
1.9
Continuous, 32 words
6.9
Multiple types, 16 words
8.1
RT
-
1.1
ST
-
0.9
WT
-
1.7
DW
When the S controller receives a computer link protocol transmission request, it
performs computer link response text creation processing. Normally, the response
text creation processing is performed in parallel with user program execution.
However, if the user program includes the following instructions, the execution of
those instructions takes precedence.
Therefore, if the user program includes large numbers of these instructions, the
response text creation processing will be performed in the empty space in each scan
that follows the user program execution time.
[RTC instructions]
6F8C0904
225
Appendix E Computer Link/PC Link Protocol Minimum Transmission Delay Times
Below we present the technique for calculating the response time at the S controller
main unit for computer link protocol transmission.
(a) For fixed scan
If a fixed scan period is used, the following condition must be fulfilled:
(S controller main task scan time) > (S controller main task user program
execution time)
The computer link response text creation processing will be one of the following:
• If the value [(S controller scan time) - (user program execution time)] is larger
than the (response text creation processing time), the creation processing
can be executed within a single scan. However, due to the timing of the
arrival of the request with respect to the S controller scan timing, the time
required will be as follows:
(Response time at the S controller) = (S controller scan time) × 2
• If the value [(S controller scan time) - (user program execution time)] is
smaller than the (response text creation processing time), since the processing will be performed across n scans (where n > 1), the time required will be
as follows:
(Response time at the S controller) = (S controller scan time) × (n+1)
n = int{(response text creation processing time) / (remaining scan time in a
single scan)} + 1
(b) For floating scan
If a floating scan period is used, two milliseconds are allocated in each scan for
computer link response text creation processing, and the time required will be as
follows:
(Response time at the S controller) = (S controller scan time) × (n+1)
n = int [ (response text creation processing time) / 2ms] + 1
Usage Recommendations
• There are cases where the transmission delay time will be longer than the calculated value
due to details of the actual environment used. Factors that can cause the transmission delay
time to increase include network load, EN311 load (on both the local and remote stations),
and the S controller operating state.
E
226
Ethernet module User’s Manual
(2) Minimum delay time for PC link protocol transmission
For PC link protocol transmission instructions, the time from the point the instruction
is invoked to the point that instruction completes, that is the transmission delay time
from the point a transmission or reception request is initiated to the point the
response is received from the remote station will be as follows, assuming no
collisions occur on the network.
(Time from the point an instruction is invoked to the point that instruction completes
(in ms))
= (the S controller scan time (in ms)) + 25 ms + 0.035ms × (number of words
transmitted)
PC link protocol transmission differs from computer link protocol transmission in that
the PC link protocol processing/responding happens at the slave station at the point
the request occurs. Thus the PC link protocol transmission delay time does not
depend on the scan time at the slave station.
Usage Recommendations
• There are cases where the transmission delay time will be longer than the calculated value
due to details of the actual environment used. Factors that can cause the transmission delay
time to increase include network load, EN311 load (on both the local and remote stations),
and the S controller operating state.
E
6F8C0904
227
Appendix F Socket Interface
Transmission Processing Time
The send/receive processing times (for the S controller and the EN311) in socket
transmission can be determined from the following formulas.
Conditions:
(1) Only one socket is used in the EN311.
(2) The user program execution time itself is not included.
(3) The processing times are given for data size ranges for which no packet division
occurs. The size ranges for which packet division does not occur are:
• UDP:1 to 736 words
• TCP:1 to the maximum receivable segment size determined when the connection
was established.
• UDP send processing time (from USEND_T instruction activation to EN311 transmission completion)
(UDP USEND_T processing time) = 7.28 (ms) + 0.0181 (ms) × (number of words
transferred)
• UDP reception processing time 1:Reception request issued first type
From the start of EN311 reception to completion of URCV_T instruction execution
(UDP reception processing time 1) = (S controller scan time) + 8.35 (ms) +
0.000820 (ms) × (number of words transferred)
• UDP reception processing time 2:Socket status monitoring type
From URCV_T instruction activation to instruction completion (when EN311 data
reception has completed)
(UDP reception processing time 2) = (S controller scan time) + 0.402 (ms) +
0.0056 (ms) × (number of words transferred)
• TCP USEND_T processing time (from USEND_T instruction activation to EN311
transmission completion)
(TCP USEND_T processing time) = 7.23 (ms) + 0.0174 (ms) × (number of words
transferred)
• TCP reception processing time 1:Reception request issued first type
From the start of EN311 reception to completion of URCV_T instruction execution
(TCP reception processing time 1) = (S controller scan time) + 14.3 (ms) + 0.105
(ms) × (number of words transferred)
• TCP reception processing time 2:Socket status monitoring type
From URCV_T instruction activation to instruction completion (when EN311 data
reception has completed)
(TCP reception processing time 2) = (S controller scan time) + 0.384 (ms) +
0.0056 (ms) × (number of words transferred)
Usage Recommendations
• There are cases where the transmission delay time will be longer than the calculated value
due to details of the actual environment used. Factors that can cause the transmission delay
time to increase include network load, EN311 load, and the S controller operating state.
6F8C0904
229
Appendix G Change/correction
function in a firmware
G.1 Revision J
Here, the item changed / corrected by the firmware revision J is explained.
The firmware revision J is introduced from the product after the serial number
"01800001" of EN311.
Also in EN311 to which the serial number before "01800001" is attached, when the seal
of "J" is stuck on the end of EN311 serial number, a firmware is upgrade ending at
Revision J.
The contents of a serial number
Manufacture year/month (August, 2001 is expressed)
01800001
The reference number in the August, 2001 production lot
Table G-1 Comparison of a firmware (before Revision J and Revision J)
No
1
6F8C0904
When a TCP connection is previously closed from EN311
Revision J
If a TCP connection is previously closed from EN311, the socket of EN311
will be in a TIME_WAIT state (state in which the resource remained).
A TIME_WAIT state continues for 15 seconds.
In the Revision J firmware of EN311, when a reset packet (RST) is received
from a partner node in the TIME_WAIT state, EN311 releases the resource of
that socket immediately.
When the resource that remained is released, re-opening of that socket is
attained.
Before
Revision J
If a TCP connection is previously closed from EN311, the socket of EN311
will be in a TIME_WAIT state (state in which the resource remained).
A TIME_WAIT state continues for 15 seconds.In the case of the firmware
before Revision I, when a reset packet (RST) is received from a partner node
in the TIME_WAIT state, EN311 does not release the resource of that socket.
For this reason, a socket resource may remain forever by the operation of a
partner node (1).
(1)Operation of a partner node
--SYN, ACK, and a FIN packet are transmitted to the socket with the cycle of
15 or less seconds.
Influence of [ in case a resource is not released ]
--The socket cannot re-open.
--A socket open request carries out error completion in "a LAN controller
driver error."
231
Appendix G Change/correction function in a firmware
Table G-1 Comparison of a firmware (before Revision J and Revision J)
No
2
3
4
5
Reset request
Revision J
If EN311 operation mode is "RUN", "STANDBY" or, "DOWN", a reset request
can be required from S-controller user program to EN311.
Before
Revision J
If EN311 operation mode is "RUN" or "STANDBY", a reset request can be
required from S-controller user program to EN311.
In down mode", EN311 returns "the completion timeout of transmitting" to the
reset request of S-controller user program.
Stand-by request
Revision J
When a standby request is published from S controller user program to
EN311 of "run" mode, EN311 station status becomes stand-by (2000H), and
STBY LED turns on.
Before
Revision J
When a standby request is published from S controller user program to
EN311 of "run" mode, EN311 station status becomes stand-by (2000H), but
STBY LED does not turn on.
The interval of the standby request and a reset request (at the time of TCP socket use)
Revision J
When requiring a standby request and a reset request continuously for
EN311 (using 8-TCP socket), it is not necessary to vacate the interval of a
standby request and a reset request.
Before
Revision J
When requiring a standby request and a reset request continuously for
EN311 (using 8-TCP socket), please vacate the interval of a standby demand
and a reset demand for 500ms.When that interval is short, the notice (FIN) of
a connection end may not be transmitted from the TCP socket of EN311.
MIB_IF counter
Revision J
The MIB_IF [8] counter of EN311 is counted up only when the packet, which
received, is a format error.
Before
Revision J
In the following cases, a MIB_IF [8] counter is counted up.
- When the packet, which received, is a format error.
- Packet is transmitted normally.
G
232
Ethernet module User’s Manual
G.2 Revision K
Here, the item corrected by the firmware revision K is explained.
The firmware revision K is introduced from the product after the serial number
"02Z00001" of EN311.
Also in EN311 to which the serial number before "02Z00001" is attached, when the seal
of "K" is stuck on the end of EN311 serial number, a firmware is upgrade ending at
Revision K.
The contents of a serial number
Manufacture year/month (December, 2002 is expressed )
02Z00001
The reference number in the December, 2002 production lot
Table G-2 Comparison of a firmware (before Revision K and Revision K)
No
1
The measure against socket receiving data overwrite
Revision K
When receiving data using two ( or more ) socket interface, the
receiving data of Socket n is not overwritten with the receiving data of
Socket m (n<m).
Before Revision K When receiving data using two ( or more ) socket interface,The
receiving data of Socket n may be overwritten with the receiving data of
Socket m (n<m).
This phenomenon may be generated with both a TCP socket and an
UDP socket. However, this phenomenon will not be generated if it is the
following socket use method.
1
Only one socket is using.
2
Even if two (or more) sockets are used, the socket for receiving
data is only one.
3
Even if two (or more) sockets are used for receiving data, the
timing to which data reaches EN311 does not overlap.
4
Even if the timing to which data reaches two (or more) sockets has
overlapped, when the exclusive operation of the issue of a receive
request (RECV command) of T3H is carried out for every socket.
Exclusive operation
While publishing a receive request of a certain socket, please do
not publish a receive request to other sockets.
G
6F8C0904
233
Appendix G Change/correction function in a firmware
G.3 Revision L
Here, the item corrected by the firmware revision L is explained.
The firmware revision L is introduced from the product after the serial number
"04400001" of EN311.
Also in EN311 to which the serial number before "04400001" is attached, when the seal
of "L" is stuck on the end of EN311 serial number, a firmware is upgrade ending at
Revision L.
The contents of a serial number
Manufacture year/month (April, 2004 is expressed)
04400001
The reference number in the April, 2004 production lot
Table G-3 Comparison of a firmware (before Revision L and Revision L)
No
1
The close request of a TCP half open state socket
Revision L
A TCP socket can be closed under the following conditions.
Before
Revision L
In the procedure for canceling the half open state of a TCP socket, there is a
case where it becomes impossible to close a socket under a certain
conditions.
The dissolution procedure of a half open state TCP socket.
The TCP socket of EN311 remains in the half open state.
A RST packet is received from a partner node.
The "RCLOSE" bit turns on the socket status of a TCP socket.
A socket close request is published from T3H to EN311.
A TCP socket closes.
• The conditions it becomes impossible to close a socket.
(1) The window size notified from the partner node. (Immediately before the
socket changed into the half open state.)
(2) The sum total of the data size of which the socket from T3H required
transmission after the socket changed into the half open state.
It becomes impossible to close a socket in the state where the relation
between the size of (1) and the size of (2) in (1) < (2) has become.
When a socket close request is published to EN311, it becomes impossible to
close a socket in the state where the size of the above (2) is larger than the
size of (1).
G
When this phenomenon occurs in the firmware before Revision L, please
reset EN311 module (from T3H to reset request issue).
234
Ethernet module User’s Manual
INDEX
Index
NUMBER
10BASE2
S
socket interface
6
socket interface information
9
D
DIX Standard
T
2
T Series/Computer link protocol
transmission
4
T Series/PC link protocol transmission
5
TCP (Transmission Control Protocol)
12
E
Event trace information
176
I
IP (Internet Protocol)
ISO8802-3(IEEE802.3)
100
U
13
2
UDP (User Datagram Protocol)
13
URCV_T function block
41
USEND_T function block
39
M
MIB_ICMP
175
MIB_IF
173
MIB_IP
174
MIB_TCP
175
MIB_UDP
175
P
packet format/IP datagram
95
R
RAS counter
173
Routing function
7
6F8C0904
235
V
Integrated Controller
series
model 3000 Ethernet Module (EN311) Operation Manual
2nd edition
30th Sep, 2004
INDUSTRIAL AND POWER SYSTEMS & SERVICES
ELECTRICAL APPARATUS & MEASUREMENT DIVISION
1-1, Shibaura 1-chome, Minato-ku, Tokyo 105-8001, Japan
Tel.:+81-3-3457-4900 Fax.:+81-3-5444-9268
 TOSHIBA Corporation 2000-2004
All Right Reserved.
0904.2.0409
Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Download PDF

advertisement