日本語 English

Variable Access with CIP Explicit Messages

Variable read/write services

CIP explicit messaging is the message communication method used in EtherNet/IP.
On OMRON NJ/NX series controllers, PLC variables can be accessed with Read Tag Service (0x4C) and Write Tag Service (0x4D). This page explains the request and response formats.

Read Tag Service (0x4C)

Request
NameByte countData
Common Industrial Protocol
Service Code10x4c
Request Path
Length15 (word)
ANSI Extended
Symbol Segment
100x9107+"testInt"+0x00
(padded with 0 for an odd number of bytes)
CIP Class Generic
Request Service Data
Num of Element20x0100 (number of array elements)
Set ListService, RegisterSession, SendRRData or UnRegisterSession in the Command of the encapsulation header and send
Response
NameByte countData
Common Industrial Protocol
Service10xcc (MSB ON + 0x4c)
(Fixed)10x00 (fixed value)
Status
General Status10x00
Additional Status10x00
CIP Class Generic
Responce Service Data
Data Type10xc3
AddInfoLength10x00 (0x02 for a structure)
(AddInfo)(2)A CRC code is included only for structures
Data20x3412
(size depends on the variable type)

Write Tag Service (0x4D)

Request
NameByte countData
Common Industrial Protocol
Service Code10x4d
Request Path
Length15 (word)
ANSI Extended
Symbol Segment
100x9107+"testInt"+0x00
(padded with 0 for an odd number of bytes)
CIP Class Generic
Request Service Data
Data Type10xc3
AddInfo Length10x00 (0x02 for a structure)
(AddInfo)(2)CRC value for structures only
Num of Element20x0100
Write Data20x3412
(change the size according to the variable type)

Response

Response
NameByte countData
Common Industrial Protocol
Service10xcd (MSB ON + 0x4d)
Fixed 10x00 (fixed value)
Status
General Status10x00
Additional Status10x00

Request Path

The Request Path is the field that specifies the name of the variable to access.
On OMRON NJ/NX, the tag name is specified with an ANSI Extended Symbol Segment (0x91).
If the variable name has an odd number of bytes, 0x00 is appended to align to an even byte boundary.

RequestPath
NameDataDescription
Segment Type 0x91
(0b10010001)
Data Segment (0b100) +
ANSI Ectended Symbol Sengment (0b10001)
Segment Sub Type
Length7Number of bytes in the variable name
Variable name"testInt"Encoding is UTF-8
(pad)(0x00)Add 0x00 if the variable name has an odd number of bytes

CIP object services

How to specify CIP objects

CIP objects for the NJ/NX built-in EtherNet/IP port

Request path

Request path details

Status meanings

Status
General StatusDescriptionAdditional StatusDescription
0x00SUCCESSNormal end
0x02RESOURCE_UNAVAILABLEThe internal processing buffer is currently unavailable
0x04PATH_SEGMENT_ERRORThe Request Path specification is incorrect
0x05PATH_DESTINATION_UNKNOWNThe variable destination is specified incorrectly
0x0cOBJECT_STATE_CONFLICT0x8010Downloading or starting up
0x8011Tag memory error
0x11REPLY_DATA_TOO_LARGEThe response exceeds the maximum response length
0x13NOT_ENOUGH_DATAThe data length for the specified service is insufficient
0x15TOO_MUCH_DATAThe data length for the specified service is too large
0x1FVENDOR_SPECIFIC_ERROR0x0102 0x2104The read target is a variable I/O that cannot be read
0x0104 0x1103An address or size beyond the segment area was specified
0x8001Internal error
0x8007A variable that cannot be accessed was specified
0x8029An area that cannot be accessed in bulk with SimpleDataSegment was specified
0x8031Internal error (memory allocation error)
0x20INVALID_PARAMETER0x8009Segment type error
0x800FInconsistent data length information in the request data
0x8017More than one element requested for single data
0x8018Zero elements, or data beyond the range, requested for array data
0x8021A value other than 0 or 2 was specified in the AddInfo area
0x8022The Data Type of the Request Service Data does not match the type of the TAG information
The AddInfo Length of the Request Service Data is not 0
0x8023Internal error (invalid command format)
0x8024Internal error (invalid command length)
0x8025Internal error (invalid parameter)
0x8027Internal error (parameter error)
0x8028A value outside the range was written to a variable with a subrange specification
An undefined value was written to an Enum variable

Data type meanings

Data Type represents the data type of the variable.
By looking at the Data Type returned in the response, you can determine the type of the variable on the PLC.

DataType
DataTypeVariableTypeSize
0xc1BOOLBit
0xc2SINT1byte
0xc3INT2byte
0xc4DINT4byte
0xc5LINT8byte
0xc6USINT1byte
0xc7UINT2byte
0xc8UDINT4byte
0xc9ULINT8byte
0xcaREAL4byte
0xcbLREAL8byte
0xd0STRING
0xd1BYTE1byte
0xd2WORD2byte
0xd3DWORD4byte
0xd4LWORD8byte
0xdbTIME8byte
0xa0Abbreviated STRUCT
0xa2STRUCT
0xa3ARRAY

Related pages

Comments