> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/2-4-2/guides/machine-connectivity/plcs-industrial-controllers/connecting-an-allen-bradley-controllogix-plc.md).

# Connecting an Allen-Bradley ControlLogix PLC

This guide shows you how to read tags from a Rockwell Automation Allen-Bradley ControlLogix PLC with the Connectware [EtherNet/IP connector](/2-4-2/connectors/shop-floor-connectors/ethernet-ip.md) and map them into an ISA-95 style MQTT topic hierarchy. The connector addresses the named tags of the Logix controller directly, so the same approach works for ControlLogix and CompactLogix controllers. The data collected here (machine state, part counter, temperature, and cycle time) is the typical input for machine monitoring and OEE dashboards. In more detail, the following topics are covered:

* Understanding how the EtherNet/IP connector addresses Logix tags
* Distinguishing controller-scoped and program-scoped tags
* Preparing the controller and the network
* Creating the [service commissioning file](/2-4-2/data-flows/service-commissioning-files.md)
* Mapping the tags into an ISA-95 style MQTT topic hierarchy
* Verifying data in the [Data Explorer](/2-4-2/monitoring/data-explorer.md)

This guide focuses on reading data from the controller. For write operations and the request/response read pattern, see the [EtherNet/IP connector reference](/2-4-2/connectors/shop-floor-connectors/ethernet-ip.md).

A complete example file is available at the end of this guide.

## Prerequisites

To follow this guide, you will need the following:

* A running instance of Cybus Connectware.
* An Allen-Bradley ControlLogix or CompactLogix controller that is reachable over Ethernet from Connectware. The connector communicates through the EtherNet/IP port of the controller using Common Industrial Protocol (CIP) explicit messaging on TCP port 44818, so this port must be open on any firewall between Connectware and the controller.
* The names of the tags you want to read, for example from the tag database of the Studio 5000 Logix Designer project.
* Access to the [Admin UI](/2-4-2/access/admin-ui.md) with sufficient [user permissions](/2-4-2/access/user-management.md).
* Basic knowledge of MQTT and the Connectware [services](/2-4-2/data-flows/services.md) concept (for example, [service commissioning files](/2-4-2/data-flows/service-commissioning-files.md), [connections](/2-4-2/data-flows/service-commissioning-files/resources/cybus-connection.md), and [endpoints](/2-4-2/data-flows/service-commissioning-files/resources/cybus-endpoint.md)).

## How the EtherNet/IP Connector Addresses Logix Tags

Unlike Modbus/TCP or S7, where you assemble register or memory addresses yourself, Logix controllers expose their data as named tags. An endpoint of the EtherNet/IP connector addresses a tag by its name, exactly as it appears in the controller project:

* **Atomic tags** are addressed by their plain name, for example `MachineState`. The supported atomic data types are `BOOL`, `SINT`, `INT`, `DINT`, and `REAL`.
* **Array elements** are addressed with an index, for example `RecipeSetpoints[0]`.
* **Single bits** of an integer tag are addressed with the bit number, for example `StatusWord.0`.

Every tag in a Logix project has a scope, and the scope decides how the endpoint addresses it:

* **Controller-scoped tags** are global to the controller. Set only the `tagName` property.
* **Program-scoped tags** are local to one program, and different programs can contain tags with the same name. Set the `programName` property in addition to `tagName`. Alternatively, the `tagName` property accepts the fully qualified form `Program:<program name>.<tag name>`, for example `Program:Palletizing.CycleTime`. Both notations address the same tag; this guide uses `programName` because it keeps the tag name identical to the controller project.

