Table of Contents

Modbus (Built-in)

This document describes the built-in Modbus driver available in x4Trace and explains how Modbus-based devices can be integrated into the system.


Overview

x4Trace includes a built-in Modbus driver located in the following assembly: x4Trace.Server.Drivers.dll

The Modbus driver enables communication with PLCs and other industrial devices that support the Modbus protocol.

This implementation can also be used as a foundation for developing custom Modbus-based drivers.


Integration Options

When integrating Modbus devices with x4Trace, you have two main options.


Option 1: Use the Built-in Modbus Driver

Using the built-in Modbus driver is the simplest integration method.

In this case, you must:

  • Create the required variables in the PLC or device
  • Modify the device or PLC program as needed
  • Configure memory addresses in x4Trace to match the Modbus registers

x4Trace will communicate with the device using the predefined Modbus driver logic.

This approach is recommended when:

  • Standard Modbus communication is sufficient
  • Minimal custom development is required
  • Configuration-based integration is preferred

Option 2: Develop a Custom Modbus Driver

If the built-in driver does not meet your requirements, you can develop a custom Modbus driver.

You can:

  • Reuse x4Trace’s Modbus communication layer
  • Use all existing classes and algorithms
  • Extend or modify behavior for your specific device or line

To deploy a custom driver:

  1. Build your driver project
  2. Copy the resulting DLL into the Driver directory of the x4Trace Server

Open-Source Implementation

The Modbus driver and its client implementation are open source.

  • The driver uses a ModbusClient
  • Both the driver and the client code can be modified
  • This allows full control over Modbus communication behavior

The open-source nature of the driver makes it suitable as a reference implementation for other Modbus-based integrations.


Development Environment

To develop or extend Modbus drivers:

  1. Open the following solution: x4Trace.Server.UserPlugins.sln
  2. Modify or create a Modbus-based driver
  3. Build and deploy the driver to the x4Trace Server

Summary

x4Trace provides a flexible Modbus integration strategy:

  • A built-in Modbus driver for fast integration
  • An open-source implementation for customization
  • A clear path for developing custom drivers

This enables integration with a wide range of Modbus-compatible PLCs and devices.