Перейти к содержанию
Переключить боковую панель
Поиск
Поиск
Пользовательские ссылки
русский
Создать учётную запись
Персональные инструменты
expanded
collapsed
Создать учётную запись
Войти
Pages for logged out editors
узнать больше
Навигация
Вернуться на главный сайт:
wirenboard.com
Навигация
Заглавная страница
Читателям
Как внести правку или задать вопрос
Справочник по синтаксису
Инструменты
Служебные страницы
Версия для печати
Пространства имён
Перевести
Варианты
expanded
collapsed
Просмотры
Статистика по языкам
Статистика группы сообщений
Экспорт
Ещё
expanded
collapsed
Экспорт переводов
Параметры
Группа
1-Wire
ADC
ADC:Измерение сопротивлений - технические детали
Backup power for Wiren Board devices
Bluetooth
BMP085
Buzzer
CAN
CMUX
CODESYS
Consumer IR
Controller hardware revisions
CryptodevATECCx08 Auth
DDM845R
Device Tree
DI
Disassembling the controller case
Documentation
Fast Modbus
Gas sensor WB-MSGR
GPIO
Hardware Overview rev. 2.8-rus
Hardware Watchdog Disable
How To Build Linux Kernel
I/O Mapping Matrix
ILI9341
IMX233-OLinuXino-MICRO
Includes. Relay tuning
Inspektor SCADA
IntraHouse
IO modules
LAN9514
MediaWiki:Sitenotice
MOD-MRF24J40
Modbus
Modbus RTU/TCP Slave
Modbus-client
Modem-stretch
MQTT KNX V.0.1.x
NFC
Node-RED
Notification module
NRF24L01
Pin pull-up
Power Meter WB-MAP12H
Power Meter WB-MAP12H Measuring Parameters
Power Meter WB-MAP12H Measuring Registers
Power over Ethernet
Reg
Relay Module Modbus Management
RS-485
RS-485: Wiring and Connection
RS-485:Configuration via Web Interface
Rule Examples
SC16IS752
Sensors Modbus Management
Serial Port
SIM5300E
SIM68V
SIM900R
SNMP
SSH
SVG-Dashboards
TFT01-2.2SP
UART Communication Settings
UEXT-разъемы
Using Wiren Board with peripheral devices
Using Wiren Board with pulsed output devices
View controller files from your computer
Watchdog
WB 4: Errata
WB 5: Errata
WB 6: Errata
WB 7: Errata
WB AC rev. E1.0
WB AC rev. E2.0
WB Dimmers Modbus Registers Map
WB Modbus Devices Firmware Update
WB SH 3.5: Errata
WB SH 3.5: GPIO List
WB SH 3.5: UEXT2
WB-IMX233-CORE
WB-M1W2 1-Wire to Modbus Temperature Measurement Module
WB-MAI2-mini/CC 4-20mA Modbus Analog Inputs
WB-MAO4 0-10V Modbus Analog Outputs
WB-MCM16 Модуль счетных входов 16-канальный
WB-MCM8 Modbus Count Inputs
WB-MGE Modbus-Ethernet Interface Converter
WB-MIO Modbus Interface Converters
WB-MIO-Modbus-Registers
WB-MIR v1 - Modbus IR Remote Control
WB-MIR v2 - Modbus IR Remote Control
Wb-mqtt-db-cli
Wb-mqtt-serial driver
Wb-mqtt-serial templates
WB-MR3xV and WB-MR6xV Modbus Relay Modules
WB-MR6F Modbus Relay Module
WB-MR: Errata
WB-MRM2-mini Modbus Relay Modules
WB-MRPS6 Modbus Relay Modules
WB-MRWL3 Modbus Relay Modules
WB-MSW v.3 Modbus Sensor
WB-MSW v.4 Modbus Sensor
WB-MSWv 3 registers
WB-MSx Consumer IR Manual
WB-UPS Backup power supply for DIN rails
WB5 root password recovery
WB6 root password recovery
WBC-4G v.2
WBE-DI-DR-3
WBE-MICROSD Extension Module
WBE2-AO-10V-2 Analog Outputs 0-10V Extension Module
WBE2-DI-DR-3 Dry Contact Inputs Extension Module
WBE2-DO-OC-2 Open Collector Outputs Extension Module
WBE2-DO-R6C-1 Relay Extension Module
WBE2-DO-SSR-2 Dry Contact Outputs Extension Module
WBE2-I-1-WIRE 1-Wire Extension Module
WBE2-I-CAN-ISO CAN Extension Module
WBE2-I-KNX KNX Extension Module
WBE2-I-KNX: Errata
WBE2-I-RS232 RS-232 Extension Module
WBE2-I-RS485-ISO RS485 Extension Module
WBE2R-R-GPS GPS/GLONASS Extension Module
WBE2R-R-LORA v.1 Extension Module
WBE2R-R-ZIGBEE v.1 ZigBee Extension Module
WBE2S-MICROSD MicroSD Extension Module
Wbincludes:1-Wire Network
Wbincludes:1-Wire Warning
Wbincludes:Configuration MOD
Wbincludes:Configuration WBC
Wbincludes:GSM Modem Default Connection Parameters
Wbincludes:How to enter
Wbincludes:Installation MOD WBE2
Wbincludes:Installation MOD WBE2R
Wbincludes:Installing Software In Console
Wbincludes:Mount MOD
Wbincludes:Mount Relay
Wbincludes:Peripherals
Wbincludes:Relay Purpose2
Wbincludes:Revision
Wbincludes:Setup MOD
Wbincludes:WB-MSW v.3 Body Painting
Wbincludes:WB-MSW v.3 Functions
Wbincludes:WB-MSW v.4 Difference v.3
Wbincludes:WBC-4G Info
Wbincludes:WBC-4G Specifications
Wbincludes:WebUI Change Access Level
WBIO-AI-DCM-4 I/O Module
WBIO-AI-DV-12 Analog Inputs
WBIO-AI-DV-12/4-20mA Analog Inputs
WBIO-AO-10V-8 Analog Outputs 0-10V
WBIO-DI-DR-14 I/O Module
WBIO-DI-DR-16 I/O Module
WBIO-DI-DR-8 I/O Module
WBIO-DI-HVD-16 16-Channel 230V Detector Module
WBIO-DI-HVD-8 8-Channel 230V Detector Module
WBIO-DI-WD-14 Discrete Inputs
WBIO-DO-HS-8 Discrete Outputs
WBIO-DO-R10A-8 Relay Module
WBIO-DO-R10R-4 Relay Module For Roller Shutter
WBIO-DO-R1G-16 1A Relay Module
WBIO-DO-SSR-8 Discrete Outputs Dry Contact
WBMZ-BATTERY - модуль резервного питания
WBMZ2-BATTERY Backup Power Module
Wellpro
Wi-Fi Old
Wiren Board 2.8. Исходные файлы
Wiren Board 4: GPIO List
Wiren Board 4: Модуль расширения RS-232
Wiren Board 4:Аппаратная часть
Wiren Board 4:Первое включение
Wiren Board 5.1: GPIO List
Wiren Board 5.5: GPIO List
Wiren Board 5.8:Список GPIO
Wiren Board 5: Build an image to download in USB Mass-Storage mode
Wiren Board 5: GPIO List
Wiren Board 5: Восстановление прошивки
Wiren Board 5: Модуль расширения 1-Wire
Wiren Board 5: Модуль расширения ADC
Wiren Board 5: Модуль расширения GPS/Glonass
Wiren Board 5: Модуль расширения RS-232 (WBE-I-RS232)
Wiren Board 5: Модуль расширения RS485-ISO
Wiren Board 5:Аппаратная часть
Wiren Board 5:Первое включение
Wiren Board 5:Схемотехника
Wiren Board 6.1: GPIO List
Wiren Board 6.2: Peripherals
Wiren Board 6.7: Peripherals
Wiren Board 6: Hardware
Wiren Board 6: WBE2R-R-GPS GPS/GLONASS Extension Module:NTPD PPS Setup
Wiren Board 6: Модуль расширения 433MHz (WBE2S-R-433MHZ)
Wiren Board Device Modbus Address
Wiren Board Devices Modbus Management
Wiren Board NETMON-1
Wiren Board NETMON-1: GPIO List
Wiren Board NETMON-2
Wiren Board Smart Home 3.5
Wiren Board Smart Home rev. 3.5
Wiren Board Software
Wiren Board Web Interface
Wiren Board Web Interface 1.0
Wiren Board: Extension Modules
Wirenboard6:InstallingOnTheRemoteSite
Z-Wave
Zabbix
Датчик SHT1x
Движок правил wb-rules 1.7
Доступ к порту RS-485 контроллера Wiren Board с компьютера
Как разрабатывать ПО для Wiren Board
Консоль
Модули расширения
Модуль ввода-вывода с TTL-уровнями (WBIO-DIO-TTL-8)
Модуль выходов "Открытый коллектор" WBE-DO-OС-2
Модуль выходов "сухой контакт" (оптореле) WBE-DO-SSR-2
Модуль наличия напряжения (WBIO-DI-LVD-16)
Модуль наличия напряжения (WBIO-DI-LVD-8)
Модуль расширения CAN (WBE-I-CAN-ISO)
Модуль расширения CAN (WBE-I-CAN-ISO) wb6
Модуль расширения DAC (WBE-AO-10V-2)
Модуль расширения KNX (WBE-I-KNX)
Модуль релейных выходов 3A (WBIO-DO-R3A-8)
Модуль релейных выходов WBE-DO-R6C-1
ПО МКА-3
Первое включение Wiren Board
Первое включение Wiren Board Smart Home
Периферийные устройства
Периферийные устройства с интерфейсом RS-485 серии WB-xxxx
Питание USB-портов
Получение точного времени через GPS/Glonass
Потеря файлов при обновлении ПО
Работа с GPIO
Сounters Pulsar
Сборка образа
Сборка образов прошивки
Создание microSD-карты с образом
Список GPIO
Стандартный образ ФС
Уникальные идентификаторы
Управление низковольтной нагрузкой
Устарело: низкоуровневая работа с ADC в Wiren Board 2, 3 и 4
Участник:EvgenyBoger/CT309-test
Участник:EvgenyBoger/test2
Участник:EvgenyBoger/testtrans
Участник:EvgenyBoger/testtrans2
Участник:EvgenyBoger/Wbincludes:Revision
Шаблон:Node-RED Installing plugin
Шаблон:Testtrans3
Язык
aa - Afar
ab - Abkhazian
abs - Ambonese Malay
ace - Achinese
ady - Adyghe
ady-cyrl - Adyghe (Cyrillic script)
aeb - Tunisian Arabic
aeb-arab - Tunisian Arabic (Arabic script)
aeb-latn - Tunisian Arabic (Latin script)
af - Afrikaans
ak - Akan
aln - Gheg Albanian
alt - Southern Altai
am - Amharic
ami - Amis
an - Aragonese
ang - Old English
anp - Angika
ar - Arabic
arc - Aramaic
arn - Mapuche
arq - Algerian Arabic
ary - Moroccan Arabic
arz - Egyptian Arabic
as - Assamese
ase - American Sign Language
ast - Asturian
atj - Atikamekw
av - Avaric
avk - Kotava
awa - Awadhi
ay - Aymara
az - Azerbaijani
azb - South Azerbaijani
ba - Bashkir
ban - Balinese
ban-bali - ᬩᬲᬩᬮᬶ
bar - Bavarian
bbc - Batak Toba
bbc-latn - Batak Toba (Latin script)
bcc - Southern Balochi
bci - wawle
bcl - Central Bikol
be - Belarusian
be-tarask - Belarusian (Taraškievica orthography)
bg - Bulgarian
bgn - Western Balochi
bh - Bhojpuri
bho - Bhojpuri
bi - Bislama
bjn - Banjar
bm - Bambara
bn - Bangla
bo - Tibetan
bpy - Bishnupriya
bqi - Bakhtiari
br - Breton
brh - Brahui
bs - Bosnian
btm - Batak Mandailing
bto - Iriga Bicolano
bug - Buginese
bxr - Russia Buriat
ca - Catalan
cbk-zam - Chavacano
cdo - Min Dong Chinese
ce - Chechen
ceb - Cebuano
ch - Chamorro
cho - Choctaw
chr - Cherokee
chy - Cheyenne
ckb - Central Kurdish
co - Corsican
cps - Capiznon
cr - Cree
crh - Crimean Turkish
crh-cyrl - Crimean Tatar (Cyrillic script)
crh-latn - Crimean Tatar (Latin script)
cs - Czech
csb - Kashubian
cu - Church Slavic
cv - Chuvash
cy - Welsh
da - Danish
dag - Dagbani
de - German
de-at - Austrian German
de-ch - Swiss High German
de-formal - German (formal address)
din - Dinka
diq - Zazaki
dsb - Lower Sorbian
dtp - Central Dusun
dty - Doteli
dv - Divehi
dz - Dzongkha
ee - Ewe
egl - Emilian
el - Greek
eml - Emiliano-Romagnolo
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - Spanish
es-419 - Latin American Spanish
es-formal - español (formal)
et - Estonian
eu - Basque
ext - Extremaduran
fa - Persian
ff - Fulah
fi - Finnish
fit - Tornedalen Finnish
fj - Fijian
fo - Faroese
fr - French
frc - Cajun French
frp - Arpitan
frr - Northern Frisian
fur - Friulian
fy - Western Frisian
ga - Irish
gag - Gagauz
gan - Gan Chinese
gan-hans - Gan (Simplified)
gan-hant - Gan (Traditional)
gcr - Guianan Creole
gd - Scottish Gaelic
gl - Galician
glk - Gilaki
gn - Guarani
gom - Goan Konkani
gom-deva - Goan Konkani (Devanagari script)
gom-latn - Goan Konkani (Latin script)
gor - Gorontalo
got - Gothic
grc - Ancient Greek
gsw - Swiss German
gu - Gujarati
guc - Wayuu
guw - gungbe
gv - Manx
ha - Hausa
hak - Hakka Chinese
haw - Hawaiian
he - Hebrew
hi - Hindi
hif - Fiji Hindi
hif-latn - Fiji Hindi (Latin script)
hil - Hiligaynon
ho - Hiri Motu
hr - Croatian
hrx - Hunsrik
hsb - Upper Sorbian
ht - Haitian Creole
hu - Hungarian
hu-formal - magyar (formal)
hy - Armenian
hyw - Western Armenian
hz - Herero
ia - Interlingua
id - Indonesian
ie - Interlingue
ig - Igbo
ii - Sichuan Yi
ik - Inupiaq
ike-cans - Eastern Canadian (Aboriginal syllabics)
ike-latn - Eastern Canadian (Latin script)
ilo - Iloko
inh - Ingush
io - Ido
is - Icelandic
it - Italian
iu - Inuktitut
ja - Japanese
jam - Jamaican Creole English
jbo - Lojban
jut - Jutish
jv - Javanese
ka - Georgian
kaa - Kara-Kalpak
kab - Kabyle
kbd - Kabardian
kbd-cyrl - Kabardian (Cyrillic script)
kbp - Kabiye
kcg - Tyap
kg - Kongo
khw - Khowar
ki - Kikuyu
kiu - Kirmanjki
kj - Kuanyama
kjp - Eastern Pwo
kk - Kazakh
kk-arab - Kazakh (Arabic script)
kk-cn - Kazakh (China)
kk-cyrl - Kazakh (Cyrillic script)
kk-kz - Kazakh (Kazakhstan)
kk-latn - Kazakh (Latin script)
kk-tr - Kazakh (Turkey)
kl - Kalaallisut
km - Khmer
kn - Kannada
ko - Korean
ko-kp - Korean (North Korea)
koi - Komi-Permyak
kr - Kanuri
krc - Karachay-Balkar
kri - Krio
krj - Kinaray-a
krl - Karelian
ks - Kashmiri
ks-arab - Kashmiri (Arabic script)
ks-deva - Kashmiri (Devanagari script)
ksh - Colognian
ku - Kurdish
ku-arab - Kurdish (Arabic script)
ku-latn - Kurdish (Latin script)
kum - Kumyk
kv - Komi
kw - Cornish
ky - Kyrgyz
la - Latin
lad - Ladino
lb - Luxembourgish
lbe - Lak
lez - Lezghian
lfn - Lingua Franca Nova
lg - Ganda
li - Limburgish
lij - Ligurian
liv - Livonian
lki - Laki
lld - Ladin
lmo - Lombard
ln - Lingala
lo - Lao
loz - Lozi
lrc - Northern Luri
lt - Lithuanian
ltg - Latgalian
lus - Mizo
luz - Southern Luri
lv - Latvian
lzh - Literary Chinese
lzz - Laz
mad - Madurese
mai - Maithili
map-bms - Basa Banyumasan
mdf - Moksha
mg - Malagasy
mh - Marshallese
mhr - Eastern Mari
mi - Maori
min - Minangkabau
mk - Macedonian
ml - Malayalam
mn - Mongolian
mni - Manipuri
mnw - Mon
mo - Moldovan
mr - Marathi
mrh - Mara
mrj - Western Mari
ms - Malay
ms-arab - بهاس ملايو
mt - Maltese
mus - Muscogee
mwl - Mirandese
my - Burmese
myv - Erzya
mzn - Mazanderani
na - Nauru
nah - Nāhuatl
nan - Min Nan Chinese
nap - Neapolitan
nb - Norwegian Bokmål
nds - Low German
nds-nl - Low Saxon
ne - Nepali
new - Newari
ng - Ndonga
nia - Nias
niu - Niuean
nl - Dutch
nl-informal - Nederlands (informeel)
nn - Norwegian Nynorsk
no - Norwegian
nov - Novial
nqo - N’Ko
nrm - Norman
nso - Northern Sotho
nv - Navajo
ny - Nyanja
nys - Nyungar
oc - Occitan
ojb - Ojibwemowin
olo - Livvi-Karelian
om - Oromo
or - Odia
os - Ossetic
pa - Punjabi
pag - Pangasinan
pam - Pampanga
pap - Papiamento
pcd - Picard
pdc - Pennsylvania German
pdt - Plautdietsch
pfl - Palatine German
pi - Pali
pih - Norfuk / Pitkern
pl - Polish
pms - Piedmontese
pnb - Western Punjabi
pnt - Pontic
prg - Prussian
ps - Pashto
pt - Portuguese
pt-br - Brazilian Portuguese
pwn - Paiwan
qu - Quechua
qug - Chimborazo Highland Quichua
rgn - Romagnol
rif - Riffian
rm - Romansh
rmc - Carpathian Romani
rmy - Vlax Romani
rn - Rundi
ro - Romanian
roa-tara - Tarantino
ru - Russian
rue - Rusyn
rup - Aromanian
ruq - Megleno-Romanian
ruq-cyrl - Megleno-Romanian (Cyrillic script)
ruq-latn - Megleno-Romanian (Latin script)
rw - Kinyarwanda
sa - Sanskrit
sah - Sakha
sat - Santali
sc - Sardinian
scn - Sicilian
sco - Scots
sd - Sindhi
sdc - Sassarese Sardinian
sdh - Southern Kurdish
se - Northern Sami
sei - Seri
ses - Koyraboro Senni
sg - Sango
sgs - Samogitian
sh - Serbo-Croatian
shi - Tachelhit
shi-latn - Tachelhit (Latin script)
shi-tfng - Tachelhit (Tifinagh script)
shn - Shan
shy - Shawiya
shy-latn - Shawiya (Latin script)
si - Sinhala
simple - Simple English
sjd - Kildin Sami
sje - Pite Sami
sk - Slovak
skr - Saraiki
skr-arab - Saraiki (Arabic script)
sl - Slovenian
sli - Lower Silesian
sm - Samoan
sma - Southern Sami
smn - Inari Sami
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
sr-ec - Serbian (Cyrillic script)
sr-el - Serbian (Latin script)
srn - Sranan Tongo
ss - Swati
st - Southern Sotho
stq - Saterland Frisian
sty - себертатар
su - Sundanese
sv - Swedish
sw - Swahili
szl - Silesian
szy - Sakizaya
ta - Tamil
tay - Tayal
tcy - Tulu
te - Telugu
tet - Tetum
tg - Tajik
tg-cyrl - Tajik (Cyrillic script)
tg-latn - Tajik (Latin script)
th - Thai
ti - Tigrinya
tk - Turkmen
tl - Tagalog
tly - Talysh
tly-cyrl - толыши
tn - Tswana
to - Tongan
tpi - Tok Pisin
tr - Turkish
tru - Turoyo
trv - Taroko
ts - Tsonga
tt - Tatar
tt-cyrl - Tatar (Cyrillic script)
tt-latn - Tatar (Latin script)
tum - Tumbuka
tw - Twi
ty - Tahitian
tyv - Tuvinian
tzm - Central Atlas Tamazight
udm - Udmurt
ug - Uyghur
ug-arab - Uyghur (Arabic script)
ug-latn - Uyghur (Latin script)
uk - Ukrainian
ur - Urdu
uz - Uzbek
uz-cyrl - Uzbek (Cyrillic script)
uz-latn - Uzbek (Latin script)
ve - Venda
vec - Venetian
vep - Veps
vi - Vietnamese
vls - West Flemish
vmf - Main-Franconian
vo - Volapük
vot - Votic
vro - Võro
wa - Walloon
war - Waray
wls - Wallisian
wo - Wolof
wuu - Wu Chinese
xal - Kalmyk
xh - Xhosa
xmf - Mingrelian
xsy - Saisiyat
yi - Yiddish
yo - Yoruba
yue - Cantonese
za - Zhuang
zea - Zeelandic
zgh - Standard Moroccan Tamazight
zh - Chinese
zh-cn - Chinese (China)
zh-hans - Simplified Chinese
zh-hant - Traditional Chinese
zh-hk - Chinese (Hong Kong)
zh-mo - Chinese (Macau)
zh-my - Chinese (Malaysia)
zh-sg - Chinese (Singapore)
zh-tw - Chinese (Taiwan)
zu - Zulu
Формат
Экспорт для оффлайнового перевода
Экспорт в родном формате
Вывести
{{DISPLAYTITLE:Modbus-client}}<languages/> == General information == The modbus-client utility is used to communicate via Modbus RTU and Modbus TCP protocols from the command line. The main purpose of this utility is to use Modbus devices as a debugging or configuration tool. The modbus-client utility comes with a set of Wiren Board controller software. The utility is written in C language and uses the open [https://github.com/stephane/libmodbus libmodbus] library. The fork of this utility, supplied with the Wiren Board devices, is stored [https://github.com/contactless/modbus-utils here]. '''IMPORTANT: since the Modbus driver is running on the functioning Wiren Board controller, it must be stopped before working with the modbus-client — they cannot use the same RS-485 port together.''' Commands to stop the service: * for Wiren Board 5 and above: <syntaxhighlight lang="bash">service wb-mqtt-serial stop</syntaxhighlight> * for Wiren Board 4: <syntaxhighlight lang="bash">service wb-homa-modbus stop</syntaxhighlight> '''IMPORTANT: When writing any value, do not forget to specify the value itself! ''' Otherwise, the registers may contain random information (see [[Special:MyLanguage/#примеры-использования в modbus rtu|examples of use]] for details). == Command line call and arguments == Calling modbus_client without arguments will display a brief description of the possible arguments for the command: <syntaxhighlight lang="bash"> modbus_client [--debug] [-m {rtu|tcp}] [-a<slave-addr=1>] [-c<read-no>=1] [-r<start-addr>=100] [-t<f-type>] [-o<timeout-ms>=1000] [{rtu-params|tcp-params}] serialport|host [<write-data>] NOTE: if first reference address starts at 0, set -0 f-type: (0x01) Read Coils, (0x02) Read Discrete Inputs, (0x05) Write Single Coil (0x03) Read Holding Registers, (0x04) Read Input Registers, (0x06) WriteSingle Register (0x0F) WriteMultipleCoils, (0x10) Write Multiple register rtu-params: b<baud-rate>=9600 d{7|8}<data-bits>=8 s{1|2}<stop-bits>=1 p{none|even|odd}=even tcp-params: p<port>=502 Examples (run with default mbServer at port 1502): Write data: modbus_client --debug -mtcp -t0x10 -r0 -p1502 127.0.0.1 0x01 0x02 0x03 Read that data: modbus_client --debug -mtcp -t0x03 -r0 -p1502 127.0.0.1 -c3 </syntaxhighlight> Parameter values (address, timeout, function type, etc.) can be specified in both hexadecimal (0x**) and decimal. * The first argument '''--debug''' — is arbitrary. It can be specified in any position and enables debugging by displaying the hexadecimal codes of the data being sent and received. * The next argument is '''-m'''. It must be specified first on the command line, or second if the first argument is '''--debug''' or the file name of the RS-485 port. The argument specifies the type of Protocol used '''-mrtu''' — Modbus RTU, '''-mtcp''' — Modbus TCP. * The '''-a''' argument specifies the Modbus address of the device we are accessing. If the argument is not used, the default address is 0x01. * The '''-c''' argument determines how many items we request. The default value is one. * The '''-r''' argument specifies the start address for reading or writing. The default value is 100 (0x64). * The-t argument specifies the Modbus function code. They are briefly listed in the modbus_client output, the code values are described in more detail on the [[Special:MyLanguage/Протокол Modbus/en|Modbus Protocol]] page. * The '''-o''' argument specifies a timeout in milliseconds (the default is 1000). * The '''-0''' (zero) argument reduces the address specified by the '''-r''' argument by one. This can be useful when working with devices with non-standard addressing, for example, with the address range 1 — 65536 instead of the usual 0 — 65535. Then you enter the specific parameters of the protocol (Modbus RTU or Modbus TCP). Despite the information displayed in the tooltip, these parameters also start with a '-' (minus) sign. For Modbus RTU: * '''-b''' — скорость передачи данных по последовательной линии (по умолчанию — 9600). * '''-d''' — количество передаваемых бит данных (7 или 8, по умолчанию — 8). * '''-s''' — количество стоповых битов (1 или 2, по умолчанию — 1). * '''-p''' — контроль четности ('''-p none''' — нет проверки, '''-p even''' — передается бит контроля на четность, '''-p odd''' — передается бит контроля на нечетность). По умолчанию передается бит контроля на четность(E). For Modbus TCP: *'''-p''' — TCP port number of the device which the controller communicates with. This is followed by the file name of the RS-485 port or host address, and at the end (optional, only for recording functions) — data. <span id="примеры-использования в modbus rtu"></span> == Examples of use in Modbus RTU == Here are some examples illustrating the capabilities of this utility. ---- 1. Write the new address of the WB-MR14 device to the 0x80 register using the 0x06 (Write Single Register) function. <syntaxhighlight lang="bash">modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a0x00 -t0x06 -r0x80 0x02</syntaxhighlight> Where 0x02 is the address to be set. Answer: <syntaxhighlight lang="bash">Data to write: 0x2 Opening /dev/ttyAPP1 at 9600 bauds (N, 8, 2) [00][06][00][80][00][02][08][32] Waiting for a confirmation... ERROR Connection timed out: select ERROR occured!</syntaxhighlight> The error message always occurs when writing to the special address 0 (-a0x00). Now the device needs to contact us at the address 0x02. An example of '''improper''' use: <syntaxhighlight lang="bash">modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a0x00 -t0x06 -r0x80</syntaxhighlight> It does not specify the address to be given to the device and the device will receive an unknown address. To fix this, you need to access the device at the special address 0x00 (see the first command). ---- 2. Check: read the contents of the register 0x80 (now from the device with the address 0x02) using the function 0x03 (Read Holding Registers). Note that in Wiren Board devices, the functions 0x03 and 0x04 are interchangeable and lead to the same result. <syntaxhighlight lang="bash">modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a2 -t0x03 -r0x80</syntaxhighlight> Ответ: <syntaxhighlight lang="bash">Opening /dev/ttyAPP1 at 9600 bauds (N, 8, 2) [02][03][00][80][00][01][85][D1] Waiting for a confirmation... <02><03><02><00><02><7D><85> SUCCESS: read 1 of elements: Data: 0x0002</syntaxhighlight> ---- 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 at 200 and occupies 6 registers. <syntaxhighlight lang="bash">modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a1 -t0x03 -r200 -c 6</syntaxhighlight> Ответ: <syntaxhighlight lang="bash">Opening /dev/ttyAPP1 at 9600 bauds (N, 8, 2) [01][03][00][C8][00][06][44][36] Waiting for a confirmation... <01><03><0C><00><57><00><42><00><4D><00><52><00><31><00><34><D4><76> SUCCESS: read 6 of elements: Data: 0x0057 0x0042 0x004d 0x0052 0x0031 0x0034 </syntaxhighlight> 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 \ -a1 -t0x03 -r200 -c 6 | \ grep Data | sed -e 's/0x00/\\\x/g' -e 's/Data://' -e 's/\s//g'`| xxd -r -p </syntaxhighlight> Answer: <syntaxhighlight lang="bash">WBMR14</syntaxhighlight> 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 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: </syntaxhighlight> Answer <syntaxhighlight lang="bash"> 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. ---- 5.5. Let's turn on relay 6 on WB-MR14 relay module(addresses of flags registers start from zero, remember that!). Use the command 0x05 (Write Single Coil): <syntaxhighlight lang="bash">modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a1 -t0x05 -r0x05 0x01</syntaxhighlight> Answer: <syntaxhighlight lang="bash">Data to write: 0x1 Opening /dev/ttyAPP1 at 9600 bauds (N, 8, 2) [01][05][00][05][FF][00][9C][3B] Waiting for a confirmation... <01><05><00><05><FF><00><9C><3B> SUCCESS: written 1 elements!</syntaxhighlight> Note that the modbus_client utility replaced 1 with 0x00FF when recording, because this value is used to turn on the relay. Any nonzero value is changed to 0x00FF, give it a try. ---- 6. Turn on all the odd relays and turn off all the even ones. To do this, use the function 15 (Write Multiple Coils). There are only 14 relays in the module, so we have to pass values for 14 registers from 0 to 13. <syntaxhighlight lang="bash">modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 -a1 -t0x0f -r0x00 -c 14 0x00FF 0x0000 0x00FF 0x0000 0x00FF 0x0000 0x00FF 0x0000 0x00FF 0x0000 0x00FF 0x0000 0x00FF 0x0000</syntaxhighlight> Answer: <syntaxhighlight lang="bash">Data to write: 0xff 0x00 0xff 0x00 0xff 0x00 0xff 0x00 0xff 0x00 0xff 0x00 0xff 0x00 Opening /dev/ttyAPP1 at 9600 bauds (N, 8, 2) [01][0F][00][00][00][0E][02][55][15][1A][97] Waiting for a confirmation... <01><0F><00><00><00><0E><D4><0F> SUCCESS: written 14 elements!</syntaxhighlight> Note the structure of the query data: *[01] — address *[0F] — write Multiple Coils function code *[00][00] — address of the first flag register to be recorded *[00][0E] — number of items to record (14) *[02] — number of data bytes (14 bits are placed in 2 bytes) *[55][15] — 01010101 00010101 (the first relay is the lowest bit of the first byte, 8th relay is the highest bit of the first byte, 9th relay is the lowest bit of the second byte) *[1A][97] — CRC16 As well as note the structure of the answer: *<01> — address *<0F> — write Multiple Coils function code *<00><00> — address of the first flag register to be recorded *<00><0E> — number of recorded flag registers *<D4><0F> — CRC16 More detailed description of the request and response data structure can be found on the [[Протокол Modbus/en|Modbus Protocol]] page.