Defining MODBUS slaves

Foreword

The main characteristic of a MODBUS slave is its identifier, which is used to address the requests to the desired device. That is the reason why it is the first parameter to define when adding a MODBUS slave in a ModbusPal project.

But it is not sufficient. A MODBUS slave exchanges information with the MODBUS master. This information is organized in registers and coils. Then, once the slave is created with an identifier, its content must be defined.

This section covers the basics of creating a MODBUS slave in ModbusPal.

The MODBUS Slaves panel

View of the empty MODBUS Slaves panel.

Adding new slaves

Click on the Add button in the MODBUS Slaves panel in order to add new MODBUS slaves.

A dialog appears. Select the MODBUS slave address of each new MODBUS slave to create. Multiple addresses can be selected from the list by holding the SHIFT key and/or the CTRL keys.

View of the AddSlaveDialog

The name of the new MODBUS slave(s) can also be edited before actually creating them. ModbusPal doesn't care if several MODBUS slaves have the same name. Specifying a name can help to explicit the role of the new slave in the project.

Finally, click on the Add from the dialog in order to validate. The MODBUS slave(s) is(are) inserted into the list of the MODBUS Slaves panel.

When added to the list, a MODBUS slave looks like this: View of a MODBUS slave

Notes

  1. Only the Modbus addresses that are not assigned yet are shown in the list.
  2. Modbus slaves created simultaneously will all have the same name. This is not an issue because they all have different Modbus addresses.
  3. The name of the Modbus slaves can be modified afterward.

Enabling/Disabling a MODBUS slave

While the project is running, it can be useful to disable MODBUS slaves for testing purpose. Once a slave has been disabled, any incoming request addressed to that slave will end up in a MODBUS exception response.

A MODBUS slave is disabled by toggling the Enable/Disable button of the MODBUS salve button.

Configuring the MODBUS slave

A freshly created MODBUS slave contains no data. Registers, coils and so on can be defined in the slave’s configuration dialog, which becomes visible when the Button that shows or hide the slave's configuration dialog button is toggled.

The instructions for configuring the MODBUS slave can be found in this page.

Cloning a MODBUS slave

After spending a lot of time configuring one MODBUS slave, new MODBUS slaves can be created on the same model simply by clicking on the The Clone button of the MODBUS slave button.

A dialog appears, very similar to the Add dialog described above. One or multiple slaves can be created; each of them will be an exact copy of the original slave.

Removing a slave

Click on the Delete button of the MODBUS Slave button of one MODBUS slave in MODBUS Slaves panel to remove it from the current project.