For details on tag scopes and external data access, see the [Logix 5000 Controllers Data Access Programming Manual](https://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm020_-en-p.pdf).

## Preparing the Controller and the Network

Reading tags over CIP explicit messaging is a native function of every Logix controller, so no PLC-side program change and no additional communication instruction is needed. Check the following points before you connect:

* **External access of the tags:** every tag in Studio 5000 Logix Designer has an **External Access** attribute (**Read/Write**, **Read Only**, or **None**). Connectware can only read tags whose external access is **Read/Write** or **Read Only**. Tags set to **None** are invisible to external devices.
* **Slot of the controller:** in a ControlLogix chassis, the connection enters through the EtherNet/IP communication module and is routed across the backplane to the controller. The `slot` connection property holds the chassis slot number of the controller, which is slot 0 in many installations but can be any slot. For CompactLogix controllers with a built-in EtherNet/IP port, keep the default slot 0.
* **Network reachability:** TCP port 44818 must be reachable from Connectware, as described in the prerequisites.

## Choosing the Tags

This guide reads a small set of tags that cover the most common machine monitoring needs. The tag names are examples; replace them with the names from your controller project.

| Tag               | Scope                   | Data type | Content                                 |
| ----------------- | ----------------------- | --------- | --------------------------------------- |
| `MachineState`    | Controller              | `DINT`    | State code of the machine               |
| `GoodPartsCount`  | Controller              | `DINT`    | Count of parts produced without defects |
| `ZoneTemperature` | Controller              | `REAL`    | Temperature of the sealing zone in °C   |
| `CycleTime`       | Program (`Palletizing`) | `REAL`    | Duration of the last cycle in seconds   |

Subscriptions of the EtherNet/IP connector are change-based: the connection scans all subscribed tags in a fixed interval, the `scanRate`, and Connectware publishes a value only when it has changed. The scan rate is a property of the connection and applies to all its endpoints. The default is 200 ms; this guide uses 500 ms, which is fast enough for machine monitoring and reduces the load on the controller. For all endpoint properties, see [EtherNet/IP Endpoint Properties](/2-4-2/connectors/shop-floor-connectors/ethernet-ip/ethernetipendpoint.md).

## Writing the Service Commissioning File

The service commissioning file contains all connection and mapping details. Do not worry about copying the snippets together into one file, the complete example file is available at the end of this guide.

### Description and Metadata

These sections contain general information about the service commissioning file. Only the metadata name is required.

{% code lineNumbers="true" %}

```yaml
description: >
  Service commissioning file that reads tags from an Allen-Bradley
  ControlLogix PLC over EtherNet/IP and maps them into an ISA-95 style
  MQTT topic hierarchy (Example)

metadata:
  name: Allen-Bradley ControlLogix Example
  provider: cybus
  homepage: https://www.cybus.io
  version: 1.0.0
```

{% endcode %}

### Parameters and Definitions

We define the network address and the chassis slot of the controller as parameters, so you can set them when you install the service.

The MQTT topics in this guide follow an ISA-95 style equipment hierarchy (`<enterprise>/<site>/<area>/<line>/<work-cell>`). We define the prefix once in the `definitions` section and reuse it in every mapping with `!sub`.

{% code lineNumbers="true" %}

```yaml
parameters:
  controllogixHost:
    description: Hostname or IP address of the EtherNet/IP port of the controller
    type: string
    default: 192.168.1.100

  controllogixSlot:
    description: Chassis slot number of the controller (0 for CompactLogix)
    type: integer
    default: 0

definitions:
  MQTT_TOPIC_PREFIX: enterprise/hamburg/packaging/line-1/palletizer-01
```

{% endcode %}

### Cybus::Connection

The connection resource establishes the EtherNet/IP connection to the controller. The `slot` property routes the connection to the controller in the chassis, and the `scanRate` property sets the interval for scanning the subscribed tags for changes. The `connectionStrategy` object controls how Connectware retries failed connection attempts with increasing delays. For all connection properties, see [EtherNet/IP Connection Properties](/2-4-2/connectors/shop-floor-connectors/ethernet-ip/ethernetipconnection.md).

{% code lineNumbers="true" %}

```yaml
resources:
  controllogixConnection:
    type: Cybus::Connection
    properties:
      protocol: EthernetIp
      targetState: connected
      connection:
        host: !ref controllogixHost
        slot: !ref controllogixSlot
        scanRate: 500
        connectionStrategy:
          initialDelay: 1000
          maxDelay: 30000
          incrementFactor: 2
```

{% endcode %}

### Cybus::Endpoint

Each endpoint subscribes to one tag. The controller-scoped tags only need the `tagName` property:

{% code lineNumbers="true" %}

```yaml
machineState:
  type: Cybus::Endpoint
  properties:
    protocol: EthernetIp
    connection: !ref controllogixConnection
    subscribe:
      tagName: MachineState

goodPartsCount:
  type: Cybus::Endpoint
  properties:
    protocol: EthernetIp
    connection: !ref controllogixConnection
    subscribe:
      tagName: GoodPartsCount

zoneTemperature:
  type: Cybus::Endpoint
  properties:
    protocol: EthernetIp
    connection: !ref controllogixConnection
    subscribe:
      tagName: ZoneTemperature
```

{% endcode %}

The `CycleTime` tag is local to the `Palletizing` program, so the endpoint sets `programName` in addition to `tagName`:

{% code lineNumbers="true" %}

```yaml
cycleTime:
  type: Cybus::Endpoint
  properties:
    protocol: EthernetIp
    connection: !ref controllogixConnection
    subscribe:
      tagName: CycleTime
      programName: Palletizing
```

{% endcode %}

### Cybus::Mapping

The mapping publishes each endpoint on a topic of the ISA-95 hierarchy.

{% code lineNumbers="true" %}

```yaml
mapping:
  type: Cybus::Mapping
  properties:
    mappings:
      - subscribe:
          endpoint: !ref machineState
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/machine/state'
      - subscribe:
          endpoint: !ref goodPartsCount
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/counters/good-parts'
      - subscribe:
          endpoint: !ref zoneTemperature
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/temperature/sealing-zone'
      - subscribe:
          endpoint: !ref cycleTime
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/cycle-time'
```

{% endcode %}

With this mapping, the machine state is published on the topic `enterprise/hamburg/packaging/line-1/palletizer-01/machine/state`, and every other tag follows the same pattern.

## Installing the Service Commissioning File

1. Install the service commissioning file. See [Installing Services](/2-4-2/data-flows/services/managing/installing.md).
2. Enable the service. See [Enabling Services](/2-4-2/data-flows/services/managing/enabling.md).

**Result:** The service is enabled. Connectware establishes the EtherNet/IP connection to the controller and starts scanning the subscribed tags.

## Verifying the Data

Open the [Data Explorer](/2-4-2/monitoring/data-explorer.md) and subscribe to `enterprise/hamburg/packaging/line-1/palletizer-01/#`. Each topic carries a JSON object with the keys `timestamp`, `value`, and `oldValue`, where `value` is the current tag value and `oldValue` is the value of the previous scan:

{% code lineNumbers="true" %}

```json
{
  "timestamp": 1784194200354,
  "oldValue": 1487,
  "value": 1488
}
```

{% endcode %}

Because the subscription is change-based, a message only arrives when a tag value changes. A constant tag stays silent after the initial value.

A few plausibility checks for the first readings:

* The state code on the `machine/state` topic matches the state shown on the HMI of the machine.
* The counter on the `counters/good-parts` topic only increases while the machine produces.
* The temperature on the `temperature/sealing-zone` topic is in a plausible range and changes slowly.

If the connection does not reach the **Connected** state, verify that TCP port 44818 is reachable from Connectware and that the `slot` property matches the chassis slot of the controller. If the connection is established but an endpoint delivers no data, check that the tag name and program name exactly match the controller project and that the **External Access** attribute of the tag is not set to **None**.

## Service Commissioning File Example

{% file src="/files/7k7a5hLTFeZX4H8MzehY" %}

{% code title="allen-bradley-controllogix-example.yml" lineNumbers="true" expandable="true" %}

```yaml
---
# ----------------------------------------------------------------------------
# Service Commissioning File
# ----------------------------------------------------------------------------
# Copyright: Cybus GmbH
# Contact: support@cybus.io
# ----------------------------------------------------------------------------
# Connecting an Allen-Bradley ControlLogix PLC (Example)
# ----------------------------------------------------------------------------

description: >
  Service commissioning file that reads tags from an Allen-Bradley
  ControlLogix PLC over EtherNet/IP and maps them into an ISA-95 style
  MQTT topic hierarchy (Example)

metadata:
  name: Allen-Bradley ControlLogix Example
  provider: cybus
  homepage: https://www.cybus.io
  version: 1.0.0

parameters:
  controllogixHost:
    description: Hostname or IP address of the EtherNet/IP port of the controller
    type: string
    default: 192.168.1.100

  controllogixSlot:
    description: Chassis slot number of the controller (0 for CompactLogix)
    type: integer
    default: 0

definitions:
  # ISA-95 style topic prefix: <enterprise>/<site>/<area>/<line>/<work-cell>
  MQTT_TOPIC_PREFIX: enterprise/hamburg/packaging/line-1/palletizer-01

resources:
  # Connection to the controller over EtherNet/IP (CIP explicit messaging,
  # TCP port 44818). The slot property routes the connection to the
  # controller in the chassis.
  controllogixConnection:
    type: Cybus::Connection
    properties:
      protocol: EthernetIp
      targetState: connected
      connection:
        host: !ref controllogixHost
        slot: !ref controllogixSlot
        # Scan the subscribed tags for changes every 500 ms. Connectware
        # publishes a value only when it has changed.
        scanRate: 500
        connectionStrategy:
          initialDelay: 1000
          maxDelay: 30000
          incrementFactor: 2

  # Controller-scoped tags: no programName, the tag name alone is enough.
  # MachineState is a DINT holding the state code of the machine.
  machineState:
    type: Cybus::Endpoint
    properties:
      protocol: EthernetIp
      connection: !ref controllogixConnection
      subscribe:
        tagName: MachineState

  # GoodPartsCount is a DINT counting the parts produced without defects.
  goodPartsCount:
    type: Cybus::Endpoint
    properties:
      protocol: EthernetIp
      connection: !ref controllogixConnection
      subscribe:
        tagName: GoodPartsCount

  # ZoneTemperature is a REAL holding the temperature of the sealing zone.
  zoneTemperature:
    type: Cybus::Endpoint
    properties:
      protocol: EthernetIp
      connection: !ref controllogixConnection
      subscribe:
        tagName: ZoneTemperature

  # Program-scoped tag: CycleTime is a REAL that is local to the program
  # "Palletizing", so the endpoint sets programName in addition to tagName.
  cycleTime:
    type: Cybus::Endpoint
    properties:
      protocol: EthernetIp
      connection: !ref controllogixConnection
      subscribe:
        tagName: CycleTime
        programName: Palletizing

  mapping:
    type: Cybus::Mapping
    properties:
      mappings:
        - subscribe:
            endpoint: !ref machineState
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/machine/state'
        - subscribe:
            endpoint: !ref goodPartsCount
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/counters/good-parts'
        - subscribe:
            endpoint: !ref zoneTemperature
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/temperature/sealing-zone'
        - subscribe:
            endpoint: !ref cycleTime
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/cycle-time'
```

{% endcode %}

{% hint style="info" %}
Disclaimer: Allen-Bradley, ControlLogix, CompactLogix, and Studio 5000 are trademarks of Rockwell Automation, Inc. EtherNet/IP is a trademark of ODVA, Inc.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cybus.io/2-4-2/guides/machine-connectivity/plcs-industrial-controllers/connecting-an-allen-bradley-controllogix-plc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
