Modbus TCP Client configuration example: Difference between revisions
(Configuring a Modbus Master to get data from a slave device with RutOS.) |
m (Typo) |
||
Line 35: | Line 35: | ||
==Testing== | ==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. | 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: | ||
First, click the edit button: | |||
[[File:Picture8.png|frame|center|Modbus Slaves]] | [[File:Picture8.png|frame|center|Modbus Slaves]] |
Revision as of 18:45, 4 April 2022
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:
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:
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.
Once you have clicked that button, enter the following configuration so we can add the slave device:
Scroll down and click “Save and Apply”
After this, this is how your main Modbus Master panel should look:
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:
Scroll down to the “Request configuration” section.
Write a name for the request and click the “Add” button.
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:
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.
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.
After clicking the “Add” button the next menu should come up: