Modbus TCP Client configuration example: Difference between revisions
Modbus TCP Client configuration example (view source)
Revision as of 02:51, 6 April 2022
, 6 April 2022no edit summary
m (Typo) |
No edit summary |
||
Line 1: | Line 1: | ||
=Summary= | =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. | 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]] | |||
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. | ||
Line 14: | Line 16: | ||
[[File:Picture3.png|frame|center|Modbus Slave Configuration]] | [[File:Picture3.png|frame|center|Modbus Slave Configuration]] | ||
<table class="nd-mantable"> | |||
<tr> | |||
<th>Field</th> | |||
<th>Value</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>Enable</td> | |||
<td>off | on; default <b>off</b></td> | |||
<td>Turns Modbus TCP on or off.</td> | |||
</tr> | |||
<tr> | |||
<td>Port</td> | |||
<td>integer [0..65535]; default: <b>502</b></td> | |||
<td>TCP port used for Modbus communications.</td> | |||
</tr> | |||
<tr> | |||
<td>Device ID</td> | |||
<td>integer [0..255]; default: <b>1<b/></td> | |||
<td>The device's Modbus slave ID. When set to 0, it will respond to requests addressed to any ID.</td> | |||
</tr> | |||
<tr> | |||
<td>Allow Remote Access</td> | |||
<td>off | on; default: <b>off</b></td> | |||
<td>Allows remote Modbus connections by adding an exception to the device's firewall on the port specified in the field above.</td> | |||
</tr> | |||
<tr> | |||
<td>Keep persistent connection</td> | |||
<td>off | on; default: <b>off</b></td> | |||
<td>Allows keep the connection open after responding a Modbus TCP master request.</td> | |||
</tr> | |||
<tr> | |||
<td>Connection timeout</td> | |||
<td>integer; default: <b>0</b></td> | |||
<td>Sets TCP timeout in seconds after which the connection is forcefully closed.</td> | |||
</tr> | |||
<tr> | |||
<td>Enable custom register block</td> | |||
<td>off | on; default: <b>off</b></td> | |||
<td>Allows the usage of custom register block.</td> | |||
</tr> | |||
</table> | |||
=Configuring Modbus TCP master device= | =Configuring Modbus TCP master device= | ||
Line 25: | Line 72: | ||
[[File:Picture5.png|frame|center|Modbus Slave Configuration on Master Device Pop Menu]] | [[File:Picture5.png|frame|center|Modbus Slave Configuration on Master Device Pop Menu]] | ||
<table class="nd-mantable"> | |||
<tr> | |||
<th>Field</th> | |||
<th>Value</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>Enable</td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Slave device's name, used for easier management purposes.</td> | |||
</tr> | |||
<tr> | |||
<td>Name</td> | |||
<td>off | on; default: <b>off</b></td> | |||
<td>Turns communication with the slave device on or off.</td> | |||
</tr> | |||
<tr> | |||
<td>Slave ID</td> | |||
<td>integer [0..255]; default: <b>none</b></td> | |||
<td>Slave ID. Each slave in a network is assigned a unique identifier ranging from 1 to 255. When the master requests data from a slave, the first byte it sends is the Slave ID. When set to 0, the slave will respond to requests addressed to any ID.</td> | |||
</tr> | |||
<tr> | |||
<td>IP address</td> | |||
<td>ip; default: <b>none</b></td> | |||
<td>Slave device's IP address.</td> | |||
</tr> | |||
<tr> | |||
<td>Port</td> | |||
<td>integer [0..65535]; default: <b>none</b></td> | |||
<td>Slave device's Modbus TCP port.</td> | |||
</tr> | |||
<tr> | |||
<td>Period</td> | |||
<td>integer [1..86400]; default: <b>60</b></td> | |||
<td>Interval at which requests are sent to the slave device.</td> | |||
</tr> | |||
<tr> | |||
<td>Timeout</td> | |||
<td>integer [1..30]; default: <b>5</b></td> | |||
<td>Maximum response wait time.</td> | |||
</tr> | |||
</table> | |||
Scroll down and click “Save and Apply” | Scroll down and click “Save and Apply” | ||
Line 50: | Line 141: | ||
[[File:Picture11.png|frame|center|Configuring Request]] | [[File:Picture11.png|frame|center|Configuring Request]] | ||
<table class="nd-mantable"> | |||
<tr> | |||
<th>Field</th> | |||
<th>Value</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>Name</td> | |||
<td>string; default: <b>Unnamed Parameter</b></td> | |||
<td>Request name. Used for easier management purposes.</td> | |||
</tr> | |||
<tr> | |||
<td>Data type</td> | |||
<td>8bit INT | 8bit UINT | 16bit INT, high byte first | 16bit INT, low byte first | 16bit UINT, high byte first | 16bit UINT, low byte first | 32bit float, Byte order 1,2,3,4 | 32bit float, Byte order 4,3,2,1 | 32bit float, Byte order 2,1,4,3 | 32bit float, Byte order 3,4,1,2; default: <b>16bit INT, high byte first</b></td> | |||
<td>How read data will be stored.</td> | |||
</tr> | |||
<tr> | |||
<td>Function</td> | |||
<td>1 | 2 | 3 | 4 | 5 | 6 | 15 | 16; default: <b>3</b></td> | |||
<td>A function code specifies the type of register being addressed by a Modbus request. The codes represent these functions:<br> | |||
<ul> | |||
<li><b>1</b> - read Coil Status</li> | |||
<li><b>2</b> - read Input Status</li> | |||
<li><b>3</b> - read Holding Registers</li> | |||
<li><b>4</b> - read Input Registers</li> | |||
<li><b>5</b> - force Single Coil</li> | |||
<li><b>6</b> - preset Single Register</li> | |||
<li><b>15</b> - force Multiple Coils</li> | |||
<li><b>16</b> - force Multiple Registers</li> | |||
</ul> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>First Register</td> | |||
<td>integer [0..65535]; default: <b>1</b></td> | |||
<td>First Modbus register from which data will be read.</td> | |||
</tr> | |||
<tr> | |||
<td>Number of Registers</td> | |||
<td>integer [1..2000]; default: <b>none</b></td> | |||
<td>Number of Modbus registers that will be read during the request.</td> | |||
</tr> | |||
<tr> | |||
<td>Enabled</td> | |||
<td>yes | no; default: <b>no</b></td> | |||
<td>Turns the request on or off.</td> | |||
</tr> | |||
<tr> | |||
<td>Test</td> | |||
<td>- (interactive button)</td> | |||
<td>Generates a Modbus request according to given parameters in order to test the request configuration. You must first save the configuration before you can use the Test button.</td> | |||
</tr> | |||
<tr> | |||
<td>Delete</td> | |||
<td>- (interactive button)</td> | |||
<td>Deletes the request.</td> | |||
</tr> | |||
<tr> | |||
<td>Add</td> | |||
<td>- (interactive button)</td> | |||
<td>Adds a new request configuration.</td> | |||
</tr> | |||
</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 and output. | ||
Line 63: | Line 218: | ||
[[File:Picture14.png|frame|center|Alarm Configuration Menu]] | [[File:Picture14.png|frame|center|Alarm Configuration Menu]] | ||
<table class="nd-mantable"> | |||
<tr> | |||
<th>Field</th> | |||
<th>Value</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>Enabled</td> | |||
<td>yes | no; default: <b>no</b></td> | |||
<td>Turns the alarm on or off</td> | |||
</tr> | |||
<tr> | |||
<td>Function code</td> | |||
<td>Read Coil Status (1) | Read Input Status (2) | Read Holding Registers (3) | Read Input Registers (4); default: <b>Read Coil Status (1)</b></td> | |||
<td>Modbus function used in Modbus request.</td> | |||
</tr> | |||
<tr> | |||
<td>Register</td> | |||
<td>integer [0..65535]; default: <b>none</b></td> | |||
<td>Number of the Modbus coil/input/holding register/input register that will be read.</td> | |||
</tr> | |||
<tr> | |||
<td>Condition</td> | |||
<td>More than | Less than | Equal to | Not Equal to; default: <b>Equal to</b></td> | |||
<td>When a value is obtained it will be compared against the value specified in the following field. The comparison will be made in accordance with the condition specified in this field.</td> | |||
</tr> | |||
<tr> | |||
<td>Value</td> | |||
<td>various; default: <b>none</b></td> | |||
<td>The value against which the read data will be compared.</td> | |||
</tr> | |||
<tr> | |||
<td>Action</td> | |||
<td>SMS | Trigger output | Modbus Request; default: <b>SMS</b></td> | |||
<td>Action that will be taken if the condition is met. Possible actions: | |||
<ul> | |||
<li><b>SMS</b> - sends and SMS message to a specified recipient(s).</li> | |||
<li><b>Trigger output</b> - changes the state of a specified output(s).</li> | |||
<li><b>Modbus Request</b> - sends a Modbus request to a specified slave.</li> | |||
</ul> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: #0054a6;">SMS: Message</span></td> | |||
<td>string; default: <b>none</b></td> | |||
<td>SMS message text.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: #0054a6;">SMS: Phone number</span></td> | |||
<td>phone number; default: <b>none</b></td> | |||
<td>Recipient's phone number.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">Trigger output: Output</span></td> | |||
<td>Open collector output | Relay output | Both; default: <b>Open collector output</b></td> | |||
<td>Which output(s) will be triggered.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">Trigger output: I/O Action</span></td> | |||
<td>Turn On | Turn Off | Invert; default: <b>Turn On</b></td> | |||
<td>Action that will taken on the specified output.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">Modbus Request: IP address</span></td> | |||
<td>ip | host; default: <b>none</b></td> | |||
<td>Modbus slave's IP address.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">Modbus Request: Port</span></td> | |||
<td>integer [0..65535]; default: <b>none</b></td> | |||
<td>Modbus slave's port.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">Modbus Request: Timeout</span></td> | |||
<td>integer [1..30]; default: <b>5</b></td> | |||
<td>Maximum time to wait for a response.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">Modbus Request: ID</span></td> | |||
<td>integer [1..255]; default: <b>none</b></td> | |||
<td>Modbus slave ID.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">Modbus Request: Modbus function</span></td> | |||
<td>Read Coil Status (1) | Read Input Status (2) | Read Holding Registers (3) | Read Input Registers (4) | Force Single Coil (5) | Preset Single Register (6) | Force Multiple Coils (15) | Force Multiple Registers (16); default: <b>Force Single Coil (5)</b></td> | |||
<td>A function code specifies the type of register being addressed by a Modbus request.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">Modbus Request: First register</span></td> | |||
<td>integer [0..65535]; default: <b>none</b></td> | |||
<td>Begins reading from the register specified in this field.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">Modbus Request: Number of registers</span></td> | |||
<td>integer [0..65535]; default: <b>none</b></td> | |||
<td>The number of registers that will be read from the first register.</td> | |||
</tr> | |||
</table> |