---
title: Use the Status Register to Connect a PLC
slug: bhdo-v2/use-the-status-register-to-connect-a-plc
createdAt: 2023-04-12T14:36:06.000Z
---

The status register option in device configurations allows you to set up a connection with a PLC device that won't successfully connect using the default connection configuration between Belden Horizon Data Operations and the device.&#x20;

# User Scenario

The default configuration for a PLC in your production environment can't connect to Belden Horizon Data Operations. You will therefore use the status register option to create a custom configuration to connect the PLC to Belden Horizon Data Operations.&#x20;

# Set Up and Use the Status Register Option

Complete the following tasks to use the status register option.&#x20;

## Before You Begin

For this user scenario, the Modbus slave simulator is used. To complete these steps, you will need to download the [Modbus slave simulator](https://www.modbustools.com/download.html).

## Step 1: Set up Modbus Simulator

**To set up the Modbus slave simulator:&#x20;**

1. Open Modbus slave simulator.&#x20;
2. Navigate to **Setup&#x20;**> **Slave Definition...**
3. Configure the following parameters.
   **Slave ID**: 1
   **Function**: 03 Holding Register (4x)
   **Address**: 0
   **Quantity**: 10

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/a7JBxIn3Auyh7J5gNPX33_slave-definition.png" size="50" width="402" height="339" caption="Slave Definition dialog box" position="center" showCaption="true"}
4. Click **OK**.&#x20;
5. Navigate to **Connection&#x20;**> **Connect...**
6. Configure the following parameters.
   **Connection**: Modbus TCP/IP
   **IP Address**: Enter the IPv4 address for your computer. If needed, use the `ipconfig` command in the command prompt window and copy the **IPv4 Address**.
   **Port**: 502
   **IPv4**: Select this option.&#x20;

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/vdS2B3mGsNRoHup9jQWqF_connect.png" size="50" width="407" height="422" caption="Connection Setup dialog box" position="center" showCaption="true"}
7. Click **OK**.&#x20;

The simulator successfully connects.&#x20;

## Step 2: Connect Modbus Device in Belden Horizon Data Operations

You can now follow the steps to [Connect a Device](docId:3eyAfPpweuVmBLCEy17sq).&#x20;

Configure the following parameters:&#x20;

**Device Type**: Modbus

**Driver Name**: Modbus TCP

**Name**: Enter a name for the Modbus TCP Ethernet Driver.

**Network Address**: Enter the IP address you configured in the Modbus slave simulator.&#x20;

**Network Port**: 502

**Station ID**: This is the Slave ID configured in the Slave Definition in the Modbus slave simulator. Enter **1**.&#x20;

After adding the device, the device shows a successful connection to the slave simulator.&#x20;



::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/OMi36lMOMXNQav79F8Eo8_image.png" size="50" width="420" height="344" caption="Successful connection to slave simulator" position="center" showCaption="true"}

Now that the device is successfully connected, you can test the status register function.&#x20;

## Step 3: Update Slave Definition Function

To test the status register function, you will need to update the function parameter in the slave definition of the slave simulator. This simulates a PLC device with a default configuration that can't connect to Belden Horizon Data Operations.&#x20;

**To update the slave definition function:**

1. In the Modbus slave simulator, navigate to **Connection&#x20;**> **Disconnect**.&#x20;
2. Navigate to **Setup&#x20;**> **Slave Definition...**
3. Update the **Function&#x20;**&#x74;o **04 Input Register (3x)**.&#x20;
4. Click **OK**.&#x20;
5. Navigate to **Connection&#x20;**> **Connect...** and click **OK**.&#x20;

The Belden Horizon Data Operations device you created should now show a disconnected status due to the change in function from the slave simulator.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/35DbO-a6ptVU5ti7Fjk9P_image.png" size="50" width="419" height="343" caption="Disconnected status for device" position="center" showCaption="true"}

## Step 4: Configure Status Register in Belden Horizon Data Operations

You can now set up the status register option in the device configuration to successfully connect to the slave simulator.&#x20;

**To configure the status register in Belden Horizon Data Operations:**

1. In Belden Horizon Data Operations, click the **Edit&#x20;**&#x69;con for the device.&#x20;

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/3zsxHN39b4XhTMQI10ih3_edit-icon.png" size="50" width="419" height="343" caption="Edit icon" position="center" showCaption="true"}
2. Select the **Status Register** check box.&#x20;

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/N37RTBhvBEwQmkawPZqyG_status-register.png" size="80" width="1182" height="751" position="center" showCaption="false"}
3. Configure the following parameters.&#x20;
   - **Name**: I - Analog Input Registers
   - **Value Type**: int32
4. Click **Update Device**.&#x20;

The device now shows a successful connection again based on the status register configuration.&#x20;

## Step 5: Test Tags

Now that the device is successfully connected using status register, you can now test that tags in the device can be read.&#x20;

You will do the following:

1. Create a tag in Belden Horizon Data Operations.&#x20;
2. Update register values for the connected device in Modbus slave simulator.&#x20;
3. Use [Analytics](docId\:FGJKbOQwGVGgd2nuQgRo5) to read the tag values and confirm the tags are successfully configured.&#x20;

**To test the tags for the device:&#x20;**

1. In Belden Horizon Data Operations, navigate to DeviceHub > Tags.
2. Select the Modbus TCP device.&#x20;

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/_xmFiHBXpDaA5NF0W3lQ8_select-modbus-tcp-devicebhdo.png" size="80" width="1623" height="505" caption="Select Modbus TCP device" position="center" showCaption="true"}
3. Click the **Add Tag** icon and select **Add a Tag**.&#x20;

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/BpGRMnUnCMaJNuugN_D3i_add-tagbhdo.png" size="80" width="1623" height="535" caption="Add Tag icon" position="center" showCaption="true"}
4. Configure the following parameters.&#x20;
   - **Name**: This needs to be the same register as used in the Modbus slave simulator. Select **I - Analog Input Registers**.
   - **Tag Name**: Enter a name for the Modbus TCP Ethernet Driver tag.
   - **Value Type**: int16
   - **Polling Interval**: The interval in seconds that the tag will poll for data. Enter **1**.&#x20;
   - **Address**: The register that the tag will start reading data. Enter **1**.&#x20;
   - **Count**: The number of registers that that the tag will read. Enter **5**.&#x20;
5. Click **Add Tag**.
6. Click the **Copy&#x20;**&#x69;con for the tag's RAW Topic. You will refer to this later.&#x20;

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/FsWSEYSzomZ0gLZLQQvAn_copy-tagbhdo.png" size="80" width="1627" height="505" caption="Copy icon for tag" position="center" showCaption="true"}
7. In Modbus slave simulator, double-click the cell in column 00000 and row 1. This is the cell that the tag you created will start reading from (Address parameter). Enter the value **5** and click **OK**. Do the same for row 2 to 5 and enter the following values: **11**, **22**, **44**, **66**.&#x20;

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/sgRBDU_zJypuAdVT6Zkat_register-tags.png" size="80" width="946" height="483" caption="Modbus slave simulator register tag values" position="center" showCaption="true"}
8. In Belden Horizon Data Operations, navigate to **Analytics**.&#x20;
9. Open th&#x65;**&#x20;Action menu** and select **Add a processor**.&#x20;
   The *Create a Processor* dialog box opens.&#x20;

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/yD8aDoNxiTmdwnbejbR3R_add-processorbhdo.png" size="80" width="1390" height="382" caption="The Add a processor option" position="center" showCaption="true"}
10. Select **DataHub Subscribe**.&#x20;
11. In the **Topic&#x20;**&#x66;ield, paste the tag's RAW topic that you copied earlier from step 6.&#x20;
12. Click **Save**.&#x20;
13. Click the **View&#x20;**&#x69;con for the processor.&#x20;

    ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/UKfkGsIReqsuMNOhYasjq_view-iconbhdo.png" size="80" width="1390" height="439" caption="The View icon" position="center" showCaption="true"}
14. Under Instance Messages, verify that success displays **true&#x20;**&#x61;nd *value&#x20;*&#x64;isplays the five values you configured in the Modbus slave simulator (**5**,**11**,**22**,**44**,**66**).&#x20;

    ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/ZUIE8dKFLL6UYPd8J7uFo_tag-messagesbhdo.png" size="80" width="1390" height="675" caption="Instance messages for tag" position="center" showCaption="true"}

