FEH193 All Zrqs1kruxr
FEH193 All Zrqs1kruxr
FEH193 All Zrqs1kruxr
USER’S MANUAL
FEH193e
Preface
Thank you for purchasing Fuji Electric Programmable Controller MICREX-SX Series.
This user's manual describes the Ethernet communication specifications and operations of CPU modules with the Ethernet
function.
Read this manual carefully to ensure correct operation. When using modules or peripheral devices, be sure to read the
corresponding user's manuals listed below:
<Common related manuals for SX-Programmer Expert (D300win) and SX-Programmer Standard>
User’s Manual SPH3000MM, FEH302 Explains the differences from the SPH3000 series of
MICREX-SX series SPH SPH3000MM.
User’s Manual Motion Controller SPH5000M, FEH319 Explains the product specifications of the motion controller
MICREX-SX series SPH MICREX-SX SPH5000M, EP bus base board of SPH5000M, and
E-SX bus interface module.
User’s Manual D300win <Reference>, FEH257 Explains the installation procedure, functions and operations of
MICREX-SX series D300winV3.
User’s Manual D300win <LD/FBD Editor>, FEH257-1 Explains the operations of LD/FBD editor added to D300winV3.
MICREX-SX series
User’s Manual SPH3000MG, FEH324 Explains the differences from the SPH3000 series of
MICREX-SX series SPH SPH3000MG.
User’s Manual System Duplex Controller FEH186 Explains the hardware specifications, memory specifications, and
SPH5000H, MICREX-SX series. duplex specifications of the SPH5000H series.
User’s Manual SX-Programmer V2, FEH590 Explains the functions and operations of SX-Programmer
MICREX-SX series Standard V2.
User’s Manual SX-Programmer V3 FEH597 Explains the basic operations of SX-Programmer Standard V3.
Introduction, MICREX-SX series
User’s Manual SX-Programmer V3 FEH598 Explains the detailed functions and operations of SX-Programmer
<Reference>, MICREX-SX series Standard V3.
Notes
1. This manual may not be reproduced in whole or part in any form without prior written approval by the manufacturer.
2. The contents of this manual (including specifications) are subject to change without prior notice.
3. If you find any ambiguous or incorrect descriptions in this manual, please write them down (along with the manual No.
shown on the cover) and contact FUJI.
Safety Precautions
Be sure to read the "Safety Precautions" thoroughly before using the module.
Here, the safety precautions items are classified into "Warning" and "Caution".
Warning : Incorrect handling of the device may result in death or serious injury.
Caution : Incorrect handling of the device may result in minor injury or physical damage.
Warning
Do not touch charged parts such as terminals while the power is ON. Touching such parts may result in electric shocks.
Be sure to turn the power OFF before mounting or removing parts or components, wiring operations, maintenance, or
inspection. Working with the power ON may cause electric shocks, malfunctions, or failures.
Configure the emergency stop, interlocking, and other circuits outside the PLC. Otherwise, errors, if any, in the PLC
may result in mechanical damages or accidents.
Do not connect in reverse polarity, charge (except rechargeable ones), disassemble, heat, throw in fire or short-circuit
the batteries, otherwise, they might burst or take fire.
If batteries have any deformation, spilled fluids, or other abnormality, do not use them. The use of such batteries might
cause explosion or firing.
Do not open the FG terminal with the LG-FG short circuited. (It must be grounded, otherwise it might cause electric shock.)
Safety Precautions
Caution
Do not use the product or parts found damaged or deformed when unpacking. If done, fire, malfunctions, or failures
may occur.
Do not give shock to the product by dropping or turning it over. If done, the product may be damaged or failures may
occur.
When mounting the product, follow the directions given in the Instruction Manual and the User’s Manual. The product
incorrectly mounted may be dropped or cause malfunctions or failures.
Use the rated voltage and current specified in the Instruction Manual and the User’s Manual. Otherwise, fire,
malfunctions, or failures may occur.
Use or keep the product under the environmental conditions described in the Instruction Manual and the User’s Manual.
Use or storage of the product under high temperature, high humidity, dew condensation, dust, corrosive gas, oil, organic
solvent, or excessive vibration or shock may result in electric shock, fire, malfunctions, or failures during operation.
Select wires with the size appropriate to the applied voltage and current and tighten the wire terminals with the specified
torque. Inappropriate wiring or tightening may cause fire, dropping of the product, malfunctions, or failures.
Mount the product so that no foreign matters such as dust, wire chips, or iron powder do not enter it. Otherwise, fire,
accidents, malfunctions, or failures may occur.
After wiring, be sure to remove the dust cover from the module and unit. Using the product without removing the dust
cover may cause fire, accidents, malfunctions, or failures.
Connect the ground terminal to the ground, otherwise, an erratic operation might occur.
Periodically check that the terminal and mounting screws are securely tightened. Using the product with the screws not
securely tightened may cause fire or malfunctions.
Be sure to place the attached connector cover on a connector unused. Otherwise, malfunctions or failures may occur.
Install the furnished terminal cover on the terminal block, otherwise, electric shock or fire might occur.
Sufficiently make sure of safety before program change, forced output, starting, stopping or anything else during a run.
The wrong operation might break or cause machine problems.
Insert the loader connectors in the correct direction. Wrong connections may cause malfunctions.
Before operating the PLC, touch a grounded metallic object, etc. to discharge static electricity from your body.
Excessive static electricity may cause malfunctions or failures.
Carry out wirings securely and correctly, observing the instructions described in the Instruction Manual and the User’s
Manual. Incorrect wirings may cause fire, malfunctions, or failures.
Do not hold the cord when disconnecting the plug from the receptacle. Otherwise, the cable may be broken resulting in
fire or failures.
Do not attempt to change system configurations (such as installing or removing I/O modules) while the power is ON,
otherwise, failure or erratic operation might occur.
If the product has a trouble, contact us for repair; never attempt to repair it in the field. When replacing the battery, be
careful of the connecting directions. Wrong connections may cause fire, accidents or failures.
Clean this product after power-off using a towel that is moistened with lukewarm water and then wrung tightly. Do not use
thinner or other organic solvents, as the module surface might become deformed or discolored.
Do not remodel or reassemble the product. Doing so may cause failures.
When discarding the product, handle it as industrial waste observing the related regulations.
The product described in this User’s Manual has not been designed or manufactured for purposes of use in equipment
or systems which involve human lives.
If you intend to use the product described in this User’s Manual for nuclear energy control, aerospace, medical
treatment, transportation, or passenger vehicles or special purposes of such systems, please consult your nearest Fuji
Electric agent.
When using the product described in this User’s Manual for equipment or systems which, in case of failures, may lead to
loss of human lives or serious damages, be sure to provide protective measures.
External power supply (such as 24V DC power supply) which is connected to DC I/O should be strongly isolated from
AC power supply, otherwise, accident or failure might occur. (Use of EN60950 conforming power supply is recommended.)
Do not use this equipment in a residential environment.
Revision
* The manual No. is printed at the bottom right of the cover of this manual.
Nov. 2015 FEH193d Some contents were added and modified according to revision of the Japanese
version.
Preface
Safety Precautions
Revision
Contents
Section 1 Overview
1-1 Overview of Ethernet Communication using a CPU with Built-In Ethernet...................................... 1-1
Section 2 Specifications
2-1 Transmission Specifications................................................................................................................. 2-1
2-1-1 List of transmission specifications........................................................................................................................ 2-1
2-1-2 Communication ports of module ......................................................................................................................... 2-2
2-2 Communication Functions.................................................................................................................... 2-3
2-2-1 General Purpose Communication mode.............................................................................................................. 2-3
2-2-2 Fixed Buffer Communication mode...................................................................................................................... 2-4
2-2-3 Loader Command Communication mode............................................................................................................ 2-5
2-2-4 FTP server mode................................................................................................................................................. 2-6
2-3 Names and Functions............................................................................................................................ 2-9
Ethernet
MICREX-SX MICREX-SX
<Features>
• Ethernet is built in the CPU module.
• The FTP server and client function and mail function are provided.
1-1
Section 1 Overview
<Special notes>
• The built-in Ethernet of NP1PM-256H is used as a bus for data equalization in a redundant system configuration. Therefore,
communication using built-in Ethernet cannot be performed. Communication using a separately installed Ethernet module
(Type: NP1L-ET1) is possible. However, note that the functions specific to the built-in Ethernet (mail server/client and mail
function) are not available.
• “General Purpose Communication mode,” “Fixed Buffer Communication mode,” and “Loader Command Communication
mode” can be used in the almost same way as in an Ethernet module (Type: NP1L-ET1). However there are some
differences in the fine operations and the specifications. For more information, refer to the related sections in this manual
and the user’s manual for the Ethernet module (FEH259). (The Ethernet module may be referred to as ET1 hereafter.)
• Use a HUB by auto negotiation (automatic switching between 10M and 100M). When fixed at 100M or 10M (full duplex),
communication cannot be performed.
• The built-in Ethernet can be used as a starting point of a loader network, but not as a middle point (route).
• Up to a million (1,000,000) bytes (approx. 0.95MB) of file can be exchanged between a memory card inserted in the CPU
and a personal computer at a time during FTP communication.
1-2
Section 2 Specifications
Fixed Buffer
Performs communication using the fixed buffer that Mitsuibishi PLC provides.
Communication mode
Communication Loader Command Performs communication between MICREX-SX series devices or with the host
function Communication mode PC or POD by the dedicated loader commands.
FTP server function Ethernet built-in CPU becomes the FTP server.
FTP client function Ethernet built-in CPU becomes the FTP client.
SNTP client function Obtains time information from the NTP server by a dedicated FB.
Mail function Transmits mails from Ethernet built in CPU.
Access method CSMA/CD
Transmission protocol TCP/IP, UDP/IP, ICMP, ARP
SPH3000MM firmware version V09 or later: 14 stations (ports)/module
SPH5000M: 14 stations (ports)/module
Other than the above: 10 stations (ports)/module
Max. number of simultaneous
Note: The number of communication ports that one CPU can simultaneously
communication
open is 56. When other communication modules exist, be careful that the
nodes (number of communication ports)
number of opened ports per CPU doesn’t exceed 56.
Responses of communication deteriorate as the number of communication
ports increases.
Transmission code Binary/ASCII code
*1 1000Mbps is supported by SPH5000H and SPH5000M. For 10BASE-T, only SPH5000M is not supported.
2-1
Section 2 Specifications
Max. 8
1) Number of General Purpose Communication mode connections
Message (Note 4)
communication Max. 8
Max. 8 Client
2) Number of Fixed Buffer Communication mode connections in total
(Note 4) connection
(Note 4)
3) Number of Loader Command Communication (send) mode
Max. 4
connections (Note 1)
Loader command
3) Number of Loader Command Communication (receive) mode
communication Server
connections (Note 2) Max. 10 (Note 5)
connection
5) Number of connections to loader (Note3)
Note 1: “Send” means the operation on the node side that sends a request by R_WRITE or R_READ.
Note 2: “Receive” means the operation on the node side that receives a request of R_WRITE or R_READ sent from a remote
node.
Note 3: “Loader connection” means communication performed between the PLC and a personal computer loader, POD, or
personal computer by loader command communication.
Note 4: SPH3000MM firmware version V09 or later, SPH5000M: Max. 12
Note 5: SPH3000MM firmware version V09 or later, SPH5000M: Max. 14
2-2
Section 2 Specifications
Note 1: With regard to the number of stations to communicate with, the number of remote nodes must be 10 (stations) or less in
total of 1), 2) and 3) communication modes above .
Note 2: The communication modes 5) and 6) are supported by the following version of SPH2000 CPU and loader.
CPU version: V**08 or later, Loader (Expert) version: V3.4.1.0 or later
Note that the loader (Standard) does not support them.
Note 3: The communication mode 7) is supported by the following version of SPH2000 CPU and loader.
CPU version: V**10 or later, Loader (Expert) version: V3.4.4.0 or later
Note that the loader (Standard) does not support it.
MICREX-SX
Ethernet built in CPU
Send Receive
buffer buffer
Receive data
TCP/IP or UDP/IP
Another node
2-3
Section 2 Specifications
Receive data/response
TCP/IP or UDP/IP
Send data/response
Other manufacturer's PLC
Another node
2-4
Section 2 Specifications
<Communication conditions>
MICREX-SX
Ethernt built in CPU
Memory in CPU
Communi- Communi-
cation cation
channel channel
Requested data
Response data
TCP/IP
Requested data
MICREX-SX
Response data
Ethernt built in CPU
Memory in CPU
* Loader command communication port is the self port standard No. + 251.
Default value is 256 + 251 = 507.
For example, when the self port standard No. is set to 1000, 1000 + 251 = 1251 becomes the port No. for loader command
communication.
2-5
Section 2 Specifications
FTP server
Personal computer
Ethernet
Note: During FTP server communication, execution of project download (incl. rewriting of a program while the PLC is running)
and an FB that performs reading and writing of data from and to a user ROM card (incl. F_RAED, F_WRITE, and CSV
interface-related FB) has to wait. Especially when FTP server communication is used in two or more ports consecutively
or simultaneously, execution is kept waiting. Therefore, when performing FTP server communication, be careful of the
access frequency.
2-6
Section 2 Specifications
<FTP command supported by Ethernet built in CPU>
The tables below list FTP commands supported by Ethernet built in the CPU.
a: Supported
r: Not supported
CHANGE WORKING
Change working directory.
DIRECTORY a
(Change the working directory.)
(CWD)
CHANGE TO PARENT
Change to Parent Directory.
DIRECTORY a
(Move to the parent directory)
(CDUP)
DATA PORT Specifies an address and port to which the server should connect.
a
(PORT) (Indicates the host port for data connection)
2-7
Section 2 Specifications
2-8
Section 2 Specifications
This manual describes the names and functions of SPH2000 as an example.
For information on other CPU modules, refer to the manual of each CPU module.
CPU
No. Loader connector
LOADER
Battery connector
(2) Functions
This manual describes the specifications of the Ethernet interface part. For more information on other functions, refer to the
user’s manual “Hardware (FEH201).”
Note: The LED color for the link status has been changed into
yellow in SPH2000 with a hardware version of 23 or later.
Data send/receive status
2) 10BASE-T/100BASE-TX connector
This connector connects a 10BASE-T or 100BASE-TX communication cable.
3) Version seal
This seal indicates the hardware and firmware versions of the CPU module.
21 02
Hardware version
Firmware version
2-9
Section 3 Mounting Modules
3-1
Section 4 Communication Procedures
4) Close
communication Set OFF the open request flag (a variable
channel connected to the EN_C terminal) of M_OPEN FB
to close the port and thus cut out the
communication line with remote node.
3) Close
communication No application program is necessary for this.
channel Automatically closed.
4-1
Section 4 Communication Procedures
To communicate with another node, definition of module operations (by setting module parameters) and a communication
program are necessary.
1) IP address
Set an IP address for the CPU module (determined by the network administrator). An IP address identifies each node on
Ethernet. It consists of 32-bit binary data and is defined as a combination of an IP network address and an IP host address. An
IP network address identifies the network; An IP host address is the ID for identifying the host (node) in a network.
2) Subnet mask
Controlling many nodes connected to one network is hard. To divide one network into multiple subnets (groups), set the subnet
mask value. A subnet uses a part of the host address, masking the IP network address and subnetwork with “1” and the IP host
address with “0.” When no subnet exist, set “0.0.0.0.”
Example 1) When a class B network is divided into 16 subnets, set as follows.
“255.255.240.0” (FFFFF000)
Example 2) When a class B network is divided into 256 subnets, set as follows.
“255.255.255.0” (FFFFFF00)
4-2
Section 4 Communication Procedures
3) Gateway
An IP router (default gateway) allows multiple IP network segments to be connected. When networks are connected by an IP
router, communication with another network becomes possible via the router. Set the gateway to enable communication with
another network.
Default
gateway
172.16.0.22
Network address: 172.16.0.0
The actual operations according to gateway settings differs depending on the CPU module version in SPH2000.
(Other CPUs operate in the same way as V**07 or later version of SPH2000 shown in the table below.)
Note 1: This means the status of a band-new CPU where system definition has never been downloaded. When system definition
is downloaded (written), the CPU operates in the way described in the lower column of the table above even if the
default gateway is not set.
Note 2: The gateway is not available in active open mode.
The gateway is available in passive open mode including Unpassive/Fullpassive open mode or loader command
communication with a personal computer since the remote station attempts open.
4-3
Section 4 Communication Procedures
<Operations of loader command communication with a personal computer>
In loader command communication with a personal computer (loader command transmission from an SX to PC using the R_
READ and R_WRITE FBs or loader command reception from a PC to SX), response operation to the remote station differs
depending on the version when communication is performed via the gateway as shown below.
Gateway is not set or Sends broadcast address (255.255.255.255) Replies to the remote station that has sent a
an invalid value is set. (Note 2) loader command.
・ 0.0.0.0 (Note 1)
・ Not set
・ 255.255.255.255
The CPU module receives a loader command from Sends the broadcast address
a gateway other than the set one and the network (255.255.255.255).
address of the gateway does not match that of the (Note 2)
CPU module.
Note 1: A response is returned to the received address (IP address for the remote station, MAC address for the gateway).
Note 2: Avoid this usage as much as possible since it becomes broadcast transmission that imposes a burden on the network.
4) TCP sending and receiving timeout value (setting range: 1 to 300, in 0.1-second steps)
Set a value for communication error monitoring timer when TCP connection is opened and data is sent or received.
If opening of a connection or data sending fails during TCP/IP communication, Ethernet automatically retries it.
The retry interval increases exponentially, like 3 seconds, 6 seconds, 12 seconds, ......
1) If open processing has started but cannot end normally although Ethernet repeatedly retries it, the open processing ends
abnormally after the set timeout time elapses .
2) If data sending has started but cannot end normally although Ethernet repeatedly retries it, the sending ends abnormally
when the timing of retry is reached after the set timeout time elapses.
For example, the internal operation before an error is detected when TCP send timeout value is set to 15 seconds and 30
seconds is as follows.
15s 30s
Total time
3s 6s 12s
t
5) Maximum TCP end timer value (setting range: 0 to 600, in 0.1-second steps)
Set the waiting time to keep the socket for a specified time after the closing of a TCP connection was attempted from the local
station and ended normally. The maximum waiting time until the processing for closing the remote station is completed normally
when the closing of a TCP connection is attempted from the local station is twice the set TCP send timeout value.
If the processing for closing the remote station cannot be completed normally (when no FIN is received), RST is sent to the
remote node to forcibly close the connection.
When set to “0,” the waiting time is 1 second. (In the case of ET1, 0 means no waiting time.)
* If a small value is set for this timer value when communication on the network is slow (network load is high), the connection on
the network may not be closed normally and reconnection may fail. Perform communication on the actual network, and then
change the timer value to a proper value as needed.
4-4
Section 4 Communication Procedures
6) Loader command watch timer value (setting range: 0 to 3000, in 0.1-second steps)
Set the time to automatically break the connection when a client of another node has logged in, however, no command is sent
from the client for a specified period of time in Loader Command Communication mode.
Set this timer value to 0 if you do not want to break the connection even when no command is sent from the client, for example,
when the loader is connected via the CPU module.
13) Response watch timer value (setting range: 0 to 300, in 0.1-second steps)
Set the waiting time until a response is returned after a command is sent in Fixed Buffer Communication mode. This timer value
is also applied to the waiting time for receiving data.
4-5
Section 4 Communication Procedures
<Setting procedure>
Open the “Module properties” dialog box of the CPU module, click “Parameter,” and then click “IP-address/Gateway setting”
tub. The Ethernet parameter setting screen opens.
Set “IP-address” and “Subnet mask.” If necessary, also set “Default gateway IP-address.”
Click the “Detail Setting” button. The “Detail Setting” dialog box opens. Set all the necessary items, and then click the “OK”
button.
4-6
Section 4 Communication Procedures
<Setting procedure>
Click the “User Setting” button in the Ethernet parameter setting screen. The “FTP user setting” dialog box opens.
Set all the necessary items, and then click the “OK” button.
* You can access the folders in the ROM card installed in the CPU module by FTP command of the computer. However, do
not open a file in the ROM card directly. If you want to view the contents of a file, copy and save it in the hard disk of the
computer, and then open it. Directly opening a file leads to depletion of FTP server connection. If a file is directly opened and
an error occurs in FTP processing, stop access from the computer, and then access again after more than five minutes have
passed (FTP watch timeout time in the CPU module). Alternatively, log off from Windows or reboot the computer to release the
connection.
4-7
Section 4 Communication Procedures
SX_CPU
M_OPEN FB
Open request
(EN_C)
1) 6)
M_OPEN FB
Open valid
(VALID)
M_SEND FB
Send data Send data set
(SD)
2)
M_SEND FB
Send request
(REQ)
M_SEND FB
Send end 5)
(DONE) 3)
4)
ACK
Remote node
1) Open a communication channel by the M_OPEN FB first. Set ON the open request (EN_C) to establish a connection with the
remote node according to the setting of M_OPEN. The open valid flag (VALID) is set ON.
2) Set data to be sent in the send data (SD) of the M_SEND FB to set ON the send request (REQ).
3) The data is sent to the send buffer in the CPU module at the rising edge of the send request (REQ)
4) The CPU module adds a header part necessary for communication to the data and then sends it to the remote node.
5) When the data sending is completed, the send end (DONE) of the M_SEND FB is set ON for one scan. When the
communication protocol is TCP/IP and receipt confirmation is enabled, the send end flag (DONE) is set ON for one scan after
a data reception signal (ACK) is received from the remote node.
Note: If the data sending is not completed normally, the send error (ERROR) is set ON for one scan. In this case, set the send
request OFF, and then re-execute processing for sending data (from the step 3).
6) To break the communication channel when communication ends, set OFF the open request (EN_C) of the M_OPEN FB.
VALID is set OFF when the close processing is completed.
4-8
Section 4 Communication Procedures
Remote node
SX_CPU 3)
Ethernet
part Receive buffer
2) Receive valid
M_OPEN FB
Open request
(EN_C)
1) 5)
M_OPEN FB
Open valid
(VALID)
M_RECEIVE FB
Enable receive
(REQ)
M_RECEIVE FB
Receive data Receive data
(RD)
4)
M_RECEIVE FB
Receive end
(NDR)
1) Open a communication channel by the M_OPEN FB first. Set ON the open request (EN_C) to establish a connection with the
remote node according to the setting of the M_OPEN FB. The open valid flag (VALID) is set ON.
2) Set ON the enable receive (EN_R) of the M_RECEIVE FB to make the CPU module ready for receiving data.
3) The receive buffer receives data from the remote node.
4) The received data that is stored in the receive buffer in the CPU module is stored in the receive data (RD) of the M_RECEIVE
FB, and then the receive end (NDR) is set ON for one scan.
The CPU module returns into the waiting state if the enable receive is ON. Once the CPU module goes into the waiting state,
it keeps waiting for reception of data even after EN_R is set OFF. To stop the CPU module from waiting for reception, set OFF
the open request (EN_C) of the M_OPEN FB to break the channel.
Note: If abnormal data is received, the receive end (NDR) is not set ON and the received data is not stored in the receive buffer.
5) To break the communication channel when communication ends, set OFF the open request (EN_C) of the M_OPEN FB.
VALID is set OFF when the close processing is completed.
4-9
Section 4 Communication Procedures
1) Header part
The header part is a header for Ethernet TCP/IP or UDP/IP. When data is sent to another node by an application program, the
CPU module automatically adds a header to the data before sending it to the remote node. When data is received from another
node, the CPU module removes the header part from the received data, and sends only the data part to the FB.
2) Data part
The data part is data for Ethernet TCP/IP or UDP/IP. When data is sent to another node by M_SEND, data that is transferred to
the send buffer in the CPU module is set in the data part of Ethernet TCP/IP or UDP/IP, and then sent. When data in binary code
is set in the send buffer, it is sent without change. When data in ASCII code is set in the send buffer, it is sent after converted
into ASCII characters.
When data is received from another node, data of the data part of TCP/IP or UDP/IP is stored in the receive buffer in the CPU
module. When data in binary code is received, it is stored in the receive buffer without change. When data in ASCII code is
received, it is stored in the receive buffer after converted into binary code.
Packet of TCP/IP
or UDP/IP Same as data length (max. 2034 bytes)
Send/receive buffer Header part D1L D1H D2L D2H D3L D3H ··· DnL
in CPU module
1 D1H D1L
2 D2H D2L
3 D3H D3L
n DnL
The data length shows the number of bytes of data stored in the send/receive buffer in decimal (Max. 2034 bytes).
If the data length is an odd number, data up to the low-order byte of the last word is effective.
Packet of TCP/IP
or UDP/IP Same as data length (max. 2034 bytes)
Send/receive buffer Header part D1H D1L D2H D2L D3H D3L ··· DnH
in CPU module
1 D1H D1L
2 D2H D2L
3 D3H D3L
n DnH
The data length shows the number of bytes of data stored in the send/receive buffer in decimal (Max. 2034 bytes).
If the data length is an odd number, data up to the high-order byte of the last word is effective.
4-10
Section 4 Communication Procedures
<ASCII code>
Packet of TCP/IP
or UDP/IP Twice the data length (max. 4068 bytes)
1 D1H D1L
2 D2H D2L
ASCII
conversion
n DnH
The data length shows the number of bytes of data stored in the send/receive buffer in decimal (Max. 2034 bytes).
If the data length is an odd number, data up to the high-order byte of the last word is effective.
4-11
Section 4 Communication Procedures
SX_CPU
M_OPEN FB
Open request
(EN_C)
1) 6)
M_OPEN FB
Open valid
(VALID)
M_SEND FB
Send data Send data set
(SD)
2)
M_SEND FB
Send request
(REQ)
M_SEND FB
Send end 5)
(DONE) 3)
Ethernet
Send buffer
part
4)
Response
Remote node
1) Open a communication channel by the M_OPEN FB first. Set ON the open request (EN_C) to establish a connection with
the remote node according to the setting of the M_OPEN FB. The open valid flag (VALID) is set ON.
2) Set data to be sent in the send data (SD) of the M_SEND FB to set ON the send request (REQ).
3) The data is sent to the send buffer in the CPU module at the rising edge of the send request (REQ)
4) The CPU module adds a header part necessary for communication to the data and then sends it to the remote node.
5) When the data sending is completed and a response is received from the remote node, the send end (DONE) of the M_SEND
FB is set ON for one scan.
Note: If the data sending is not completed normally (no response is returned from the remote node or the end code of
the response is a value other than “0”), the send error (ERROR) is set ON for one scan. In this case, set OFF the send
request, and then re-execute processing for sending data from the step 3).
6) To break the communication channel when communication ends, set OFF the open request (EN_C) of the M_OPEN FB.
VALID is set OFF when the close processing is completed.
* When Fixed Buffer Communication mode is used, set separate ports for sending and receiving.
(Two M_OPEN FBs are required: one for sending and one for receiving.)
4-12
Section 4 Communication Procedures
Remote node
SX_CPU 3)
Ethernet
part Receive buffer
2) Receive valid
M_OPEN FB
Open request
(EN_C)
1) 5)
M_OPEN FB
Open valid
(VALID)
M_RECEIVE FB
Enable receive
(REQ)
M_RECEIVE FB
Receive data Receive data
(RD)
4)
M_RECEIVE FB
Receive end
(NDR)
1) Open a communication channel by the M_OPEN FB first. Set ON the open request (EN_C) to establish a connection with the
remote node according to the setting of the M_OPEN FB. The open valid flag (VALID) is set ON.
2) Set ON the enable receive (EN_R) of the M_RECEIVE FB to make the CPU module ready for receiving data.
3) The receive buffer receives data from the remote node.
4) The received data that is stored in the receive buffer in the CPU module is stored in the receive data (RD) of the M_RECEIVE
FB, and then the receive end (NDR) is set ON for one scan. When the receive end is set ON, the CPU module returns a
response to the remote node.
The CPU module returns into the waiting state if the enable receive is ON. Once the CPU module goes into the waiting state,
it keeps waiting for reception of data even after EN_R is set OFF. To stop the CPU module from waiting for reception, set OFF
the open request of the M_OPEN FB to break the channel.
During reception processing, the data length to receive and the size of received data part are checked. The CPU module
continues receiving until all the remaining data is received. Receiving is completed when all the data is received.
If the size of received data is greater than the data length to receive, “E052(h)” is returned as a response (E052: abnormal
number of data words). In this case, the receive error (ERROR) is not set ON in M_RECEIVE, and the received data is
discarded.
Note: If abnormal data is received, the receive end (NDR) is not set ON and the received data is not stored in the receive buffer.
5) To break the communication channel when communication ends, set OFF the open request (EN_C) of the M_OPEN FB.
VALID is set OFF when the close processing is completed.
* When Fixed Buffer Communication mode is used, set separate ports for sending and receiving.
(Two M_OPEN FBs are required: one for sending and one for receiving.)
4-13
Section 4 Communication Procedures
Command/response
1) Header part
The header part is a header of Ethernet TCP/IP or UDP/IP. When data is sent to another node by an application program, the
CPU module automatically adds a header to the data before sending it to the remote node. When data is received from another
node, the CPU module removes the header part from the received data, and sends only the data part to the FB.
2) Data part
The data part is data for Ethernet TCP/IP or UDP/IP. When data is sent to another node by M_SEND, a sub-header is added to
the data that is transferred to the send buffer in the CPU module. The data with the sub-header is set in the data part of TCP/IP
or UDP/IP, and then sent. When data in binary code is set in the send buffer, it is sent without change. When data in ASCII code
is set in the send buffer, it is sent after converted into ASCII characters.
When data is received from another node, the data is stored in the receive buffer in the CPU module after the sub-header is
removed from the data pert of TCP/IP or UDP/IP. When data in binary code is received, it is stored in the receive buffer without
change. When data in ASCII code received, it is stored in the receive buffer after converted into binary code.
<Command format>
<Response format>
Sub-header
2 bytes
Sub-header
4 bytes
4-14
Section 4 Communication Procedures
<Sub-header>
XXh
7 6 5 4 3 2 1 0
* 1 1 0 0 0 0 0
Command/response type
(The above digure shows the state during communication in Fixed Buffer mode)
Command/response flag
0: Command
1: Response
Command Response
Binary code
60h 00h E0h End code
ASCII code
36h 30h 36h 30h 45h 30h End code
“6” “0” “6” “0” “E” “0”
End code
Binary code ASCII code Meaning Description
00h 30h 30h Normal end
50h 35h 30h Command/response An unspecified code is set for the type of
type definition error command/response in sub-header.
52h 35h 32h Abnormal number of Data length exceeds the specified value.
data words
35h 34h ASCII conversion During communication in ASCII code, an ASCII
error code that cannot be converted into a binary code
was sent from the remote node.
60h 00h nL nH D1L D1H D2L D2H D3L D3H DnL DnH
Send/receive buffer
of CPU module
Sub-header Data length
n DnH DnL
* Data length is the number of bytes of the data that is stored in the send or receive buffer (Max. 1017 words).
4-15
Section 4 Communication Procedures
<Data, binary code (with data swap)>
60h 00h nL nH D1H D1L D2H D2L D3H D3L DnH DnL
Send/receive buffer
of CPU module
Sub-header Data length
n DnH DnL
36h 30h 30h 30h nL nH D1H D1L D2H D2L DnH DnL
Automatically set
Send/receive buffer
of CPU module
0 Data length n
1 D1H D1L
2 D2H D2L
n DnH DnL
4-16
Section 4 Communication Procedures
SX_CPU
R_WRITE FB
Write data Send data set
1)
R_WRITE FB
Write request
(REQ)
R_WRITE FB
Write normal end 4)
(DONE) 2)
Ethernet part
3)
Response
Remote node
MICREX-SX
1) Set data to be sent in the send data (SD) of the R_WRITE FB to set ON the write request (REQ).
2) When the write request (REQ) of the R_WRITE FB is set ON, a communication channel to the CPU module is automatically
opened.
3) When the connection is established, data is written in the remote SX node via Ethernet by the loader command.
4) The remote SX node (SX_CPU) executes the write command issued by R_WRITE and sends the processing result (response)
to the CPU module. When a normal end signal is received, the write normal end (DONE) is set ON for one scan.
Note: If the data writing is not completed normally (no response is returned from the remote node or the end code of the response
is a value other than “0”), the write error (ERROR) is set ON for one scan. In this case, set OFF the write request once,
and then re-issue it.
4-17
Section 4 Communication Procedures
SX_CPU
R_READ FB
Read request
(REQ)
1)
R_READ FB
Read noraml end
(DONE)
R_READ FB
Read data set
Read data
Ethernet part
3) Response
2)
(read data)
Remote node
MICREX-SX
1) When the read request (REQ) of the R_READ FB is set ON, a communication channel to the CPU module is automatically
opened.
2) When a connection is established, a request to read the memory in an SX_CPU is issued to the remote SX node (SX_CPU)
via Ethernet by the loader command.
3) The remote SX node (SX_CPU) executes the read command issued by R_READ and returns the processing result (read
data and status). When a normal end signal and read data is received, the read normal end (DONE) is set ON for one scan.
Note: If the data reading is not completed normally (no response is returned from the remote node or the end code of the
response is a value other than “0”), the read error (ERROR) is set ON for one scan. In this case, set OFF the read request
once, and then re-issue it.
4-18
Section 4 Communication Procedures
Used in order for the CPU module to open a local port for the Ethernet
General Purpose M_OPEN
communication part to establish a connection.
Communication mode
Fixed Buffer M_SEND Used to send data from an SX_CPU (SX system) to another node.
Communication mode
M_RECEIVE Used in order for an SX_CPU to receive data sent from another node.
Used to write data from an SX_CPU (SX system) into the Ethernet node in
R_WRITE
another SX system. No application program is necessary on the written side
Loader Command
Communication mode Used in order for an SX_CPU (SX system) to read data from the Ethernet
R_READ node in another SX system. No application program is necessary on the side
that receives the read request.
Note: Loader Command Communication mode requires no program to open a communication port since a communication port
is automatically opened at the rising edge of the CPU module.
Note 1: There are the following two modes for opening ports: “Passive mode” for receiving and “Active mode” for sending.
To send data, the remote node must be ready for receiving data. Therefore, the processing for opening ports in “passive
mode” for receiving data needs to be completed in advance.
Note 2: If the same port (the same self port and same communication port) is attempted to be reopened, the connection is
established during the retry that is performed three seconds later because it takes one second to open the socket.
4-19
Section 4 Communication Procedures
(2) FB format
FB No. (instance name)
M_OPEN
UINT MODULE_TYPE
UINT MODE
UINT SUB_MODE
UINT RPORT_NO
UINT SPORT_NO
4-20
Section 4 Communication Procedures
Note 1: When using the FTP client and server mode, do not use the following port Nos.
20, 21, and 25001 to 25100
Note 2: The remote port No. and local port No. are not actual port Nos. on the network. For more information on the actual port
Nos., read the description of “Self port standard No.” and “Communication target port standard No.” in “4-2-1 Basic
settings of Ethernet part.”
4-21
Section 4 Communication Procedures
*2 Communication mode
Set communication conditions for the connection where a channel is to be opened in the following format.
15 (F) 8 7 0
Expression for D300win: UINT#16#****
Expression for Standard loader: H****
Communication protocol
0: TCP/IP
1: UDP/IP
4-22
Section 4 Communication Procedures
<Open mode>
To open a connection via TCP/IP, open processing to Fullpassive/Unpassive node must be finished before active open
processing is performed.
5) Completion
of open
UDP/IP
UDP provides connectionless communication without the concept of open. However, the operation differs depending on the
selected open mode as follows.
1) Active open mode
The local node communicates only with another node that has the IP and port No. specified in M_OPEN.
Communication can also be performed when both local and remote nodes are put in Active open mode. If both stations are
put in Fullpassive or Unpassive open mode, communication cannot be performed.
2) Fullpassive open mode
The operation in Fullpassive open mode is the same as in Active open mode.
3) Unpassive open mode
The local node can communicate with any node. (The IP address and port No. of the remote node that are specified in
M_ OPEN are ignored.) After the open request (EN_C of M_OPEN) is set ON, the local node becomes ready for receiving
data from the remote node. The local node cannot send data before receiving the first data. Once data communication is
performed, the local node stores the remote node and thereafter communicates only with it.
When the open request (EN_C of M_OPEN) is set OFF, the stored information is reset and the local node is ready for access
from any node again.
4-23
Section 4 Communication Procedures
<Passive open mode>
Passive open mode is enabled only for TCP/IP communication. If “open completed at the establishment of the connection” is
selected,” VALID of M_OPEN is set ON when Ethernet connection is established.
If the connection is not established for 30 seconds after M_OPEN request is issued, an open error occurs (Status: 193).
IP address of
Reserved
communication partner (L)
IP address of
Reserved
communication partner (H)
Max. 1021 words Max. 1021 words
Reserved Port No. of
communication partner
Sending Receiving
IP address of IP address of
communication partner (L) communication partner (L)
* *
IP address of IP address of
communication partner (H) communication partner (H)
Max. 1021 words Max. 1021 words
Port No. of Port No. of
communication partner communication partner
4-24
Section 4 Communication Procedures
<Send data length selection>
This setting is effective in “General Purpose Communication mode” only.
When “Word” is selected, data is sent in units of words. The specified (SIZE) number of words from the beginning of the data
that is set in the send area (SD of M_OPEN) is sent. (Range of number of words: 1 to 1017 words)
When “Byte” is selected, data is sent in units of bytes. In the first word of the data that is set in the send area, enter the number
of bytes in hexadecimal that you want to send to the Ethernet communication channel. In the second and the following words,
set data to be practically sent. Data set in the second and the following words are outputted to the channel. (Range of number of
bytes: 1 to 2034 bytes)
* When “Byte” is selected, “Destination Addition mode” cannot be used together. If “Byte” is selected with Destination Addition
mode “enabled,” the setting is ignored and the operation is same as when “Word” is selected.
When the number of bytes is an odd number, the last one byte of the data becomes as follows according to the data swap
setting.
• When data swap is disabled
The last one byte is entered on the low-order side.
Packet of
TCP/IP or UDP/IP
D1H D1L
D2H D2L
D3H D3L
DnL
Packet of
TCP/IP or UDP/IP
D1H D1L
D2H D2L
D3H D3L
DnH
<Data swap>
When the transmission code is set to binary, the treatment of high-order and low-order bytes of transmission data are reversed.
When the transmission code is set to ASCII, disable the data swap.
4-25
Section 4 Communication Procedures
<Automatic reopen>
If Automatic Reopen mode is enabled when “Fullpassive” or “Unpassive” open mode is selected, the CPU module automatically
starts close processing when a close request is received from the remote node after the connection is established, and then
automatically moves into a state of waiting for an open request. Automatic reopen is executed when “Channel forcible close (status:
199)” is outputted to “M_SEND” or “M_RECEIVE”
Receive data
Max. 1018 words
Max. 1017 words
*3 Communication submode
“Communication submode” specifies whether or not to enable receipt confirmation when data is sent using TCP/IP protocol.
1) Operation when receipt confirmation is disabled (SUB_MODE = 0 [UINT#0])
Sending
M_SEND completion
DONEgON
ACK
SX bus Ethernet
* Data sending is completed when the data is sent onto Ethernet without waiting for ACK from the remote node.
Sending
ACK
completion
M_SEND
DONEgON
SX bus Ethernet
* Data sending is completed after waiting for ACK being sent from the remote node.
* When receipt confirmation is “enabled,” ASK reception is checked every 100 ms. Therefore, the send end (DONE) of the
M_SEND FB is delayed for up to 100ms compared with when receipt confirmation is “disabled.”
4-26
Section 4 Communication Procedures
<Notes when “receipt confirmation” is disabled in communication submode>
When “receipt confirmation is disabled,” if no ASK is received from the remote node due to a communication error such as
power interruption or LAN cable disconnection, the CPU module retries sending (for five minutes by default). No error occurs in
the M_OPEN or M_SEND FB during and after retry.
M_OPEN or M_SEND FB cannot be executed during retry operation. In other words, if a communication error occurs, the port
becomes unavailable for five minutes by default. In the CPU module, to shorten this time, specify a small value other than 0 for
“Sending retry interval” and a small value for “Sending retry number of times.”
When “receipt confirmation is enabled,” if a communication error occurs, ERROR of M_SEND is set ON for one scan after the
period of time specified in “TCP sending and receiving timeout value (30 seconds by default)” has elapsed and an error code
195 is outputted to STATUS. In this mode, another M_OPEN or M_SEND FB can be executed after an error has been detected. (No
need to wait for five minutes.)
*4 Status
For information on the status, refer to “4-4-7 Status.”
4-27
Section 4 Communication Procedures
(2) FB format
M_SEND_
Data type Data type
M_SEND
STATUS INT
ANY SD SD ANY
UINT SIZE
*1 When “Destination Addition mode” is enabled, four words of destination information are added to the send buffer.
Set this terminal to the send data size plus four words.
*2 When “byte” is selected for “send data length selection,” the first one word of the send buffer is the data size.
Set this terminal to the send data size plus one word.
*3 When “Destination Addition mode” is enabled, four words of destination information are added to the send buffer.
For the send data “SD,” reserve an area of send data size plus four words.
4-28
Section 4 Communication Procedures
(2) FB format
FB No. (instance name)
M_RECEIVE
STATUS INT
ANY RD RD ANY
UINT SIZE
Receive request EN_R BOOL IN When this signal is set ON, receiving is enabled and the CPU
module is ready for receiving a message.
Connection No. CON_NO UINT IN A connection No. that is opened by M_OPEN is set.
The “CON_NO” terminal of M_OPEN is connected to this one.
Receive data size SIZE UINT IN Sets the size of data to be received in units of words.
Receive data *1 RD ANY IN-OUT Connects a variable where the received data is stored.
Receive end NDR BOOL OUT Turns ON for one scan when the message receiving is
completed normally.
Receive error ERROR BOOL OUT Turns ON for one scan when the message receiving ends
abnormally.
Status STATUS INT OUT The result of the message receiving is outputted by a status
code. Refer to “4-4-7 Status” for more information.
4-29
Section 4 Communication Procedures
*1 When “Destination Addition mode” is enabled, four words of destination information are added to the receive buffer.
For the receive data “RD,” reserve an area of receive data size plus four words.
4-30
Section 4 Communication Procedures
Note 1: “REQ” is enabled at its rising edge and disabled during data writing (until “DONE” or “ERROR” is set ON after the rising
edge of “REQ.”
Note 2: Do not change “SD” during data writing. Otherwise, the write data cannot be guaranteed.
Note 3: “SIZE” is not limited when “VAR_TYPE” is set to zero. When a value other than zero is set, “SIZE” is limited by the
communication module through which data is sent.
Note 4: If the number of data specified in “SIZE” exceeds the variable size specified in “SD,” the data for the excess
part becomes undefined. Be sure to enter the specified size of variable for “SIZE.”
Note 5: To execute “R_WRITE” consecutively, set the default maximum TCP end timer value to zero.
Note 6: To execute “R_READ and/or “R_WRITE” consecutively, set the self and correspondent port standard Nos. to the default
value (256).
(2) FB format
R_WRITE
UDINT STATION_NO
UINT VAR_TYPE
UINT SIZE
ANY SD SD ANY
4-31
Section 4 Communication Procedures
<For D300win>
15 0
CPU No.
4-32
Section 4 Communication Procedures
Note 1: Additional “REQ” command is disabled during data reading (until “DONE” or “ERROR” is set ON after the rising edge of
“REQ.”
Note 2: Do not change “RD” during data reading. Otherwise, the read data cannot be guaranteed.
Note 3: “SIZE” is not limited when “VAR_TYPE” is set to zero. When a value other than 0 is set, “SIZE” is limited by the
communication module through which data is sent.
Note 4: If the number of data specified in “SIZE” exceeds the variable size specified in “RD,” another variable area is rewritten.
Be sure to enter the specified size of variable for “SIZE.”
Note 5: To execute “R_READ” consecutively, set the default maximum TCP end timer value to zero.
(2) FB format
R_READ
UDINT STATION_NO
UINT VAR_TYPE
UINT SIZE
ANY RD RD ANY
4-33
Section 4 Communication Procedures
Read request REQ BOOL IN The instruction is executed at the rising edge of this signal.
Communication MODULE_NO UINT IN Specifies the SX bus station No. of the CPU module.
module No. For CPU No. 0, 254 is set.
Communication CHANNEL_NO UINT IN For the CPU module, this terminal is fixed to “524.”
channel No.
Remote station No. STATION_NO UDINT IN Specifies the IP address of the remote node.
Variable specification VAR_TYPE UINT IN Sets the method for specifying variables.
method For the CPU module, this terminal is fixed to zero.
*1 Target variable to REMOTE_VAR ANY IN Specifies the remote SX_CPU (top address) where data is
access read.
Read data size SIZE UINT IN Sets the size of data to be read in units of words.
Read data RD ANY IN-OUT Connects a variable where data to be read is stored.
Read end DONE BOOL OUT Turns ON for one scan when the reading is completed
normally.
Read error ERROR BOOL OUT Turns ON for one scan when the reading is failed.
Status STATUS INT OUT The result of the reading is outputted by a status code.
Refer to “4-4-7 Status” for more information.
4-34
Section 4 Communication Procedures
4-4-7 Status
Error code Cause
CHANNEL_NO error
32
• A value other than 524 is set for CHANNEL_NO.
Parameter error
• Zero was entered in the SIZE terminal.
• An out-of-range value was entered in VAR_TYPE.
177 • A value other than 1 to 56 was entered for the connection No.
• The send/receive data area exceeds the memory boundary.
• ”Byte” is selected for “Send data length selection” in the MODE setting of M_OPEN, however, the first word
(number of bytes) of the SD terminal of M_SEND is zero.
Message sending error (communication error between the CPU module and another node)
• No data can be sent to the communication module at the remote node.
195
• No response is returned from the communication module at the remote node (sending is completed,
(Note)
however, no ACK is returned).
• Other transmission errors on the network
196 Message receive error (communication error between the CPU module and another node)
Channel forcible close (communication error between the CPU module and another node)
199 • A close request is received from the remote node.
* If this code is received, close the corresponding port once, and then re-execute the open processing.
4-35
Section 4 Communication Procedures
Buffer over
206
• Data exceeding the specified receive data size was received. *Receive data is not updated.
Note: When the communication protocol is UDP/IP, no communication is performed when a channel is opened. Therefore, no
error occurs even if the station No. (IP address) of the remote node cannot be found on the network. In addition, in UDP/IP
communication, no connection is established when a channel is opened. The connection is considered to be established
when the CPU module receives data from the remote node.
4-36
Section 5 SNTP Client and FTP Client Communication
SNTP request
For an SNTP request, the sent time data is outputted to the NTP server as it is.
The time until the CPU module receives the time data sent from the NTP server is not taken into account.
In an extreme case, if the CPU module receives a frame sent from the NTP server after five seconds, a time value delayed by
five seconds is outputted.
5-1
Section 5 SNTP Client and FTP Client Communication
SNTP_CLIENT_
Data type Data type
SNTP_CLIENT
STATUS INT
UTC_DT DT
g UDINT#16#C0A80064
End flag DONE BOOL OUT Turns ON for one scan when the current time acquisition is
completed normally.
Error flag ERROR BOOL OUT Turns ON for one scan when the current time acquisition is failed.
(For example, no server exists or the NTP service is not supported.)
Status STATUS INT OUT Outputs the error contents.
Current time UTC_DT DT OUT Outputs the current time (Coordinated Universal Time [*1]: UTC) in
the date/time (DT) type.
(The number of seconds that has elapsed since 00:00:00, 1 January
1970 is outputted.)
Outputs in other cases are indefinite.
5-2
Section 5 SNTP Client and FTP Client Communication
SNTP_CLIENT
REQ DONE
IP_ADDR ERROR
ADD_DT_T
UTC_DT
TIME#9h
Japan Standard Time (JST)
is 9 hours ahead of UTC.
HW_RTC
EN
PDT
5-3
Section 5 SNTP Client and FTP Client Communication
Example of connection
Ethernet
FTP server
5-4
Section 5 SNTP Client and FTP Client Communication
Name Description
FTP_OPEN Establishes a connection to the FTP server.
FTP_PUT Stores a file in the FTP server.
FTP_GET Obtains a file from the FTP server.
FTP_CREATE_DIR Creates a directory in the FTP server.
FTP_DELETE_FILE Deletes a file in the FTP server.
The following restrictions are imposed on the entire FTP client function when performed.
1) Prohibited to establish multiple FTP connections
Since only one FTP_OPEN can be simultaneously executed, the number of servers that can be simultaneously accessed is
limited to one.
It is possible to place multiple FTP_OPEN FBs that are programmed not to be simultaneously executed.
2) Prohibited to execute GET, PUT, CREATE, and DELETE simultaneously
After FTP_OPEN (connection to the FTP server is opened), multiple requests cannot be simultaneously issued. It is possible
to issue another request in one OPEN. In this case, issue the next request after the previous request is completed.
3) File is not guaranteed when the application stops.
If a stop request is issued during FTP data transfer, the file transfer is halted and the FTP connection is broken. When the
transfer is halted, the file data is cut and not guaranteed.
4) Functions unexecutable by FTP FB
Passive mode (*), file name change, directory delete, additional data writing in an existing file, and relative path access (using
the current directory)
* Passive mode
When security such as firewall is set for the client device and a usual FTP communication cannot be performed, an available
port is notified by the client side to enable file transfer. Passive mode is not supported in the CPU module because security
is not set for ports.
5) FTP communication port
Since FTP communication uses TCP/IP protocol, the TCP/IP port No. is used.
FTP has two types of connections: control connection for command notification and data connection for file transfer by PUT
or GET.
Control connection
Client side (CPU module) Server side (e.g. PC)
Self port: Automatic Self port: 21
Remote port: 21 Remote port: CPU module self port
Data connection
Client side (CPU module) Server side (e.g. PC)
Self port: 25001 to 25100 Self port: 20 (Some devices obtain an arbitrary port)
Remote port: PC self port Remote port: 25001 to 25100
Self port standard No. set in the system definition is not applied when the FTP client function is used.
Note: When using the FTP client function, do not use 25001 to 25100 for the self and remote port No. of the message FB
(M_OPEN) that uses directly connected Ethernet.
6) Prohibited to allocate user name, password, or file path character strings to GM space
User name or file path character strings of FTP_OPEN and file path character strings of other FBs are prohibited to be
allocated to the global memory (GM) space. Otherwise, the FB ends abnormally.
Terminal output when the FB ends abnormally
ERROR terminal: Turns ON for one scan
STATUS terminal: Outputs a code = 177 (parameter error)
SUB_STATUS terminal: Outputs zero. (because this is not a communication error)
5-5
Section 5 SNTP Client and FTP Client Communication
(1) FB format
FB No. (instance name)
FTP_OPEN_
Data type Data type
FTP_OPEN
STATUS INT
SUB_STATUS UDINT
CON_NO UDINT
(Note 1)
NAME:ARRAY[1..N]OF WORD; USER_NAME USER_NAME NAME
(Note 1)
PASS:ARRAY[1..N]OF WORD; PASSWORD PASSWORD PASS
g UDINT#16#C0A80064
User name USER_NAME Note 1 IN-OUT Specifies the user name to access the FTP server.
The user name can be up to 63 characters.
Password PASSWORD Note 1 IN-OUT Specifies the password for the user to access the FTP server.
The password can be up to 63 characters.
Connection VALID BOOL OUT Remains ON when the connection is established successfully.
enable output
Error flag ERROR BOOL OUT Turns ON for one scan when the connection to the FTP server is
failed.
Status STATUS INT OUT Outputs the error contents.
Sub-status SUB_STATUS UDINT OUT Outputs the detailed status after the request completion.
(This terminal is enabled when the request ends abnormally
and outputs zero when completed normally.)
Connection No. CON_NO UDINT OUT Outputs the connection No. when the connection to the FTP server
is successfully established.
Status Sub-status
Status Cause Description
code code
177 Parameter A value out of the specified “IP_ADDR” does not exist. 1
error range was entered.
The user name or password exceeds the maximum 1
length.
5-7
Section 5 SNTP Client and FTP Client Communication
1) Create a user FB that is an FTP_OPEN FB without user name and password setting.
2) Save the created user FB with a password.
3) Read and use the FTP_OPEN created as a user FB as a user library in a new project.
(The library cannot be monitored since it is protected by the password of the project.)
5-8
Section 5 SNTP Client and FTP Client Communication
(1) FB format
FTP_PUT_
Data type Data type
FTP_PUT
SUB_STATUS UDINT
(Note 1)
NAME:ARRAY[1..N]OF WORD; LOCAL_FILE LOCAL_FILE NAME
(Note 1)
NAME:ARRAY[1..N]OF WORD; NEW_R_FILE NEW_R_FILE NAME
Store file NEW_R_FILE Note 1 IN-OUT A file created in the FTP server
Up to 255 characters can be set including the file name.
End flag DONE BOOL OUT Turns ON for one scan when “a normal response to the file store
request” is received from the FTP server.
Error flag ERROR BOOL OUT Turns ON for one scan when the file is unable to be stored in the
FTP server.
Error status STATUS INT OUT Outputs the error code contents.
Substatus SUB_STATUS UDINT OUT Outputs the detailed status after the request completion.
(This terminal is enabled when the request ends abnormally
and outputs zero when completed normally.)
Note 1: Connect a word-type array and specify the full path of the file as an ASCII code.
An example of specifying a path: “/DATA/Sample/Sample.text”
Do not change the “LOCAL_FILE” and “NEW_R_FILE” during FB processing. Otherwise, the send data is not
guaranteed.
5-9
Section 5 SNTP Client and FTP Client Communication
Status Sub-status
Status Cause Description
code code
65 File name error The specified file name The specified file name does not exist in the user ROM. 13
does not exist.
The server rejected access to the specified file. 6
66 File access An error occurred during An error occurred while the file in the user ROM was 18
error file access. being read.
177 Parameter A value out of the specified The number of the file path characters exceeds the limit. 1
error range was entered.
The file path character string is allocated to the GM 0
space.
195 FTP Connection to the FTP The server rejected the request of the command. 19
communication server was failed.
An error occurred on the network during command 20
error
communication.
Acquisition of the internal work memory was failed. 11
Data connection establishment was failed. 9
A timeout occurred during file transfer. 10
(More than 30 seconds has elapsed per transfer.)
207 Connection A wrong connection No. An unopened connection No. was specified. 5
No. error was specified.
A communication request was issued to the connection 5
No. that was in the middle of communication.
(This error occurs when PUT and GET are operated in
parallel.)
5-10
Section 5 SNTP Client and FTP Client Communication
(1) FB format
FTP_GET_
Data type Data type
FTP_GET
SUB_STATUS UDINT
(Note 1)
NAME:ARRAY[1..N]OF WORD; NEW_FILE NEW_FILE NAME
(Note 1)
NAME:ARRAY[1..N]OF WORD; R_FILE R_FILE NAME
New file NEW_FILE Note 1 IN-OUT A file created in the PLC (in the user ROM)
Up to 255 characters can be set including the file name.
File in server R_FILE Note 1 IN-OUT A file in the FTP server
Up to 255 characters can be set including the file name.
End flag DONE BOOL OUT Turns ON for one scan when “a normal response to the file get
request” is received from the FTP server.
Error flag ERROR BOOL OUT Turns ON for one scan when the file is unable to obtain from the FTP
server.
Note 1: Connect a word-type array and specify the full path of the file as an ASCII code.
An example of specifying a path: “/DATA/Sample/Sample.txt”
Do not change the “NEW_FILE” and “R_FILE” during FB processing. Otherwise, the send data is not guaranteed.
5-11
Section 5 SNTP Client and FTP Client Communication
Status Sub-status
Status Cause Description
code code
65 File name error The specified file name The server rejected access to the specified file or the 6
does not exist. specified file name does not exist.
66 File access An error occurred during An error occurred while the file in the user ROM was being 18
error file access. read.
Data obtained from the server is unable to be stored with 7
the specified file name in the user ROM.
(The same file name already exists in the user ROM.)
177 Parameter A value out of the specified The number of the file path characters exceeds the limit. 1
error range was entered.
The file path character string is allocated to the GM 0
space.
195 FTP Connection to the FTP The server rejected the request of the command. 19
communication server failed. An error occurred on the network during command 20
error communication.
Acquisition of the internal work memory was failed. 11
Data connection establishment was failed. 9
A timeout occurred during file transfer. 10
(More than 30 seconds has elapsed per transfer.)
207 Connection A wrong connection No. An unopened connection No. was specified. 5
No. error was specified. A communication request was issued to the connection 5
No. that was in the middle of communication.
(This error occurs when PUT and GET are operated in
parallel.)
5-12
Section 5 SNTP Client and FTP Client Communication
(1) FB format
FTP_CREATE_DIR_
Data type Data type
FTP_CREATE_DIR
STATUS INT
SUB_STATUS UDINT
(Note 1)
NAME:ARRAY[1..N]OF WORD; DIRECTORY DIRECTORY NAME
Note 1: Connect a word-type array and specify the full path of the file as an ASCII code.
Example of specifying a path: “/DATA/Sample”
Do not change the “DIRECTORY” during FB processing. Otherwise, the send data is not guaranteed.
5-13
Section 5 SNTP Client and FTP Client Communication
Status Sub-status
Status Cause Description
code code
65 File name error The specified file name An already existing directory is attempted to be created. 15
does not exist. The server rejected creation of the specified directory. 6
177 Parameter A value out of the specified The number of the directory path characters exceeds the 1
error range was entered. limit.
The directory path character string is allocated to the GM 0
space.
195 FTP Connection to the FTP The server rejected the request of the command. 19
communication server failed. An error occurred in the server during command 20
error communication.
207 Connection A wrong connection No. An unopened connection No. was specified. 5
No. error was specified.
Communication request was issued to the connection No. 5
that was in the middle of communication.
(This error occurs when PUT and GET are operated in
parallel.)
5-14
Section 5 SNTP Client and FTP Client Communication
(1) FB format
FTP_DELETE_FILE_
Data type Data type
FTP_DELETE_FILE
STATUS INT
SUB_STATUS UDINT
(Note 1)
NAME:ARRAY[1..N]OF WORD; FILE_NAME FILE_NAME NAME
Note 1: Connect a word-type array and specify the full path of the file as an ASCII code.
An example of specifying a path: “/DATA/Sample/Sample.txt”
Do not change the “FILE_NAME” during FB processing. Otherwise, the send data is not guaranteed.
5-15
Section 5 SNTP Client and FTP Client Communication
Status Sub-status
Status Cause Description
code code
65 File name error The specified file name The server rejected deletion of the specified file. 6
does not exist.
177 Parameter A value out of the specified The number of the file path characters exceeds the limit. 1
error range was entered. 0
The file path character string is allocated to the GM
space.
195 FTP Connection to the FTP The server rejected the request of the command. 19
communication server was failed. An error occurred in the server during command 20
error communication.
207 Connection A wrong connection No. An unopened connection No. is specified. 5
No. error was specified. A communication request was issued to the connection 5
No. that was in the middle of communication.
(This error occurs when PUT and GET are operated in
parallel.)
5-16
Section 5 SNTP Client and FTP Client Communication
a) Operation when a project that contains newly added instructions is used in Expert that does not support them
b) Operation depending on the combination of Expert supporting newly added instructions and a CPU
Download
Target CPU Compile
Loader User ROM
Other than Compile error ー Type mismatch
SPH2000/3000/5000 series
SPH2000 not supporting Normal Download error Fatal fault
the newly added instructions (PLC version that does not support (Undefined FB/FCT) (Note)
the newly added instructions)
Note: Pay attention to the version. Otherwise, a fatal fault occurs when an instruction is executed.
5-17
Section 5 SNTP Client and FTP Client Communication
PUT execution
5-18
Section 6 Ethernet Communication Information
<Procedure>
Open the “Failure Diagnosis” dialog box, select the CPU in the “Composition” screen, and then click the “Ethernet Information”
tab on the top right. Information on the built-in Ethernet is displayed on the right side of the screen. When you click “Mail
information,” information on the mail is displayed.
* “Ethernet Information” and “Mail Information” are cleared when the power supply of the PLC is reset.
6-1
Section 6 Ethernet Communication Information
Channel information 1
Channel information 2
Channel information 10
Reserved
6-2
Section 6 Ethernet Communication Information
6-2-2 Communication channel status information
Information on the status of communication ports being used is displayed (The figure below shows an example of a CPU with
maximum 10 channels of connections.). Communication status information for one channel consists of 24 words as shown
below.
Channel 1
Channel 2
Channel 10
Reserved
+07h Receive error code +0Fh Receiving operation time (current) +17h Reserved
6-3
Section 6 Ethernet Communication Information
7) Sending operation time
The maximum, minimum and current values of the operation time for sending in each communication performed are stored in
these areas.
(a) The operation time is stored by a binary value in steps of 55 ms.
(b) The time required until the local module completes sending after a send request is issued is stored.
* This data is cleared when the next opening operation is completed or communication is started.
8) Receiving operation time
The maximum, minimum and current values of the operation time for receiving in each communication performed are stored in
these areas.
(a) The operation time is stored by a binary value in steps of 55 ms.
(b) For the operation time for receiving, the following values are stored:
<General Purpose Communication mode>
The time until receipt confirmation is called by a user program after the local module completes receiving
<Fixed buffer communication mode>
The time until receipt confirmation is called by a user program and the local module completes the operation to return a
response after the local module completes receiving.
9) Send count
The total number of normally completed operations for sending data to another node is stored in this area.
(a) Counted when the communication of a command and a response is completed normally.
(b) Counted when one of the following communications is completed normally.
• Sending data to another node in Fixed Buffer Communication mode
• Reading data of the shared buffer from another node in Shared Buffer Communication mode
• Sending data to another node in General Purpose Communication mode
* This data is cleared when the next opening operation is completed or communication is started.
10) Send error count
The total number of communication errors that occurred in sending data to another node (when the communication of a
command and a response ends abnormally) is stored in this area.
* This data is cleared when the next opening operation is completed or communication is started.
11) Receive count
The total number of normally completed operations for receiving data from another node is stored in this area.
(a) Counted when the communication of a command and a response is completed normally.
(b) Counted when one of the following communications is completed normally.
• Receiving data from another node in Fixed Buffer Communication mode
• Writing data in the sheared buffer from another node in Shared Buffer Communication mode
• Receiving data from another node in General Purpose Communication mode
* This data is cleared when the next opening operation is completed or communication is started.
12) Receive error count
The total number of communication errors that occurred in receiving data from another node (when the communication of a
command and a response ended abnormally) is stored in this area.
* This data is cleared when the next opening operation is completed or communication is started.
6-4
Section 6 Ethernet Communication Information
6-2-3 Communication parameter information
Information on the MAC address, IP address, and communication definition of the CPU module is displayed.
Close processing
00h MAC address (L) 08h Default gateway address (L) 10h at receiving timeout
MAC address (M) Default gateway address (H) Self port standard No.
IP address is
0001 IP address (L)
C0A8 IP address (H) C0 A8 00 01 192.168.0.1
192 168 0 1
6-5
Section 6 Ethernet Communication Information
6-2-4 Node connection information
Intensive information on the communication status of each communication channel that is specified by a client port No. of the
CPU module is displayed (The figure below shows an example of a CPU with maximum 10 channels of connections.).
Connection status
Error code
0Ah
Not used
20h
21h Error code (channel 1)
Not used
3Fh
1) Connection status
The open status of each channel is stored in this area.
0000: Not open
0001: Opening
0002: Already open
0003: Closing
8x: Forcible close
2) Error code
A binary value for the code of an error that occurs when opening a channel, sending or receiving data is stored in this area.
For more information on the error codes, refer to "6-2-6 Error code list."
* The data is cleared when the next opening operation is completed normally or communication is started.
6-6
Section 6 Ethernet Communication Information
6-2-5 Error log information
Error information that is detected during Ethernet communication is stored. Error log is stored in ring files. Using 8 words for a
piece of information, maximum 64 error codes can be stored.
Total counter
Max. number
Log type Counter of data
Size of data part
Error code 1
Error code 2
Error code 64
08h Reserved
09h Reserved
0Ah Reserved
0Bh Reserved
16h Reserved
17h Reserved
20Fh
* For more information on the error codes, refer to "6-2-6 Error code list."
“0” or a socket number will be entered in detail code. (This code is not related to the error occurred.)
Socket number refers to a number that is assigned internally when a port opens.
6-7
Section 6 Ethernet Communication Information
1) No.
A No. of error log is stored.
The storage position of the latest error log (counter value) is the position of the error log No. indicated by a counter value minus
one.
When an error occurs, error log is accumulated in order from error log No. 00 to 3Fh.
2) Type
An error type is stored.
0001: Parameter error, 0002: Sequence error, 0003: Upper layer error, 0004: Communication error from physical layer to
transport layer
3) Error code, Detail code
Error contents are stored. * For more information on the error codes, refer to "6-2-6 Error code list (2) Detail error codes for
individual error type."
4) Log time
A time of error code storage is stored. The free-run counter from power-on is used. The unit is µs.
6-8
Section 6 Ethernet Communication Information
6-2-6 Error code list
The error codes stored in "error log information," "communication channel status information" or "node connection information"
as well as their contents are described below:
15 8 7 0
Error type
0001: Parameter error
0010: Sequence error
0011: Communication error in upper layer
0100: Communication error between physical layer and transport layer
Code Description
01h (0010h) “0.0.0.0” or “255.255.255.255” is specified for the IP address of the local module.
02h (0020h) There is an error in the parameter for initial processing.
The number of bits of the subnet mask is smaller than the number of bits of the
03h (0030h)
netmask that is obtained from the IP address of the CPU module.
04h (0040h) “0.0.0.0” or “255.255.255.255” is specified for the IP address of the default gateway.
06h (0060h) Ethernet part hardware error
The IP address of the local module, “0.0.0.0” or “255.255.255.255” is specified for the
10h (0100h)
IP address of another node.
The same combination of “a port No. of the local module” and “a port No. of another
13h (0130h)
node” as that for already opened connection is set.
16h (0160h) A wrong communication mode is specified.
20h (0200h) The send data length is out of the specified range (1017 words).
22h (0220h) The storage area for receive data is smaller than the receive data length.
2) Sequence error
Code Description
01h (0010h) The local module does not yet complete the processing for starting communication.
02h (0020h) The processing for opening the channel is not yet completed.
03h (0030h) Data was sent or received while the channel is being closed.
6-9
Section 6 Ethernet Communication Information
3) Communication error in upper layer
Code Description
A code other than 00h (normal end) was returned from another node as the end code
01h (0010h)
for a response in Fixed Buffer Communication mode.
02h (0020h) A response watch timeout occurred in Fixed Buffer Communication mode.
03h (0030h) A response receiving timeout occurred in Fixed Buffer Communication mode.
Code Description
02h (0020h) Connection could not be established during processing for opening a TCP connection.
03h (0030h) Checksum error was found in the receive data during communication using TCP protocol.
04h (0040h) Checksum error was found in the receive data during communication using UDP protocol.
6-10
Section 6 Ethernet Communication Information
6-2-7 Working information
Working information shows the frequency of occurrences of an event during Ethernet communication. They are overwritten
whenever updated to always provide the newest information. Eight words are used for a piece of running status information as
shown below.
No. Description
0 Ethernet send count (SMC send end count)
1 Ethernet receive count (SMC receive end count)
2 Ethernet send interruption count
3 Ethernet receive interruption count
4 Send delay collision count
5 Carrier lost count
6 Underrun error count
7 16 collision count
8 Send allocation incompletion count (when requested)
9 Send allocation incompletion count (when held)
A Send queuing count
B Send queue full count
C Send buffer no request source count
D Send request count (TASK)
E Send request count (INT)
F Send completion count
10 Receive alignment error count
11 Receive CRC error count
12 Receive long packet count
13 Receive short packet count
14 Receive data size over count
15 Receive overrun count
16 Receive completion count
17 Receive USNET queue full count
18 Receive USNET buffer full count
19 Ethernet controller memory reset count
1A Ethernet controller memory start count
1B Reserved
6-11
Section 6 Ethernet Communication Information
Code Description
1C Count of illegal code detection in receive data
1D Count of no starting point of stream delimiter found in receive data
1E Count of no end point of stream delimiter found in receive data
1F Jabber detection count
20 Count of changeover from half duplex to full duplex
21 Count of changeover from full duplex to half duplex
22 Reserved
23 Reserved
24 Socket error count
25 Bind error count
26 Connect error count
27 Listen error count
28 Accept error count
29 Send error count
2A Snedto error count
2B Recv error count
2C Recvfrom error count
2D Closesocket error count
2E Set socket option error count
2F Reserved
30 Function code error count
31 Count of no connection information setting detection
32 Count of failure of connection information notification area acquisition
33 Count of send request issue cancellation
34 Count of parameter error detection during send request
35 Count of receive request issue cancellation
36 Count of parameter error detection during receive request
37 Failure of receive descriptor acquisition
38 Count of command abnormal end of loader command server
39 Count of channel No. acquisition failure
3A Count of ASCII conversion work resource full
3B Data size error
3C ACK receive timeout count
3D ASCII g binary conversion error
3E Reserved
3F Reserved
40 Command code error count (Fixed Buffer)
41 Response frame error count (Fixed Buffer)
42 Response timeout count
43 End code error count when response received
6-12
Section 6 Ethernet Communication Information
Code Description
44 Reserved
45 Reserved
46 Reserved
47 Reserved
48 Reserved
49 Reserved
4A Reserved
4B Reserved
4C Reserved
4D Reserved
4E Reserved
4F Reserved
50 Self diagnosis send error
51 Self diagnosis receive error
52 Mismatch of number of self diagnosis receive data
53 Self diagnosis data comparison error
54 Self diagnosis MMU stop timeout
55 Self diagnosis memory allocation error
56 Self diagnosis send status error
57 Self diagnosis receive status error
58 TCP Active Open Request
59 TCP Active Open Complete
5A TCP Active Close Request
5B TCP Active Close Complete
5C TCP Active Send Request
5D TCP Active Send Complete
5E TCP Active Receive Request
5F TCP Active Receive Complete
60 TCP Passive Open Request
61 TCP Passive Open Complete
62 TCP Passive Close Request
63 TCP Passive Close Complete
64 TCP Passive Send Request
65 TCP Passive Send Complete
66 TCP Passive Receive Request
67 TCP Passive Receive Complete
68 UDP Open Request
69 UDP Open Complete
6A UDP Close Request
6B UDP Close Complete
6-13
Section 6 Ethernet Communication Information
Code Description
6C UDP Send Request
6D UDP Send Complete
6E UDP Receive Request
6F UDP Receive Complete
70 LDC Open Request
71 LDC Open Complete
72 LDC Close Request
73 LDC Close Complete
74 LDC Message Request
75 LDC Message Complete
76 Reserved
77 Reserved
78 TCP Active Normal Event
79 TCP Active Error Event
7A TCP Passive Normal Event
7B TCP Passive Error Event
7C UDP Normal Event
7D UDP Error Event
7E LDC Normal Event
7F LDC Error Event
6-14
Section 6 Ethernet Communication Information
000h
SMTP server address
:
(64 words)
03Fh
040h
: Reserved
0BFh
0C0h
Local station mail address
:
(64 words)
0FFh
101h Reserved
102h Reserved
104h
SMTP user ID
:
(32 words)
123h
124h
: Reserved
147h
149h Reserved
14Ah
: Error information block 1
1CDh
1CEh
: Error information block 2
251h
252h
: Error information block 3
2D5h
2D6h
: Error information block 4
359h
35Ah
: Error information block 5
3DDh
3DEh
: Error information block 6
461h
462h
: Error information block 7
4E5h
4E6h
: Error information block 8
569h
6-15
Section 6 Ethernet Communication Information
1) SMTP server address
The SMTP server address (domain name or IP address) set in the system definition is stored in ASCII codes.
• Example of domain name
• Example of IP address
An IP address expressed in a decimal value is stored in ASCII code as shown below.
4) SMTP authentication
Information on SMTP authentication set in the system definition is stored.
0000: SMTP authentication is used
0001: SMTP authentication is not used
5) SMTP user ID
The SMTP user ID set in the system definition is stored in ASCII codes.
6-16
Section 6 Ethernet Communication Information
<Details of error information blocks>
The error information block consists of a destination address (128 words), error occurrence time (2 words), error status (1 word),
and substatus (1 word) in order.
+00h
Destination mail address
:
(128 words)
+7Fh
+83h Substatus
• Destination address
The destination address set in the M_SEND FB is stored in ASCII codes.
6-17
Appendix 1 Loader Command
Note: When "CPU batch initialize and start" or "CPU individual initialize and start" is executed, the retain memory is cleared
before the CPUs are started.
Personal computer
Request command
Ethernet
Response command
MICREX-SX
* The response monitoring time on the personal computer side must be 3 seconds or more.
App.1-1
Appendix 1 Loader Command
DP (FBh fixed)
Operation status
Connection mode
Connection ID (L)
(00h fixed)
(00h fixed)
(00h fixed)
(00h fixed)
Command
Mode
(00h fixed)
(01h fixed)
Data part
(max. 492 bytes)
App.1-2
Appendix 1 Loader Command
<Detail description of transmission data>
1) TCP/IP header part
In the case of a request command, this part is added at the top of the transmission data part of a loader command on the
personal computer side before the command is sent. In the case of a response command, this part is added at the top of the
transmission data part by the CPU module before the response data is returned. Normally, the Ethernet communication driver
automatically adds this part, therefore, the user do not need to pay attention to this.
2) DP (Destination Port)
For request (PC g PLC)
Destination port number on the destination module (not TCP/IP port No.). This is specified by the requester.
* In general, 251 (FBh) is specified, which is the loader interface server port on CPU0.
* When accessing CPU0, 253 (FDh) can be specified, which is the loader command server port.
* The positions of DP and SP are replaced in response data.
For response (PLC g PC)
The same DP as the one sent by the sender is returned.
3) SP (Source Port)
Requester port No. on the source module. This No. is specified by the requester and fixed to 128 (80h).
For request (PC g PLC)
Fixed to 80h.
* The positions of DP and SP are replaced in response data.
For response (PLC g PC)
SP is any number from 80 to 87h. (The PLC automatically determines an arbitrary No.)
4) Transaction
By specifying Yes/No of transaction, Request/Response, and Transaction ID, you can manage communication sequence on the
personal computer. If you do not need to manage it, set 80H on the PC. The response from the PLC becomes C0H.
Yes/No of transaction must be set by the requester (PC). Transaction ID must be dynamically assigned on the PC side when a
request is issued. The response bit is set by the CPU module when a response is returned.
* The requester (PC) must set the transaction ID and also perform transaction ID collation of response data.
7 0
Transaction ID (0 to 63)
5) Transmission status
Indicates the result of transmission via the SX bus or network
* Fixed to 00h when a request is issued.
* In a response command, a value other than 00h means abnormal end. The meaning of individual codes is the same as
“operation status”.
App.1-3
Appendix 1 Loader Command
6) Operation status
Indicates the result of individual operations requested by a command. It is checked by a response command. A request command
is issued when this item is set to FFh (fixed).
2Fh Initialization not competed Requested command cannot be executed because the system is now being initialized.
40h Data setting error Invalid data type or number was specified.
41h Inexistent data Specified data cannot be found.
44h Memory address setting Specified address exceeds the valid range.
error
45h Memory size over Address + the number of read/write words exceed the valid range.
A0h Command send destination No module exists at specified destination station No.
setting error
A2h No response to command No response data is returned from the destination module.
A4h SX bus send error Command cannot be communicated because an error occurred in the SX bus.
A5h SX bus send NAK Command cannot be communicated because NAK occurred while sending data via
the SX bus.
FFh Specification at sending "Operation status" must be set to FF when issuing a request command.
request command
Target module
Connection mode Connection ID (L) Connection ID (H)
of transmission
CPU 0 to CPU 7 7Bh SX bus station No. of destination CPU (FEh to F7h) 00h
P/PE link, FL-net 7Bh SX bus station No. of destination module (F6h to EFh) 00h
8) Command, mode
Command: Major classification code of command
Mode: Detail code of command
For more information on the commands and modes, refer to “Appendix 1-3 Detail Description of Loader Commands."
App.1-4
Appendix 1 Loader Command
1) Command/mode code
Command: 00h, Mode: 00h
2) Format of the data part of request command and response command
Read data
* Set the memory address and number of words of read data in hexadecimal.
12 34 34
56 78 12
78
56
App.1-5
Appendix 1 Loader Command
4) Example of data read command
[When D300win is used]
The table below shows the command part for reading two words of data beginning with %MW1.1000 of the standard memory of the
CPU module (CPU station No. 0). (Data in the case of %MW1.1000=WORD#16#1234 and %MW1.1001=WORD#16#5678)
[When Standard loader is used]
The table below shows the command part for reading two words of data beginning with WM1000 of the standard memory of the
CPU module (CPU station No. 0). (Data in the case of WM1000=H1234 and WM1001=H5678.)
App.1-6
Appendix 1 Loader Command
<Memory type code>
The table below shows the memory type codes for individual MICREX-SX internal memories. (The address expression for
D300win loader/Standard loader)
Note 1: When the broadcast area of a PE-link module is accessed by a command, the address does not begin with 0 (zero).
Refer to the address correspondence table shown below.
Note 2: When the broadcast area of a P-link module is accessed by a command, the high-speed bit area, high-speed word
area, and low-speed word area are not consecutive. Refer to the address correspondence table shown below.
%MWo.1.0/WMo.0 00 1E 00
High-speed area 1
| | | |
(high-speed bit area)
%MWo.1.511/WMo.511 00 1F FF
%MWo.1.512/WMo.512 00 20 00
High-speed area 2 | | | |
%MWo.1.8703/WMo.8703 00 3F FF
%MWo.1.8704/WMo.8704 00 40 00
Low-speed area 1 | | | |
%MWo.1.12799/WMo.12799 00 4F FF
%MWo.1.12800/WMo.12800 00 50 00
Low-speed area 2 | | | |
%MWo.1.25087/WMo.25807 00 7F FF
%MWo.1.0/WMo.0 00 00 00
High-speed area 1
| | | |
(high-speed bit area)
%MWo.1.511/WMo.511 00 01 FF
%MWo.1.512/WMo.512 00 02 00
High-speed area 2 | | | |
%MWo.1.1663/WMo.1663 00 06 7F
%MWo.1.1664/WMo.1664 00 08 00
Low-speed area 1 | | | |
%MWo.1.4735/WMo.4735 00 13 FF
%MWo.1.4736/WMo.4736 00 14 00
Low-speed area 2 | | | |
%MWo.1.7807/WMo.7807 00 1F FF
App.1-7
Appendix 1 Loader Command
1) Command/mode code
Command: 01h, Mode: 00h
2) Format of the data part of request command and response command
App.1-8
Appendix 1 Loader Command
1) Command/mode code
Command: 04h, Mode: 00h
2) Format of the data part of request command and response command
None
3) Batch start command
The table below shows the command part for batch start:
App.1-9
Appendix 1 Loader Command
1) Command/mode code
Command: 04h, Mode: 01h
2) Format of the data part of request command and response command
None
3) Batch initialize and start command
The table below shows the command part for batch initialize and start.
App.1-10
Appendix 1 Loader Command
1) Command/mode code
Command: 04h, Mode: 02h
2) Format of the data part of request command and response command
None
3) Batch stop command
The table below shows the command part for batch stop.
App.1-11
Appendix 1 Loader Command
1) Command/mode code
Command: 04h, Mode: 03h
2) Format of the data part of request command and response command
None
3) Batch reset command
The table below shows the command part for batch reset.
App.1-12
Appendix 1 Loader Command
1) Command/mode code
Command: 04h, Mode: 04h
2) Format of the data part of request command and response command
None
3) Example of individual start command
The table below shows the command part for individual start (when CPU1 of a multi-CPU system is started):
App.1-13
Appendix 1 Loader Command
1) Command/mode code
Command: 04h, Mode: 05h
2) Format of the data part of request command and response command
None
3) Example of individual initialize and start command
The table below shows the command part for individual initialize and start. (when CPU1 of a multi-CPU system is initialized and
started):
App.1-14
Appendix 1 Loader Command
1) Command/mode code
Command: 04h, Mode: 06h
2) Format of the data part of request command and response command
None
3) Example of individual stop command
The table below shows the command part for individual stop. (when CPU1 of a multi-CPU system is stopped):
App.1-15
Appendix 1 Loader Command
1) Command/mode code
Command: 04h, Mode: 07h
2) Format of the data part of request command and response command
None
3) Example of individual reset command
The table below shows the command part for individual reset. (when CPU1 of a multi-CPU system is reset)
App.1-16
Appendix 2 Mail Function
The following figure shows an example of a system configuration when using the mail function.
Internet service
provider
Ethernet
App.2-1
Appendix 2 Mail Function
Item Specification
Data transfer method Message + attached file (File in user ROM attached as it is)
No. of attached files 0 or 1
File type No restriction (including *.CSV and *.TXT)
Attached file
File format MIME format, Version 1.0
File division transmission Not supported
SMTP
Transmission system SMTP-AUTH (PLAIN/LOGIN/CRAM-MD5 are supported)
*POP Before SMTP is not supported.
<Description of terminology>
SMTP (Simple Mail Transfer Protocol):
This is one of the protocols used to send emails.
SMTP-AUTH (SMTP Authentication):
This is a transmission system where the SMTP server performs authentication by itself and mail sending is allowed only
when the authentication is successful. (User ID and password are required.) Examples of user authentication systems are
PLAIN/LOGIN/CRAM-MD5.
"POP Before SMTP" is another system for mail server authentication, which, however, is not supported by the CPU module.
DNS (Domain Name System):
This is a method of converting a domain name into an IP address.
POP Before SMTP:
This is a method of authenticating a sender using POP authentication before a mail is sent. (User ID is required.)
MIME (Multipurpose Mail Extensions):
This is a method of attaching a file to a mail.
Base64:
This is a replacement method used to send attached binary data as text data in a message.
App.2-2
Appendix 2 Mail Function
<Additional notes>
1) To use SMTP-AUTH, you need to set the SMTP port No., user ID, and password that are notified by the provider or system
administrator.
2) For SMTP authentication, either authentication system of CRAM-MD5, LOGIN or PLAIN is performed according to the one
attached to a response from the SMTP server to an arbitrary command issue.
If multiple authentication systems are received from the SMTP server, authentication is tried in order of CRAM-MD5, LOGIN,
and PLAIN to select a matching system to use.
Contact the provider or system administrator for which authentication system is supported by the SMTP server to be used.
3) The built-in Ethernet has no function of automatically obtaining an IP address. You need to assign a fixed IP address using
a router, for example.
App.2-3
Appendix 2 Mail Function
<Setting procedure>
Open the "Module properties" dialog box of the CPU module, click "Parameter," and then click the "IP-address/Gateway
setting" tab. The following screen opens.
Set the IP address and subnet mask. If necessary, also set the default gateway IP-address.
To specify an SMTP server address as a domain name, set the IP address of the DNS server.
Uncheck "Mail isn't used," and then click the "Mail Setting" button.
App.2-4
Appendix 2 Mail Function
The "Mail setting" dialog box opens. Click the "Base Setting" tab and set the mail address (local station mail address) and
SMTP server address.
App.2-5
Appendix 2 Mail Function
Next, click the "Detail" tab and set the server port number and, if necessary, the user ID and password for SMTP
authentication.
1) Server port number: Set the port No. of the SMTP server. The setting range is from 1 to 65535.
The default value "25" is normally used.
To perform SMTP-AUTH authentication, use the port No. (normally 587) notified by the provider or system administrator.
The set No. is the actual port No. However, the following numbers are not available.
• 20 and 21 (used by FTP)
• Self port standard No. + 251 and self port standard No. + 253 (used for loader command communication)
Since the default of the self port standard No. is 256, the actual port Nos. are as follows:
256 + 251 = 507 and 256 + 253 = 509
2) Use SMTP Auth: Check this checkbox to perform authentication by SMTP-AUTH. In this case, be sure to set the ID and
password, which is described in the next paragraph.
3) User ID, Password: Set the user ID (max. 63 characters) and password (max. 63 characters) for SMTP authentication.
App.2-6
Appendix 2 Mail Function
<Relation between SMTP server and DNS server>
When sending mails (MAIL_SEND FB is activated), the PLC connects to (communicates with) the SMTP server. Specify the
SMTP server name as an IP address or domain name. (IP address setting is preferred.)
1) When the SMTP server is specified as an IP address, the PLC connects to this IP address. (The DNS server setting is
ignored.)
1) When the SMTP server is specified as a domain name (IP address setting of the DNS server is required), the PLC makes
inquiry to the DNS server (in order of “Preferred” and “Alternate”) to obtain an SMTP server IP address that corresponds to
the domain name of the SMTP server.
Inquiry to DNS
about SMTP server IP address
* When the SMTP server is specified as a domain name, the PLC makes inquiry to the DNS preferred server first. If the DNS
preferred server fails to return a response, the PLC makes inquiry to the DNS alternate server after approximately 30 seconds.
If the DNS alternate server also fails to return a response, the MAIL_SEND FB ends abnormally after another approximately
30 seconds (Status: 195, Substatus: 22).
App.2-7
Appendix 2 Mail Function
(1) FB format
FB No. (instance name)
MAIL_SEND_
Data type Data type
MAIL_SEND
SUB_STATUS UDINT
TO:ARRAY[1..N]OF WORD; SEND_TO SEND_TO TO
App.2-8
Appendix 2 Mail Function
(2) Description of FB parameters
Mail send request REQ BOOL IN A mail is sent to the destination at the rising edge of
this signal (0 to 1).
Transmission MODULE_NO UINT IN Specifies the SX bus station No. of the transmission
source module No. source module. When sending a mail from CPU0,
set this terminal to UINT#254.
Size SIZE UDINT IN Specifies the array size of log data (LOG_DATA).
Log data LOG_DATA WORD-type array IN-OUT This is an array for storing logs when sending a mail.
or DINT-type array,
WORD
(Note 6)
Mail send end DONE BOOL OUT Turns ON for one scan when the sending is completed
normally.
Mail send error ERROR BOOL OUT Turns ON for one scan when the sending ends
abnormally.
Error status STATUS INT OUT Outputs an error code.
Substatus SUB_STATUS UDINT OUT Outputs the detail code of the error status.
(This terminal is enabled when the sending ends
abnormally and outputs zero when completed normally.)
Log buffer size LOG_SIZE UDINT OUT Outputs the number of words of output data of the log
buffer.
App.2-9
Appendix 2 Mail Function
Note 4: About the "MESSAGE" terminal
MESSAGE (message) is optional. (However be sure to connect a WORD-type array variable.) In this case, set "0000h"
at the top of the WORD array. It is treated as "no message" and only a line feed code is sent.
If line feed codes are entered in the middle of MESSAGE, they are also sent as data.
Note 5: About the "FILE_NAME" terminal
FILE_NAME (attached file name) is optional. (However be sure to connect a WORD-type array variable.) In this case,
set “0000h” at the top of the WORD array. It is treated as “no attached file.”
Note 6: About the “LOG_DATA” terminal
To store send data as a log, connect an array. When storing logs in a user ROM by using the F_APPEND FB, connect a
DINT-type array. When logs are not necessary, connect a WORD-type variable (array is also connectable) and set “SIZE”
to 0 (zero).
Note 1: Do not activate multiple MAIL_SEND FBs simultaneously. If the program contains multiple MAIL_SEND FBs, activate
the next FB after the operation of the previous FB is completed.
Other FBs including FTP or SNTP are available even when a MAIL_SEND FB is activated.
Note 2: Sending is not completed within one scan. It may take several seconds depending on the size of an attached file or
whether the destination SMTP server is on the same network. It may also take approximately one second for the sending
to end abnormally due to an error in the DNS server or SMTP server.
To monitor time to complete instruction execution by an application, perform an experiment with the actual device to
measure communication time before determining the monitoring time.
Note 3: The MAIL_SEND FB checks completion of an instruction for every instruction execution. When the MAIL_SEND FB is
used in an interruption or periodic task, note that neither the bit for normal end nor bit for abnormal end is not set ON
even after communication ends. Either of the bits is set ON when the next task is executed. It is recommended to use
the MAIL_SEND FB in the default task
Note 4: The number of characters that can be treated in a row and operation when the number of characters in a row exceeds
the limit vary depending on the SMTP server (specifications on the SMTP server side). Therefore, if a long message
without line feed codes is entered in “MESSAGE (message),” the transmission destination may not be able to receive it
correctly. It is recommended to use line feed codes properly.
Note 5: The send date and time displayed on the transmission destination is the time of the PLC internal calendar that is
automatically set for the mail header. Set the PLC internal calendar correctly and adjust the time using the “SMTP server
function,” for example.
App.2-10
Appendix 2 Mail Function
<Example of a log>
The following shows an example of a log file that is written to a user ROM using the F_APPEND FB and opened in a text editor
such as the notepad.
Example)
Send Time:2007/06/05 10:20:30
From:[email protected]
To:[email protected],[email protected]
Subject:Error contents
Message:Nonfatal fault = 100
File:Error100.csv
<Operation of a log>
In SIZE, specify the same number as the log buffer capacity (array size of LOG_DATA).
If SIZE is greater than the log buffer capacity, another memory is rewritten.
If SIZE is smaller than the log buffer capacity and the actual log exceeds SIZE, output to the log is limited to the number of
words specified in SIZE.
If an error occurs while sending a mail to the SMTP server, data sent before the error occurs is outputted to the log. For example,
if an error occurs while sending “destination (To),” data up to “sender (From)” are valid. Data after it are not stored.
In addition, if an error occurs before connecting to the SMTP server (e.g. parameter error), no data is stored in a log. If neither
“Subject (subject),” “mail body (message),” nor “Attached file (File)” is entered, each title and line feed codes are stored.
App.2-11
Appendix 2 Mail Function
(4) Status list
65 File path name error The specified file or folder does not exist. 13
66 File access error An error occurred while a file in the user ROM was being accessed. 18
177 Parameter error A value out of the The number of characters of the destination address 32
specified range was characters exceeds the limit (max. 255 characters).
entered.
The number of characters of the subject characters 33
exceeds the limit (max. 255 characters).
195 SMTP communication Communication with An error occurred on the network during command 20 (Note 1)
error the NTP server was communication.
failed.
Acquisition of the internal work memory was failed. 11 (Note 2)
Data connection was failed. 9 (Note 3)
A timeout occurred. (30 seconds or more have 10
passed.)
SMTP authentication Authentication of the SMTP server was failed. User ID or password is wrong. 60 (Note 4)
error
DNS communication Communication with the DNS server was failed. 22 (Note 5)
error
Attached file size error The size of an attached file exceeds the limit (max. 1MB). 50
System definition error Mail setting is not performed in the system definition. 51 (Note 6)
201 Resource full Acquisition of the internal memory was failed when the FB is executed. 0 (Note 7)
App.2-12
Appendix 2 Mail Function
Note 1: Even if the specified destination address does not exist, the sending may be completed normally depending on the
SMTP server. (specifications on the SMTP server.)
Example 1: A mail with only one destination address was sent. However, the address does not exist actually.
Example 2: A mail with multiple destination addresses was sent. However, one of them does not exist.
Note 2: This error occurs when the internal memory (different from the user memory) shared in the CPU module is insufficient.
This error usually does not occur, however, if it occurs, contact Fuji Electric.
Note 4: "Use SMTP Auth” is selected, however, the SMTP server supports none of the following SMTP-AUTH authentication
methods: PLAIN, LOGIN, or CRAM-MD5, or authentication of the SMTP server is nor required.
Note 5: No response has been returned from the DNS server (preferred/alternate) for 60 seconds.
Note 7: This error occurs 17 or more MAIL_SEND FBs (including FBs related to FTP or SNTP) are simultaneously activated.
App.2-13
Appendix 2 Mail Function
<Variable declaration>
<Program>
<Procedure>
1) Connect the user ROM to your personal computer via a commercially available PC card adapter or card reader/writer.
2) In the "Extras" menu, click "Memory Card Utility," and then click "User ROM." In the "User ROM" screen, click the
"Maintenance" tab. Select the drive where the user ROM is connected for the drive and "FAT" for the file system, and then
format the user ROM.
* Be careful not to format the hard disk of your personal computer by mistake.
3) Select the "Download" tab to download the project.
4) Open the folders in the user ROM in Explorer and create a folder for attached files and a folder for logs as shown below.
(Match the folder names with the program.) Then, put the attached file in the folder for attached files.
App.2-15
Appendix 2 Mail Function
<Registering user ROM card expansion FB in the library>
In this sample program, contents of the logs in the user ROM are stored using the _F_APPEND FB that is one of the User ROM
card expansion FBs. (Since a log is outputted as an ASCII code, there is no need to use an FB related to CSV file writing). To
use this FB, you need to register the user ROM card expansion FB in the library.
<Procedure>
Start the installation CD of D300win, and then select “CSV interface FB setup” to install the library to your personal computer.
Next, start D300win and register “FileCsvInterface” in the library.
<Array declaration>
<Variable declaration>
App.2-16
Appendix 2 Mail Function
<Program>
App.2-17
Appendix 2 Mail Function
Item Condition
Bus tact 1ms
• In-house LAN server
SMTP server
• No SMTP authentication
Subject None (0 character) 255 characters
Message None (0 character) 2047 characters
Attached file None (0 byte)) 1M byte
Measurement value Approx. 0.25s Approx. 65s
App.2-18
Appendix 3 Notes on Module Replacement
The reason is that the Ethernet device (or a hub or router connected in-between) stores the MAC address of the communication
partner (learning function). Since it is held for a certain period of time even after the communication partner stops communication
or does not exist, communication with a different MAC address is failed. This period is referred to as “Aging Time.”
This condition occurs when Ethernet built-in CPU is in passive open mode (Unpassive/Fullpassive) in TCP/IP communication or
communication begins with receiving operation in UDP/IP communication. In these cases, the communication partner performs
sending (or opening) operation first. Therefore, if the CPU module is replaced and the MAC address is changed, communication
is failed.
When Ethernet built-in CPU is in active open mode in TCP/IP communication or communication begins with receiving operation
in UDP/IP communication, the local station performs sending (or opening) operation first to rewrite the MAC address that is
stored in the communication partner. Therefore, communication can be performed.
The above condition where communication is failed is reset after “Aging Time” passes or when the power of the opposite device (or
a hub or router connected in-between) is turned ON and OFF.
<FYI>
The aging time of the Ethernet built-in CPU is one minute (fixed). For information on the aging time of the opposite device,
contact the maker. The aging time of hubs is commonly set to approximately 5 minutes.
App.3-1
Appendix 4 Receive Data Packet Merging Phenomenon
App.4-1
Appendix 5 IP Address Setting
In the case of TCP/IP communication, there are available and unavailable addresses.
The available addresses are as follows:
1.*.*.* to 126.*.*.* (IP address called class A)
However, it is not possible to set all the asterisks to 0 or 255.
For UDP/IP communication, an IP address where all the asterisks are set to 255 is reserved for broadcast.
Addresses other than the above are not available in TCP/IP communication.
<FYI>
224.0.0.0 to 239.255.255.255 (IP called class D)
IP address for IP multicast in UDP/IP communication
App.5-1
Fuji Electric Co., Ltd.
Gate City Ohsaki, East Tower,
11-2, Osaki 1-chome, Shinagawa-ku, Tokyo 141-0032, Japan
E-mail: [email protected]
URL: https://www.fujielectric.com/
Materials covered in this document are subject to revision due to the modification of the product.