> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/modbus/xl4-plus-to-xl4-plus-modbus.md).

# Link two XL4 Plus RTUs over Modbus

One XL4 Plus as a Modbus TCP master and another as a slave, to exchange I/O between them.

Two XL4 Plus RTUs can exchange I/O over Modbus TCP: one is the Modbus master (client) and the other the slave (server). Set up each one as in [Set up as a Modbus master](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/modbus/modbus-master.md) and [Set up as a Modbus slave](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/modbus/modbus-slave.md), with the settings below.

{% hint style="info" %}
**Applies to:** two XL4 Plus RTUs, firmware v7.x, both with Modbus licensed.
{% endhint %}

## Master RTU

1. Set up the Ethernet port. In this example it uses a fixed IP address.
2. Add the slave RTU as a Modbus slave (Ethernet), with read and write actions. For example:
   * Reading the state of digital outputs (coils) 1-8
   * Writing the state of digital outputs (coils) 9-16
   * Reading digital inputs 1-8
   * Reading analogue inputs 1-6
   * Reading analogue outputs 1-10
3. Load a DLP with at least the `telout` command, so DATRAN's values don't overwrite the real outputs the slave's values go into. You may want both `telinp` and `telout`.

## Slave RTU

1. Turn on the Modbus slave and set the **data offset**. At least offset past the RTU's own I/O: 8 DI, 8 DO, 6 AI and 2 AO.
2. Right-click **General Purpose I/O** and select **Add IO Block**, to allocate the points the master reads and writes.

## How the points map

| Master (XL4 Plus)    | Command                                                | Slave (XL4 Plus)          |
| -------------------- | ------------------------------------------------------ | ------------------------- |
| Real analogue output | Write Multiple Registers (0x10), Write Register (0x06) | Telemetry analogue output |
| Real analogue output | Read Holding Register (0x03)                           | Telemetry analogue output |
| Real digital output  | Write Multiple Coils (0x0F)                            | Telemetry digital output  |
| Real digital output  | Read Coils (0x01)                                      | Telemetry digital output  |
| Real analogue input  | Read Input Register (0x04)                             | Telemetry analogue input  |
| Real digital input   | Read Discrete Input (0x02)                             | Telemetry digital input   |
