This application is software emulator of Modbus network. It emulate several slave devices connected by virtual network. This network connected to the physical Modbus network.
Adapter USB RS485 required for connection QSlave with physical network.
- Get sources from repository
$ mkdir qslave
$ cd qslave
$ git clone https://github.com/maisvendoo/qslave.git qslave
- Make build directory
$ mkdir build
$ cd build
- Generate Makefile
$ qmake ../qslave
- Run make
$ make
Download last release from release page. Run qslave-vX.Y.Z-setup.exe and folow installation instructions.
You need several configuration files in XML format for setup network configuration. You can see example configuration in directory cfg/example. The list of virtual slaves is in file exmaple.net
<?xml version="1.0" encoding="UTF-8" ?>
<Config>
<Slave>
<!-- Slave description -->
<Description>Traffic light</Description>
<!-- Slave ID -->
<id>1</id>
<!-- Slave config file (without *.xml extension) -->
<config>traffic-light</config>
</Slave>
</Config>
Earch slave has own config file. You can see file traffic-light.xml for example of slave configuration
<?xml version="1.0" encoding="UTF-8" ?>
<Config>
<!-- Coils list -->
<Coil>
<address>16</address>
<description>Red signal</description>
<value>0</value>
</Coil>
<Coil>
<address>17</address>
<description>Yellow signal</description>
<value>0</value>
</Coil>
<Coil>
<address>18</address>
<description>Green signal</description>
<value>0</value>
</Coil>
<!-- Discrete inputs list -->
<DiscreteInput>
<address>0</address>
<description>Ready</description>
<value>1</value>
</DiscreteInput>
<!-- Holding registers list -->
<HoldingRegister>
<address>5</address>
<description>Signal activity time</description>
<value>15</value>
</HoldingRegister>
<!-- Input registers list -->
<InputRegister>
<address>2</address>
<description>Signals count</description>
<value>3</value>
</InputRegister>
</Config>
- Run QSlave
- Load network configuration from *.net file (File -> Open config)
- Select device in device list. You can see all device data structures in application Windows
- Plugin USB RS485 adapter to you PC USB port. Adapter must connected to physical Modbus RTU network.
- Select connection parameters (port name, baudrate, etc.) and press connect button
- You can change all values in tables of device memory (Coils, Holding registers, Discrete inputs and Input registers). You also can see changes in coils and holding registers, when master device send data to virtual device.