EtherNet/IP
EtherNet/IP is Rockwell Automation’s implementation of CIP (Common Industrial Protocol) over standard Ethernet/TCP-IP. It is used by Allen-Bradley/Rockwell PLCs and by other CIP devices that address data through symbolic tag names rather than fixed memory addresses.
This page covers the eip driver, which speaks generic CIP symbolic addressing. The same
Java tag class also backs the logix driver code, registered by the same module - see
Logix for that protocol’s page.
Supported Operations
| Name | Value | Description |
|---|---|---|
|
Go and Java. Reads one or more tags, or a selection of an array tag. |
|
|
Go and Java. Writes one or more tags, or a selection of an array tag. |
|
|
Java only, polling-emulated. EtherNet/IP has no push mechanism here, so a subscription is a periodic read underneath, not a device-initiated notification. |
|
|
Go and Java. Discovers devices on the network. This is the discovery API, not
|
Connection String
The EtherNet/IP connection string has the following format:
eip://{ip-address}:{port}?{options}
tcp is the only supported transport and is the default, so it is omitted from the
connection string. The port defaults to 44818 and normally does not need to be given:
eip://192.168.24.32
Connection String Options
Name |
Type |
Default Value |
Required |
Description |
Name |
EthernetIP |
|||
Code |
|
|||
Maven Dependency |
<dependency> <groupId>org.apache.plc4x</groupId> <artifactId>plc4j-driver-eip</artifactId> <version>1.0.0</version> </dependency> |
|||
Default Transport |
|
|||
Supported Transports |
|
|||
Config options: |
||||
|
BOOLEAN |
true |
Configure if the connection should be set to transport data in Big-Endian format, or not. |
|
|
INT |
0 |
Connection serial number to use in Forward_Open. CIP wants this unique per connection, so the default of 0 means 'pick a random one per connection'. Set it explicitly only when the exchange has to be reproducible, e.g. in recorded tests. |
|
|
BOOLEAN |
false |
Forces the driver to use unconnected requests. |
|
|
INT |
10000 |
Default timeout for all types of requests. |
|
|
STRING |
The communication path allows for connection routing across multiple backplanes. It uses a common format found in Logix controllers. |
||
Transport config options: |
||||
tcp |
||||
|
INT |
5000 |
Connection timeout in milliseconds. |
|
|
INT |
0 |
Socket read timeout in milliseconds. 0 means no timeout. |
|
|
INT |
0 |
Socket write timeout in milliseconds. 0 means no timeout. |
|
|
BOOLEAN |
true |
Enable TCP_NODELAY (disable Nagle’s algorithm). |
|
|
BOOLEAN |
false |
Enable SO_KEEPALIVE. |
|
|
INT |
81920 |
Send buffer size in bytes. 0 uses system default. |
|
|
INT |
81920 |
Receive buffer size in bytes. 0 uses system default. |
|
|
STRING |
Local address to bind to (optional). If not set, uses default. |
||
|
INT |
0 |
Local port to bind to (optional). 0 uses ephemeral port. |
|
Tag Addresses
Addressing is implemented in Go and Java. See the protocol support matrix for what each implementation does.
General Format
To read and write data to a PLC4X device, the EtherNet/IP driver uses symbolic segments. This is used to refer to objects through their symbolic names. This makes reading data a lot easier, as you do not need to specify the Datatype for reading.
{tagname}
{tagname}:{DataType}
{tagname}[{selection}]
{tagname}[{selection}]:{DataType}
| Name | Description |
|---|---|
Tagname |
symbolic name of the data. May optionally be prefixed with |
Selection (optional) |
which elements of an array to read - a single index or an inclusive range. It follows the tag name, before the data type. See Addressing arrays. |
DataType (optional) |
the data type of the value. Defaults to |
The selection comes before the data type, and a range says how many elements are read.
Reading four DINTs starting at index 0 is myArray[0..3]:DINT.
|
A CIP array index travels in a MemberID, whose instance field is a uint 8, so a
selection cannot start past index 255. A range may run beyond it - the request carries a
start and a count - but it cannot begin there.
|
The Java driver’s tag name does not require a leading % - rate:DINT parses in
Java. The Go driver’s address pattern requires the tag name to start with %, so the same
address is rejected there. This page documents the Java syntax; consult the Go driver’s own
source for what it accepts.
|
Data Types
These are the data types the driver can encode and decode:
| To store | Use this data type |
|---|---|
Bit |
BOOL |
8-bit bit string |
BYTE |
16-bit bit string |
WORD |
32-bit bit string |
DWORD |
64-bit bit string |
LWORD |
8-bit integer |
SINT |
16-bit integer |
INT |
32-bit integer |
DINT |
64-bit integer |
LINT |
8-bit unsigned integer |
USINT |
16-bit unsigned integer |
UINT |
32-bit unsigned integer |
UDINT |
64-bit unsigned integer |
ULINT |
32-bit float |
REAL |
64-bit float |
LREAL |
Character string |
STRING |
The unsigned and bit string types cover their full range, so a UDINT or DWORD is returned
in the range 0 to 4294967295 and a ULINT or LWORD in the range 0 to 18446744073709551615. Their
signed counterparts are unchanged: a DINT of 0xFFFFFFFF still reads as -1.
|
Other CIP data types are accepted by the address parser but are not encoded or decoded by the
driver; reading such a tag results in a response code of INTERNAL_ERROR rather than a value.
|
Examples
| Address | Meaning |
|---|---|
|
a single element of |
|
a single element of |
|
four elements of |
|
element 3 of |
|
elements 0 to 3 of |
|
a single element of |