# Modbus Server/Slave IO mapping

**URL:** https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541
**Category:** General
**Tags:** modbus
**Created:** [20 February 2025 21:19 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541 "2025-02-20T21:19:17Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![jper25](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jper25](https://discourse.nodered.org/u/jper25)
#### Post date: [20 February 2025 21:19 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/1 "2025-02-20T21:19:17Z")

</div>

Hello,  
How would I turn my application into a slave? I can do everything but update discrete inputs on my server so an external Client/Master can read them. I know there is an IO config node for the reading/getter nodes but not for the sever itself just like a slave on a PLC.

thank you!

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [20 February 2025 22:07 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/2 "2025-02-20T22:07:26Z")

</div>

Welcome to the forum @jper25

node-red-contrib-modbus has a modbus server node.

---

<div class="post-metadata">

### Author: ![jper25](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jper25](https://discourse.nodered.org/u/jper25)
#### Post date: [20 February 2025 22:10 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/3 "2025-02-20T22:10:01Z")

</div>

I understand, I am using that library. Both the flex and regular server nodes have no way(that I can see) to IO map addresses to variables.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [21 February 2025 07:31 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/4 "2025-02-21T07:31:03Z")

</div>

I don't understand what you mean by mapping to variables. I haven't used it, but my memory is that you can send it messages in the flow to set registers to required values, is that what you mean? If not then give an example of exactly what you want to do.

---

<div class="post-metadata">

### Author: ![jper25](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jper25](https://discourse.nodered.org/u/jper25)
#### Post date: [21 February 2025 12:43 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/5 "2025-02-21T12:43:51Z")

</div>

Its related to this [Writing to Flex Server Buffers with Message · Issue #149 · BiancoRoyal/node-red-contrib-modbus · GitHub](https://github.com/BiancoRoyal/node-red-contrib-modbus/issues/149)  
Which was implemented. I think its just writing directly to the server node's input with the "special" payload. I'm curious though, what is the difference between the flex server and the standard? Am I able to call the flex server's functions(getCoil/getDiscrete/getHolding/getInput/setCoil/setRegister) at any time? if so, how?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [21 February 2025 14:10 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/6 "2025-02-21T14:10:11Z")

</div>

I think I may have misunderstood your requirement. I don't think the server nodes are designed to make node-red into a PLC emulator, but are for testing flows using modbus read and write by providing a server simulator within node-red, which can be accessed from the node-red modbus read and write nodes.

---

<div class="post-metadata">

### Author: ![jper25](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jper25](https://discourse.nodered.org/u/jper25)
#### Post date: [21 February 2025 14:18 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/7 "2025-02-21T14:18:35Z")

</div>

Well not really. The example "Modbus Slave" does exactly what I'm looking for. It uses the server node and creates a flow that acts like a modbus slave. No different that some off-the-self device. All modbus slave devices allow the user to configure the IO(switches, actuators) to internal variables; much like modbus slave firmware modifies memory in a microcontroller. Else, what is the point of having read-only registers space(discrete inputs and input registers) if we cant actually set them to anything. Again, this was solved by allowing the node-red user to inject the server with special payloads. Thanks again.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [21 February 2025 14:28 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/8 "2025-02-21T14:28:09Z")

</div>

So is your problem solved?

---

<div class="post-metadata">

### Author: ![jper25](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jper25](https://discourse.nodered.org/u/jper25)
#### Post date: [21 February 2025 14:30 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/9 "2025-02-21T14:30:43Z")

</div>

Yes, I marked my post with the link to the github issue from 2019 as solved.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [7 March 2025 14:31 UTC](https://discourse.nodered.org/t/modbus-server-slave-io-mapping/95541/10 "2025-03-07T14:31:19Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
