You are on page 1of 2

3 .

I n s tr u c t i o n S et

API Mnemonic Operands Function Controllers


Ethernet ES2/EX2 SS2 SA2 SX2
113 ETHRW SE
communication

Type Bit Devices Word devices Program Steps


OP X Y M S K H KnX KnY KnM KnS T C D E F ETHRW: 9 steps
S1 *
S2 * * *
D *
n * * *
PULSE 16-bit 32-bit
SA2
ES2/EX2 SS2 SA2 SX2 ES2/EX2 SS2 SX2 ES2/EX2 SS2 SA2 SX2
SE
Operands:
S1: IP address, communication port number, and read/write mode S2: Device address D:
Source/Destination data register n: Data length (Unit: Word; Range: K1~K96)

Explanations:
1. S1: IP address, communication port number, and read/write mode
The operand S1 occupies five consecutive data registers. The functions are as follows.
IP address: Two data registers are occupied, that is, S1+0 and S1+1.
IP address IP3.IP2.IP1.IP0 192.168.0.2

If S1 is D100, the values in D100 and D101 are H’0002 and H’C0A8 respectively.
D100 (S1+0) D101 (S1+1)
High Low High Low
IP1 IP0 IP3 IP2
0 2 192 168
H’0002 H’C0A8
S1+2: Communication port number
The communication port number of the Ethernet port on DVP-SE and that of the
communication card installed in DVP-EH3 are K108. The communication ports on the
left-side Ethernet modules connected to a CPU module are numbered according to their
distances from the CPU module. The numbers start from K100 to K107.
S1+3: Station address of a slave
S1+4: Read/Write mode
The definition is the same as Modbus. The function codes supported are H’03, H’04, H’06,
and H’10.
2. S2: Device address
The definition is the same as Modbus.
3. The operand D specifies a source data register or a destination data register.
4. n: Length of data (Unit: word)
The setting range is K1~K96. If n exceeds the range, it will be taken as the maximum value or
the minimum value.

3-299
D V P - E S 2 / EX 2 / S S 2 / S A2 / S X 2/ S E &T P O p e r a ti on M a nu a l - P r o g r am m i n g

5. Whenever the instruction is executed, the communication command is sent. Users do not need
to enable a special flag to send the communication command.
6. The instruction can be used several times. However, if an ETHRW instruction specifies a
module, other ETHRW instructions can not send communication commands to the module. The
next communication command can not be sent until the reception is complete or the module
replies that an error occurs.
7. If a communication command is being received, the reception stops when the execution of the
instruction stops. Besides, the flag related to the command’s having being received and the
error flag are not ON.
8. The communication timeout is stored in D1349. The default timeout is 3000 milliseconds. The
range of digital values is 1~32767. If the communication timeout exceeds the range, it will be
taken as 3000 milliseconds.
9. The values of bit0~bit8 in D1395 indicate which communication port has received a command.
For example, if the communication port built in DVP-SE has received a command, “BLD
D1395 K8” is satisfied.
10. The values of bit0~bit8 in D1396 indicate which module For example, if a reception error
occur in the first left-side DVP-EN01, “BLD D1396 K0” is satisfied.
11. When the instruction is executed, user can not use the online editing function. Otherwise, the
data received will not be stored correctly.
12. The instruction supports SA2 version 2.40, SX2 version 2.20, SE version 1.00, and above.
Program Example:
(The command is sent and received through the Ethernet port built in DVP-SE.)
The IP address stored in D100 and D101 is 192.168.0.2, the communication port number stored in
D102 is K108, the station address stored in D103 is K1, and the function code stored in D104 is
H’03. The device address is H’1000, and two pieces of data are read. When M0 is ON, ETHRW is
executed. After the reception of the communication command is complete, bit8 in D1394 is ON. The
data received is stored in D10 and D11.

M1002
MOV H0002 D100

MOV HC0A8 D101

MOV K108 D102

MOV K1 D103

MOV K3 D104
M0
ETHRW D100 H1000 D10 K2

BLD D1394 K8 MOV D10 D20

3-300

You might also like