Template:Networking rut2 9 modbus custom register block: Difference between revisions
Template:Networking rut2 9 modbus custom register block (view source)
Revision as of 09:28, 25 September 2020
, 25 September 2020no edit summary
No edit summary |
No edit summary |
||
Line 22: | Line 22: | ||
Script which would log certain data into Modbus register. To add new <b>script</b>, connect to the device via <b>SSH</b> and use: | Script which would log certain data into Modbus register. To add new <b>script</b>, connect to the device via <b>SSH</b> and use: | ||
$ vi /bin/extramodbus ( | $ vi /bin/extramodbus (this script is for this manual purpose, yours might be different) | ||
Insert following <b>script</b> (this script is for this manual purpose, yours might be different) example: | Insert following <b>script</b> (this script is for this manual purpose, yours might be different) example: | ||
Line 39: | Line 39: | ||
$ chmod +x /bin/<scriptname> #example: chmod +x /bin/extramodbus | $ chmod +x /bin/<scriptname> #example: chmod +x /bin/extramodbus | ||
Run the script to start logging data to regfile, to do that simply type in your terminal: <script name> &. | |||
For example: | |||
$ extramodbus & | $ extramodbus & | ||
Line 77: | Line 78: | ||
[[File:Configuration_examples_modbus_register_count.png|border|class=tlt-border]] | [[File:Configuration_examples_modbus_register_count.png|border|class=tlt-border]] | ||
==Reading Created Custom Modbus Registers with ComTestPro== | ==Reading Created Custom Modbus Registers with ComTestPro== | ||
For example | For this example we will be using <b>ComTestPro</b> program, which allows us to get Modbus data from device in <b>Hex</b>. So in order to get <b>date</b> from the router by reading <b>custom Modbus registers</b> we need to use following configuration: | ||
<ul> | <ul> | ||
<li>Protocol: Modbus TCP;</li> | <li>Protocol: Modbus TCP;</li> | ||
Line 86: | Line 87: | ||
<li>Registers: 14 (registers lenght).</li> | <li>Registers: 14 (registers lenght).</li> | ||
</ul> | </ul> | ||
With this configuration you should get routers <b>date</b> in <b>hex</b>. Below is the example of configuration and what | With this configuration you should get routers <b>date</b> in <b>hex</b>. Below is the example of configuration and what reply we get from the router: | ||
[[File:Configuration examples modbus comtest pro.png|border|class=tlt-border]] | [[File:Configuration examples modbus comtest pro.png|border|class=tlt-border]] | ||
And as you can see we received | And as you can see we received a reply in hex: | ||
5468 7520 4A75 6C20 3330 2031 313A 3539 3A30 3820 5554 4320 3230 3230 | 5468 7520 4A75 6C20 3330 2031 313A 3539 3A30 3820 5554 4320 3230 3230 | ||
By using certain websites, like this: '''[https://www.scadacore.com/tools/programming-calculators/online-hex-converter/ hex converter]''' we can analyze the data by entering the received hex reply. After conversion we can see the routers date which in <b>ASCII</b> is: | |||
Thu Jul 30 11:59:08 UTC 2020 | Thu Jul 30 11:59:08 UTC 2020 |