> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/rt-lab/configure-ios/communication-protocol-ios/modbus-slave.md).

# Modbus Slave

## Introduction to Modbus

Modbus is an open industrial communication protocol widely used in automation, metering, and SCADA systems. It defines how a master (client) exchanges data with field devices (slaves/servers) through simple read/write operations. Modbus supports both serial links (RTU/ASCII) and Ethernet networks (Modbus TCP), providing a lightweight and broadly compatible interface for monitoring and control applications.

## Protocol characteristics

* **Master/Slave architecture**\
  A master (Modbus RTU/ASCII) or client (Modbus TCP) initiates all communication. Slave/server devices expose data through standardized memory tables, and only respond to requests—never initiate them.
* **Devices organize information into four logical tables**\
  **Coils** are read/write single‑bit outputs; **discrete inputs:** Read‑only single‑bit values; **holding registers** are read/write 16‑bit registers; and **input registers** are read‑only 16‑bit registers
* **Function codes**\
  Requests specify an operation using standardized function codes, such as reading coils/registers or writing values. Devices may also implement diagnostic or vendor‑specific functions.
* **Multiple transport layers supported**\
  **RTU:** Binary framing over RS‑232/RS‑485 with CRC; **ASCII:** Text‑based framing with LRC; and **TCP:** Encapsulated in TCP/IP, using an MBAP header instead of a CRC.
* **Reliability & latency considerations**\
  RTU/ASCII rely on timing gaps and checksums; TCP ensures delivery and ordering. Modbus does not guarantee latency but provides predictable request/response behavior suitable for real‑time monitoring.
* **Security model (protocol‑agnostic)**\
  Modbus includes no built‑in encryption or authentication. Deployments rely on external protections such as secure networks, VPNs, or firewalls.

## How the protocol works

* **Addressing & configuration**\
  Each slave/server is identified by an address (RTU) or unit ID (TCP). The master must know the device’s register maps and scaling factors.
* **Request/response cycle**\
  The **master sends a request** with a function code, address, and quantity. The **slave processes the request** using its internal data tables. Then the **slave returns a response** with the data or a status code.
* **Data encoding**\
  Modbus uses single bits and 16‑bit registers. Larger types (32‑bit integers, floats) span multiple registers, and byte order depends on device conventions.

## Example applications

* **SCADA & Metering**\
  Reading measurements such as voltage, current, power, temperature, breaker status, and energy counters.
* **Industrial Automation**\
  Monitoring and controlling PLCs, drives, and distributed I/O modules.
* **Laboratory & HIL Systems**\
  Exchanging real‑time signals between simulated and physical devices.
* **Building Automation**\
  Integrating HVAC controllers, sensors, meters, and BMS equipment.
* **Inter‑device Integration**\
  Serving as a simple interface for connecting equipment from different vendors and systems.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/rt-lab/configure-ios/communication-protocol-ios/modbus-slave.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
