8-19
8 Message Communications
CJ-series EtherNet/IP Units Operation Manual for NJ-series CPU Unit (W495)
8-2 Using
CIP Messa
g
e Co
mm
un
icati
ons
8
8
-2
-7 Sample Prog
ra
mming f
o
r CIP Connection
(C
lass
3) Messa
ge Comm
unications
This sample uses CIP class 3 messages to write a variable, read a variable, and send a message. The
Controllers are connected to an EtherNet/IP network. The IP address of the remote node is
192.168.250.2. The following procedure is used.
1
The CIPOpen instruction is used to open a class 3 connection. The timeout time is 2 s.
2
The CIPWrite instruction is used to write the value of a variable at a remote node. The variable
name at the remote node is WritingDat and the contents of the WriteDat is written to it. Writing-
Dat must be defined as a global variable at the remote node and the Network Publish attribute
must be set.
3
The CIPRead instruction is used to read the value of a variable at a remote node. The value of
the variable OriginalDat at the other node is read and the read value is stored in the ReadDat
variable. OriginalDat must be defined as a global variable at the remote node and the Network
Publish attribute must be set.
4
The CIPSend instruction is used to send an explicit message to a remote node. The contents of
the message is to read identity information (product name). The class ID, instance ID, attribute
ID, and service code are as follows: The response data is stored in the RespDat variable.
5
The CIPClose instruction is used to close the class 3 connection.
8-2-7
Sample Programming for CIP Connection (Class 3) Message
Communications
Item
Value
Class ID
1
Instance ID
1
Attribute ID
7
Service code
16#0E
EtherNet/IP Unit
IP address: 192.168.250.2
Message sent to read identity
information (product name).
Response
RespDat
Value of variable read.
ReadDat
Variable name: OriginalDat
Global variable
Network Publish attribute
Value of variable written.
WriteDat
Variable name: WritingDat
Global variable
Network Publish attribute
Unit number: 0
Unit number: 1
EtherNet/IP Unit
Содержание SYSMAC CJ1W-EIP21
Страница 8: ...Manual Structure 6 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 10: ...Sections in this Manual 8 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 20: ...Read and Understand this Manual 18 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 42: ...Revision History 40 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 68: ...1 Introduction 1 26 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 80: ...2 Installing Ethernet Networks 2 12 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 130: ...6 Testing Communications 6 4 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 206: ...7 Tag Data Link Functions 7 76 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 246: ...8 Message Communications 8 40 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 266: ...9 FTP Server 9 20 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 374: ...13 Troubleshooting 13 56 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 431: ...Index 1 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495 I Index...
Страница 436: ...Index 6 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495 Index...
Страница 437: ......