Перейти к содержанию

Навигация

Modbus-client/en: различия между версиями

Новая страница: «---- 4. Determine the current address of the device connected to the Wiren Board. The address is unknown to us and we do not want to change it. To do this, at the…»
(Новая страница: «In older firmware versions <syntaxhighlight lang="bash">| xxd -r -p</syntaxhighlight> wasn't necessary»)
(Новая страница: «---- 4. Determine the current address of the device connected to the Wiren Board. The address is unknown to us and we do not want to change it. To do this, at the…»)
Строка 124: Строка 124:


----
----
4. Определим текущий адрес устройства, подключенного к Wiren Board. Адрес нам неизвестен и мы не хотим его менять.
4. Determine the current address of the device connected to the Wiren Board. The address is unknown to us and we do not want to change it. To do this, at the command line, run a cyclic command to poll the register of 0x80 devices with addresses from 1 to 247:
Для этого в командной строке выполним циклическую команду опроса регистра 0x80 устройств с адресами с 1 по 247:
<syntaxhighlight lang="bash">root@wirenboard:~# for i in {1..247}; do modbus_client -mrtu /dev/ttyAPP1 --debug -a$i -t3 -r0x80 -s2 -pnone; done 2>/dev/null | grep Data: </syntaxhighlight>
<syntaxhighlight lang="bash">root@wirenboard:~# for i in {1..247}; do modbus_client -mrtu /dev/ttyAPP1 --debug -a$i -t3 -r0x80 -s2 -pnone; done 2>/dev/null | grep Data: </syntaxhighlight>
Ответ:      
Answer      
<syntaxhighlight lang="bash">        Data: 0x0072</syntaxhighlight>
<syntaxhighlight lang="bash">        Data: 0x0072</syntaxhighlight>
Результат: адрес подключенного устройства — 0x0072, то есть 114. Перебор всех адресов от 1 до 247 занимает чуть больше 2 минут.
Result: the address of the connected device is 0x0072, i.e. 114. It takes a little more than 2 minutes to search all addresses from 1 to 247.


----
----
12 063

правки