# Modbus: association between slaves & master

**URL:** <https://www.wago.community/t/modbus-association-between-slaves-master/2502>\
**Category:** CODESYS\
**Tags:** how-to, codesys, pfc300\
**Created:** [January 14, 2026, 4:03pm UTC](https://www.wago.community/t/modbus-association-between-slaves-master/2502 "2026-01-14T16:03:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WagoUser44](https://avatars.discourse-cdn.com/v4/letter/w/7ba0ec/32.png) [@WagoUser44](https://www.wago.community/u/WagoUser44)\
**Post date:** [January 14, 2026, 4:03pm UTC](https://www.wago.community/t/modbus-association-between-slaves-master/2502/1 "2026-01-14T16:03:46Z")

</div>

Hello,

How can I associate multiple slaves to one master?

```pascal
mySerialMaster : FbMbMasterSerial := 

( xConnect := TRUE,
udiBaudrate := 9600,
usiDataBits := 8,
eParity := WagoTypesCom.eTTYParity.Even,
eStopBits := WagoTypesCom.eTTYStopBits.One,
eHandshake := WagoTypesCom.eTTYHandshake.None,
ePhysical := WagoTypesCom.eTTYPhysicalLayer.RS485_HalfDuplex,
eFrameType := eMbFrameType.RTU,
tTimeOut := T#2000MS
);

utQuery : typMbQuery := 

( bUnitId := 1, // Slave address e43
bFunctionCode := 16#04, // read input registers
uiReadAddress := 50514, // Start address
uiReadQuantity := 10, // Quantity of wanted registers
uiWriteAddress := 0, // not needed for FC4
uiWriteQuantity := 0, // not needed for FC4
awWriteData := [124(0)] // not needed for FC4
);

utQuery2 : typMbQuery := 

( bUnitId := 10, // Slave address e33
bFunctionCode := 16#04, // read input registers
uiReadAddress := 50514, // Start address
uiReadQuantity := 10, // Quantity of wanted registers
uiWriteAddress := 0, // not needed for FC4
uiWriteQuantity := 0, // not needed for FC4
awWriteData := [124(0)] // not needed for FC4
);

utQuery3 : typMbQuery := 

( bUnitId := 21, // Slave address e34
bFunctionCode := 16#04, // read input registers
uiReadAddress := 50514, // Start address
uiReadQuantity := 10, // Quantity of wanted registers
uiWriteAddress := 0, // not needed for FC4
uiWriteQuantity := 0, // not needed for FC4
awWriteData := [124(0)] // not needed for FC4
);

xTxTrigger : BOOL; (* Set this variable once to start a job.
                                       This variable will be automatically reset by the master
                                       when the job is completed.
                                    *)

utResponse : typMbResponse; (* After the job is completed, you can find the result
                                       in this structure.
                                    *)

tonDelay : TON := (PT := T#20MS); // This is the silence time between two requests

```

```pascal
//— delay between two requests ----------------------
tonDelay( IN := (NOT tonDelay.Q) AND (NOT xTxTrigger));
//xTxTrigger S= tonDelay.Q; // trigger the next request

//— call cyclic the master --------------
mySerialMaster( I_Port := myserialport, // my serial port
utQuery := utQuery,
xTrigger := xTxTrigger,
utResponse := utResponse
);

```

I would like to associate the 3 slaves: **utQuery, utQuery2, utQuery3** with the master **mySerialMaster**

**Thank you for your help**

---

<div class="post-metadata">

**Author:** ![Thruser](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@Thruser](https://www.wago.community/u/Thruser)\
**Post date:** [January 14, 2026, 10:48pm UTC](https://www.wago.community/t/modbus-association-between-slaves-master/2502/2 "2026-01-14T22:48:45Z")

</div>

Hi,

see here:

> [@ModbusTCP - während Laufzeit Server (Slave) hinzufügen & auslesen/schreiben](https://www.wago.community/t/modbustcp-wahrend-laufzeit-server-slave-hinzufugen-auslesen-schreiben/2470):
>
> Hallo in die Runde, Ich versuche derzeit mit Codesys 3.5 SP21 Patch 3 eine Belimo Energy Valve über Modbus TCP mit der WagoAppPlcModbus Library in der Version 1.1.5.13 einzubinden.Das wäre ein Auszug aus der Modbus Interface Beschreibung von besagter Pumpe: No distinction is made between data types (Discrete Inputs, Coils, Input Registers and Holding Registers). As a consequence, all data can be accessed with the two commands for Holding Register All values in the register are unsigned int…

It’s for Modbus TCP, but it’s similar with RTU.

---

<div class="post-metadata">

**Author:** ![xxyzz](https://avatars.discourse-cdn.com/v4/letter/x/d9b06d/32.png) [@xxyzz](https://www.wago.community/u/xxyzz)\
**Post date:** [January 15, 2026, 6:00am UTC](https://www.wago.community/t/modbus-association-between-slaves-master/2502/3 "2026-01-15T06:00:26Z")

</div>

Hi,  
I used Digital Twins for that purpose. [Here](https://www.wago.community/t/modbus-rtu-ecockpit-pfc100-750-8100-750-652/1530/6) is an example.

I tested it the RS-485 on a CC100 as well and it worked.

Cheers xxyzz
