Все переводы
Введите имя сообщения для показа всех доступных переводов.
Найдено 2 перевода.
Сообщение | Текущий текст |
---|---|
ист. английский (en) | <syntaxhighlight lang="bash">root@wirenboard:~# service wb-mqtt-serial stop</syntaxhighlight> Let's try to determine the current address of the module. To do this, at the command line, run a cyclic command to poll the register of 0x80 devices with addresses from 1 to 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: Data: 0x0072</syntaxhighlight> 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. In the parameters of the modbus_client command call, we specify 2 stop bits( -s2), no parity ( -pnone), the speed of 9600 bit/s is set automatically. Read the command READ_HOLDING_REGISTERS with code 3 (-t3) from the register with the address 0x80 ( -r0x80), the address changes in the cycle from 1 to 247 ( -a$i). On some devices, the led blinks when communicating with them. [[Файл:Status_flash_mr14.gif|300px|thumb|left|Status led blinks when communication via RS-485 module WB-MR14]] |
ист. русский (ru) | <syntaxhighlight lang="bash">root@wirenboard:~# service wb-mqtt-serial stop</syntaxhighlight> Попробуем определить текущий адрес модуля. Для этого в командной строке выполним циклическую команду опроса регистра 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: Data: 0x0072</syntaxhighlight> Результат: адрес подключенного устройства — 0x0072, то есть 114. Перебор всех адресов от 1 до 247 занимает чуть больше 2 минут. В параметрах вызова команды modbus_client мы указываем 2 стоп-бита( -s2), отсутствие контроля четности ( -pnone), скорость 9600 бит/с устанавливается автоматически. Чтение выполняем командой READ_HOLDING_REGISTERS с кодом 3 (-t3) из регистра с адресом 0x80 ( -r0x80), адрес меняется в цикле от 1 до 247 ( -a$i). На некоторых устройствах при обмене с ними данными мигает индикатор. [[Файл:Status_flash_mr14.gif|300px|thumb|left|Светодиод Status мигает при обмене данными по RS-485 с модулем WB-MR14]] |