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

Навигация

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

Новая страница: «In the answer we received 6 16-bit values, each of which contains the code of one ASCII-character. Convert them, replacing the initial '''0x00''' with '''/x''' an…»
(Новая страница: «---- 3. Read the registers of the relay module WB-MR14 with address 0x01, containing the signature of the device, WBMR14. It is known that the signature is stored…»)
(Новая страница: «In the answer we received 6 16-bit values, each of which contains the code of one ASCII-character. Convert them, replacing the initial '''0x00''' with '''/x''' an…»)
Строка 113: Строка 113:
         Data: 0x0057 0x0042 0x004d 0x0052 0x0031 0x0034 </syntaxhighlight>
         Data: 0x0057 0x0042 0x004d 0x0052 0x0031 0x0034 </syntaxhighlight>


В ответе мы получили 6 16-битных значений, в каждом из которых содержится код одного ASCII-символа. Преобразуем их, заменив начальные '''0x00''' на '''/x''' и удалив пробелы, к виду \x57 и т.д., который понятен команде echo, и выведем на экран получившееся:
In the answer we received 6 16-bit values, each of which contains the code of one ASCII-character. Convert them, replacing the initial '''0x00''' with '''/x''' and removing spaces, to the form \x57, etc, which is understandable to the echo command, and display the resulting:
<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 \
-a1 -t0x03 -r200 -c 6 | \
-a1 -t0x03 -r200 -c 6 | \
12 063

правки