Recommended ModulesLink Products
Use diagslave to simulate field devices when testing these industrial communication modules
RS-485 Transceiver
- Up to 5000VDC isolation
- ESD protection ±8kV
- 256 nodes on bus
- -40°C to +105°C
CAN Transceiver
- Up to 5000VDC isolation
- CAN 2.0A/2.0B protocol
- ESD ±8kV, Surge ±4kV
- -40°C to +105°C
Digital Isolators
- Up to 5000VDC isolation
- CMTI >100kV/µs
- Data rate 150Mbps
- -40°C to +125°C
File Size
195 KB (ZIP)
Platform
Windows / Linux
Protocols
Modbus RTU + TCP
Type
CLI (Command Line)
Overview
diagslave is a command-line Modbus slave simulator that responds to Modbus master requests without requiring any physical hardware. It is the companion tool to modpoll - while modpoll acts as a master, diagslave acts as a slave, enabling you to create complete test loops on a single computer.
This tool is invaluable during PLC programming, gateway commissioning, and SCADA system development. Instead of connecting to real field devices (which may not be available during development), diagslave provides a virtual Modbus slave that responds to all standard function codes.
Key Features
🌐 TCP Slave Mode
Simulate a Modbus TCP slave device on any port. Multiple instances can run on different ports simultaneously.
⚙ RTU Slave Mode
Simulate a Modbus RTU serial slave device. Supports virtual COM port pairs for local testing.
📦 Ultra Lightweight
Under 200KB. No installation or dependencies. Instant startup - ideal for rapid testing cycles.
💻 Configurable Data
Set register values via command-line arguments. Slave responds with the configured data to any master request.
Quick Start
Start a Modbus TCP Slave
Start a Modbus RTU Slave
Creating a Test Loop
The most powerful use case is running diagslave + modpoll together on the same machine to create a complete Modbus test loop:
Common Command-Line Options
| Flag | Description | Example |
|---|---|---|
-m | Protocol: tcp or rtu | -m tcp |
-p | TCP port (TCP) or parity (RTU) | -p 502 |
-b | Baud rate (RTU only) | -b 9600 |
-a | Slave address (1-247) | -a 1 |
Compatible with ModulesLink Products
Use diagslave to simulate field devices when testing ModulesLink Modbus gateways during development. Configure the slave with the same register map as your target sensors and meters to validate gateway configuration before connecting to real hardware.