31,703
edits
No edit summary |
|||
Line 26: | Line 26: | ||
$ sudo apt-get install ruby | $ sudo apt-get install ruby | ||
$ sudo gem instal modbus-cli | $ sudo gem instal modbus-cli | ||
==Getting router parameters== | |||
Modbus TCP can be used to both '''get''' and '''set''' certain router parameters. First lets do an overview of how to get parameters via Modbus TCP. | |||
===List of parameters=== | |||
Router parameters are held within '''registers'''. Each register contains 2 bytes of information. For simplification the number of registers for storing numbers is 2, while the number of registers for storing text information is 16. The register numbers and corresponding system values are described below: | |||
{| class="wikitable" | |||
|+ | |||
! style="width: 425px; background: black; color: white;" | Required value | |||
! style="width: 425px; background: black; color: white;" | Representation | |||
! style="width: 425px; background: black; color: white;" | Register number | |||
! style="width: 425px; background: black; color: white;" | Number of registers | |||
|- | |||
! style="text-align: left; vertical-align: top;" | System uptime | |||
| style="text-align: left; vertical-align: top;" | 32 bit unsigned integer | |||
| style="text-align: left; vertical-align: top;" | 1 | |||
| style="text-align: left; vertical-align: top;" | 2 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | GSM signal strength (dBm) | |||
| style="text-align: left; vertical-align: top;" | 32 bit integer | |||
| style="text-align: left; vertical-align: top;" | 3 | |||
| style="text-align: left; vertical-align: top;" | 2 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | System temperature in 0.1 degrees Celcium | |||
| style="text-align: left; vertical-align: top;" | 32 bit integer | |||
| style="text-align: left; vertical-align: top;" | 5 | |||
| style="text-align: left; vertical-align: top;" | 2 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | System hostname | |||
| style="text-align: left; vertical-align: top;" | Text | |||
| style="text-align: left; vertical-align: top;" | 7 | |||
| style="text-align: left; vertical-align: top;" | 16 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | GSM operator name | |||
| style="text-align: left; vertical-align: top;" | Text | |||
| style="text-align: left; vertical-align: top;" | 23 | |||
| style="text-align: left; vertical-align: top;" | 16 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Router serial number | |||
| style="text-align: left; vertical-align: top;" | Text | |||
| style="text-align: left; vertical-align: top;" | 39 | |||
| style="text-align: left; vertical-align: top;" | 16 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Router MAC address | |||
| style="text-align: left; vertical-align: top;" | Text | |||
| style="text-align: left; vertical-align: top;" | 55 | |||
| style="text-align: left; vertical-align: top;" | 16 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Router name | |||
| style="text-align: left; vertical-align: top;" | Text | |||
| style="text-align: left; vertical-align: top;" | 71 | |||
| style="text-align: left; vertical-align: top;" | 16 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Current SIM card | |||
| style="text-align: left; vertical-align: top;" | Text | |||
| style="text-align: left; vertical-align: top;" | 87 | |||
| style="text-align: left; vertical-align: top;" | 16 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Network registration | |||
| style="text-align: left; vertical-align: top;" | Text | |||
| style="text-align: left; vertical-align: top;" | 103 | |||
| style="text-align: left; vertical-align: top;" | 16 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Network type | |||
| style="text-align: left; vertical-align: top;" | Text | |||
| style="text-align: left; vertical-align: top;" | 119 | |||
| style="text-align: left; vertical-align: top;" | 16 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Digital input 1 | |||
| style="text-align: left; vertical-align: top;" | 32 bit integer | |||
| style="text-align: left; vertical-align: top;" | 135 | |||
| style="text-align: left; vertical-align: top;" | 2 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Digital input | |||
| style="text-align: left; vertical-align: top;" | 32 bit integer | |||
| style="text-align: left; vertical-align: top;" | 137 | |||
| style="text-align: left; vertical-align: top;" | 2 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Current WAN IP address | |||
| style="text-align: left; vertical-align: top;" | 32 bit unsigned integer | |||
| style="text-align: left; vertical-align: top;" | 139 | |||
| style="text-align: left; vertical-align: top;" | 2 | |||
|- | |||
! style="text-align: left; vertical-align: top;" | Analog input | |||
| style="text-align: left; vertical-align: top;" | 32 bit integer | |||
| style="text-align: left; vertical-align: top;" | 141 | |||
| style="text-align: left; vertical-align: top;" | 2 | |||
|- | |||
|} | |||
===modbus read=== | |||
To obtain parameters from the system, the '''modbus read''' command is used. |