Changes

Configuring a Modbus Master to get data from a slave device with RutOS.
=Summary=
Modbus TCP Master section is used for configuring your router as a master device and other routers configured in this section as slave devices. A Modbus TCP master device can then request data from these Modbus TCP slaves.

First, let’s configure our second router which will be acting as a slave device.

=Configure Modbus TCP slave device=
In this example, we would be configuring our slave device to have a 192.168.1.2 internal IP address. This can be done by changing the IP address parameter on Network->WAN page:

[[File:Picture1.png|frame|center|Slave Device Wan Configuration ]]

[[File:Picture2.png|frame|center|Slave Device Wan Configuration Pop menu]]

Now we need to enable Modbus service for this slave device as we will open a specific port for letting through TCP communications (it is also possible to 'Allow remote access' if we wish to access this router from external WAN using its public IP). This is done on Services->Modbus page:

[[File:Picture3.png|frame|center|Modbus Slave Configuration]]

=Configuring Modbus TCP master device=

==Adding a new slave device==
On the master device (in this example master device has 192.168.1.1 internal IP address) open Services->Modbus->Modbus TCP Master. To add a new slave, first, click the add button.

[[File:Picture4.png|frame|center|Modbus Slave configuration on Master device]]

Once you have clicked that button, enter the following configuration so we can add the slave device:

[[File:Picture5.png|frame|center|Modbus Slave Configuration on Master Device Pop Menu]]

Scroll down and click “Save and Apply”

[[File:Picture6.png|frame|center|Save and Apply]]

After this, this is how your main Modbus Master panel should look:

[[File:Picture7.png|frame|center|Modbus Slave Configuration on Master Device]]

==Testing==
For testing, if the functionality is working we can configure a request. A Modbus request is a way of obtaining data from Modbus slaves. The master sends a request to a slave specifying the function code to be performed. The slave then sends the requested data back to the Modbus master. You can create a maximum of 64 request configurations for each slave device.
First, click the edit button:

[[File:Picture8.png|frame|center|Modbus Slaves]]

Scroll down to the “Request configuration” section.

[[File:Picture9.png|frame|center|Request Configuration]]

Write a name for the request and click the “Add” button.

[[File:Picture10.png|frame|center|Add new request]]

And enter a data type, a function, first register, number of registers, if you need brackets or don’t and enable the request. In this case we are trying to get System uptime information so configure the next options:

[[File:Picture11.png|frame|center|Configuring Request]]

Under the “Request Configuration” section there will be another section called “Request Configuration Testing” this is where you can test that the parameters that you set work properly. Just select the request that you want to test and click the test button and you should get and output.

[[File:Picture12.png|frame|center|Testing Configuration]]

==Alarms==
Alarms are a way of setting up automated actions when some Modbus values meet user-specified conditions. To configure these alarms, scroll to the end of the menu and click the “Add” button.

[[File:Picture13.png|frame|center|Alarm Configuration]]

After clicking the “Add” button the next menu should come up:

[[File:Picture14.png|frame|center|Alarm Configuration Menu]]

Navigation menu