Changes

no edit summary
Line 9: Line 9:  
For this example we will be using script to store data into regfile from which then you can read data via Modbus.
 
For this example we will be using script to store data into regfile from which then you can read data via Modbus.
 
To achieve follow this steps:
 
To achieve follow this steps:
[[File:Modbus custom reg1.png|border|class=tlt-border|1100x700px]]
   
<ol>
 
<ol>
<li><b>Enable</b> router to be as <b>Modbus TCP slave</b> (<b>Services -> Modbus -> Modbus TCP Slave</b>);</li>
+
<li><b>Enable</b> router to be as <b>Modbus TCP Server</b> (<b>Services -> Modbus -> Modbus TCP Server</b>);</li>
<li><b>Enable Custom Register Block</b> in the webUI (<b>Services -> Modbus -> Modbus TCP Slave</b>);
+
<li><b>Enable Custom Register Block</b> in the webUI (<b>Services -> Modbus -> Modbus TCP Server</b>);
 
<li>Register file path: <b>tmp/regfile</b> (this is where new register will be stored);</li>
 
<li>Register file path: <b>tmp/regfile</b> (this is where new register will be stored);</li>
 
<li>First register number: <b>1025</b> (by default it is 1025 and recommend to keep it, if necessary it could be changed accordantly);</li>
 
<li>First register number: <b>1025</b> (by default it is 1025 and recommend to keep it, if necessary it could be changed accordantly);</li>
 
<li>Register count: <b>32</b> (how much "space" there is given for additional Modbus registers, the more register you want to bigger count should be used).</li>
 
<li>Register count: <b>32</b> (how much "space" there is given for additional Modbus registers, the more register you want to bigger count should be used).</li>
 
<li>Save & Apply</li>
 
<li>Save & Apply</li>
 +
</ol>
 +
[[File:RutOS_Modbus_custom_regsiter_block_7.8_1.png|border|class=tlt-border|1100x700px]]
   −
</ol>
      
==Creating Custom Modbus Registers==
 
==Creating Custom Modbus Registers==
Line 68: Line 68:  
  0000025
 
  0000025
   −
==Reading Created Custom Modbus Registers with Modbus TCP Master==
+
==Reading Created Custom Modbus Registers with Modbus TCP Client==
    
To read data via Modbus you can use:
 
To read data via Modbus you can use:
 
<ul>
 
<ul>
 
<li>ComTestPro program;</li>
 
<li>ComTestPro program;</li>
<li>Modbus TCP Master;</li>
+
<li>Modbus TCP Client;</li>
 
<li>QModMaster;</li>
 
<li>QModMaster;</li>
 
</ul>
 
</ul>
==Modbus TCP Master configuration==
+
==Modbus TCP Client configuration==
[[File:Modbus custom reg2.png|border|class=tlt-border|1100x700px]]
+
* Add a new Client device by going to your router's '''WebUI → Services → Modbus → Modbus TCP Client''':
* Add a new slave device
+
[[File:RutOS_Modbus_custom_regsiter_block_7.8_2.png|border|class=tlt-border|1100px]]
 
+
----
[[File:Modbus custom reg3.png|border|class=tlt-border|1100x700px]]
+
# Enable
* Enable
+
# Type '''name'''
* Type '''name'''
+
# Write '''Server ID''' (1)
* Write '''Slave ID''' (1)
+
# And your '''Server's''' (Router's) '''IP'''
* And your '''Slave's''' (Router's) '''IP'''
+
# Provide the '''port''' via which the communication is done
* Write '''request name''' and add it
+
[[File:RutOS_Modbus_custom_regsiter_block_7.8_3.png|border|class=tlt-border]]
 
+
----
[[File:Modbus custom reg4.png|border|class=tlt-border|1100x700px]]
+
Then scroll down to the Requests Configuration section and add a new request:
* Select '''Data type''' (ASCII)
+
# Provide the name for the request
* Select '''function''' (Read holding registers)
+
# Click on the '''Add''' button
* Type '''first register number''' (1025)
+
[[File:RutOS_Modbus_custom_regsiter_block_7.8_4.png|border|class=tlt-border|1100px]]
* Type '''register count''' (15 in this scenario)
+
----
* Enable this request
+
# Select '''Data type''' (ASCII)
* With Modbus TCP master you can read data just by using ASCII data type and interactive test button.  
+
# Select '''function''' (Read holding registers (3))
 +
# Type '''first register number''' (1025)
 +
# Type '''register count''' (15 in this scenario)
 +
# '''Enable''' this request
 +
# With Modbus TCP Client you can read data just by using ASCII data type and interactive test button.  
 +
[[File:RutOS_Modbus_custom_regsiter_block_7.8_5.png|border|class=tlt-border|1100x700px]]
 +
----
      Line 105: Line 111:  
<li>Protocol: Modbus TCP;</li>
 
<li>Protocol: Modbus TCP;</li>
 
<li>IP Address: 192.168.1.1 (or 192.168.2.1 for TRB1 series) (router's LAN or WAN IP);</li>
 
<li>IP Address: 192.168.1.1 (or 192.168.2.1 for TRB1 series) (router's LAN or WAN IP);</li>
<li>Port: 502 (port number on which Modbus TCP Slave is listening);</li>
+
<li>Port: 502 (port number on which Modbus TCP Server is listening);</li>
 
<li>Device: 1</li>
 
<li>Device: 1</li>
 
<li>Register: 1025;</li>
 
<li>Register: 1025;</li>

Navigation menu