12 063
правки
(Новая страница: «=== The Modbus-registers of the device === Data and configuration parameters of Modbus devices are stored in Modbus registers. Each type of device has its own Mod…») |
|||
(не показано 6 промежуточных версий этого же участника) | |||
Строка 14: | Строка 14: | ||
Data and configuration parameters of Modbus devices are stored in Modbus registers. Each type of device has its own Modbus register maps, which are referenced on the respective device pages. | Data and configuration parameters of Modbus devices are stored in Modbus registers. Each type of device has its own Modbus register maps, which are referenced on the respective device pages. | ||
== | == Device signatures == | ||
The 6-byte module signature is stored at address 200. The signature is unique for each model of Wiren Board devices and allows to identify the model by Modbus: | |||
To get the signature of a device you need to run command READ_HOLDING_REGISTERS at 200 (length of 6 registers). Writing to this area of memory is not supported, and error 3 is returned when attempting to write to an invalid location. Empty spaces in the signature text are clogged with the value 0x00. | |||
Starting from register 220, the firmware build date is recorded, in the format ''number'''x00'''time'''x00''''' as a string (example: 'Jan 27 2017 17:01:13'). The length of the record is 21 registers. | |||
== | == Command line device management == | ||
The Wiren Board controller software includes modbus_client utility to work with devices connected to the RS-485 outputs, via Modbus Protocol, the detailed description of the command is on the page [[Modbus client/en| Modbus client]]. Access to the command line is described in [[SSH/en| SSh]]. | |||
=== | ===Register reading example === | ||
Let's check whether it is true that we are connected to the module of the desired type. (Module wb-mqtt-serial needs to be stopped). At address 200, a unique signature of 6 registers is stored. Let's read 6 registers, starting with the address 200, and convert the received hexadecimal answer into a character string: | |||
<syntaxhighlight lang="bash">echo -e `modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 \ | <syntaxhighlight lang="bash">echo -e `modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 \ | ||
Строка 31: | Строка 31: | ||
grep Data | sed -e 's/0x00/\\\x/g' -e 's/Data://' -e 's/\s//g'` </syntaxhighlight> | grep Data | sed -e 's/0x00/\\\x/g' -e 's/Data://' -e 's/\s//g'` </syntaxhighlight> | ||
As a result of the command we receive string '''WBMS'''. The WB-MS module in the example has Modbus address 1. |
правки