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

Навигация

Wiren Board Device Modbus Address/en: различия между версиями

м
FuzzyBot переименовал страницу Определение и изменение Modbus-адреса устройств Wirenboard/en в Wiren Board Device Modbus Address/en без оставления перенаправления: Часть переводимой страницы Определение и изменение Modbus-адреса устройств Wirenboard.
(Новая страница: «== Modbus address change ==»)
м (FuzzyBot переименовал страницу Определение и изменение Modbus-адреса устройств Wirenboard/en в Wiren Board Device Modbus Address/en без оставления перенаправления: Часть переводимой страницы Определение и изменение Modbus-адреса устройств Wirenboard.)
 
(не показаны 4 промежуточные версии 1 участника)
Строка 1: Строка 1:
<languages/>
<languages/>
See also[[UART_Communication_Settings/en|UART_Communication_Settings]].
See also [[UART_Communication_Settings/en|UART_Communication_Settings]].


== Сurrent Modbus address resolution ==
== Сurrent Modbus address resolution ==
Строка 18: Строка 18:
== Modbus address change ==
== Modbus address change ==


Мы можем задать устройству адрес, который нам необходим (например, 1), командой
We can set the device address we need (for example, 1) with the command
<syntaxhighlight lang="bash">root@wirenboard:~# modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a0 -t0x06 -r0x80 1</syntaxhighlight>
<syntaxhighlight lang="bash">root@wirenboard:~# modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a0 -t0x06 -r0x80 1</syntaxhighlight>
Для записи адреса мы используем широковещательный адрес 0 ( -a0) и Modbus RTU-команду WRITE_SINGLE_REGISTER с кодом 6 ( -t0x06). В регистр 0x80 ( -r0x80) мы записываем значение 1.  
We use the broadcast address 0 ( -a0) and Modbus RTU command WRITE_SINGLE_REGISTER with code 6 ( -t0x06) to write the address. In register 0x80 ( -r0x80) we write the value 1.  


'''Использование адреса 0 сбросит все адреса всем устройствам на шине! Никогда не используете эту команду, если к порту RS-485 подключено больше одного устройства!'''
'''Using address 0 will reset all addresses to all devices on the bus! Never use this command if more than one device is connected to the RS-485 port!'''


<syntaxhighlight lang="bash">root@wirenboard:~# modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a0 -t0x06 -r0x80 1
<syntaxhighlight lang="bash">root@wirenboard:~# modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a0 -t0x06 -r0x80 1
Строка 32: Строка 32:
ERROR occured!
ERROR occured!
</syntaxhighlight>
</syntaxhighlight>
Сообщение об ошибке не должно пугать: устройства Modbus не отвечают на команды, отправленные на широковещательный адрес. Проверим, сохранился ли адрес в адресном регистре:
The error message should not be frightening: Modbus devices do not respond to commands sent to the broadcast address. Check if the address is still in the address register:
<syntaxhighlight lang="bash">root@wirenboard:~# modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a1 -t0x03 -r0x80  
<syntaxhighlight lang="bash">root@wirenboard:~# modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a1 -t0x03 -r0x80  
Opening /dev/ttyAPP1 at 9600 bauds (N, 8, 2)
Opening /dev/ttyAPP1 at 9600 bauds (N, 8, 2)
Строка 41: Строка 41:
         Data: 0x0001  
         Data: 0x0001  
</syntaxhighlight>
</syntaxhighlight>
Отлично, устройство с адресом 0x01 при чтении регистра 0x80 вернуло значение 1 (мы помним, что один регистр хранит два восьмибитных значения, поэтому вывод команды содержит четыре шестнадцатеричных цифры: 0x0001). Желтый светодиод снова моргнул при обращении к устройству.
Fine, the device with address 0x01 returned value 1 when reading register 0x80 (we remember that one register stores two eight-bit values, so the output of the command contains four hexadecimal digits: 0x0001). The yellow led blinked again when referring to the device.
wb_editors
14 355

правок