Jump to content

Modbus TCP Client configuration example: Difference between revisions

no edit summary
No edit summary
No edit summary
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:
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.
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.


[[File:ModbusTcpMasterSchemeTopology.png|frame|center|Topology]]
[[File:ModbusTcpMasterSchemeTopology.png|border|class=tlt-border|center|Topology]]


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


=Configure Modbus TCP 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:
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:ExampleModSlave1Edit.png|border|class=tlt-border|center|Slave Device WAN configuration]]


[[File:Picture2.png|frame|center|Slave Device Wan Configuration Pop menu]]
[[File:ExampleModSlave2Edit.png|border|class=tlt-border|center|Slave Device WAN config]]


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:
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]]
[[File:ExampleModSlave3Edit.png|border|class=tlt-border|center|Slave Device Modbus Config|alt=]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 65: Line 65:


==Adding a new slave 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.
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]]
[[File:ExampleModSlave4Edit.png|border|class=tlt-border|center|Master device Modbus Slave devices menu.]]


Once you have clicked that button, enter the following configuration so we can add the slave 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]]
[[File:ExampleModSlave5Edit.png|border|class=tlt-border|center|Master devies Add Slave Config]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 119: Line 119:
Scroll down and click “Save and Apply”
Scroll down and click “Save and Apply”


[[File:Picture6.png|frame|center|Save and Apply]]
[[File:Picture6.png|border|class=tlt-border|center|Save and Apply]]


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


[[File:Picture7.png|frame|center|Modbus Slave Configuration on Master Device]]
[[File:ExampleModSlave7Edit.png|border|class=tlt-border|center|Master Device Modbus Slave menu]]
 
==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.First, click the edit button:  
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]]
[[File:ExampleModSlave7Edit.png|border|class=tlt-border|center|Master Device Modbus Slave menu]]


Scroll down to the “Request configuration” section.  
Scroll down to the “Request configuration” section.  


[[File:Picture9.png|frame|center|Request Configuration]]
[[File:ExampleModSlave9Edit.png|border|class=tlt-border|center|Request Configuration]]


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


[[File:Picture10.png|frame|center|Add new request]]
[[File:ExampleModSlave10Edit.png|border|class=tlt-border|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:  
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]]
[[File:ExampleModSlave11Edit.png|border|class=tlt-border|center|Configuring new request]]


<table class="nd-mantable">
<table class="nd-mantable">
Line 206: Line 205:
</table>
</table>


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.
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 an output.


[[File:Picture12.png|frame|center|Testing Configuration]]
[[File:ExampleModSlave12Edit.png|border|class=tlt-border|center|Testing request.]]


==Alarms==
==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.  
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]]
[[File:ExampleModSlave13Edit.png|border|class=tlt-border|center|Add new alarm.]]


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


[[File:Picture14.png|frame|center|Alarm Configuration Menu]]
[[File:ExampleModSlave14Edit.png|border|class=tlt-border|center|Alarm configuration.]]


<table class="nd-mantable">
<table class="nd-mantable">