Difference between revisions of "Blocks MODBUS RTU"
(Created page with "== Modbus library == === RTU === ==== MODBUS_RTU_CFG ==== Set bus parameters {| class="wikitable" |- |in |Bus |string | |path to bus device (/dev/ttyS0) |- |in |Baud |int |...") |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | == | + | == [[Libraries for IEC 61131-3|Back to Libraries]] == |
− | |||
− | |||
==== MODBUS_RTU_CFG ==== | ==== MODBUS_RTU_CFG ==== | ||
Line 49: | Line 47: | ||
|identifies occured error by unique code | |identifies occured error by unique code | ||
|} | |} | ||
+ | '''Note:'''<br> | ||
+ | /dev/ttyS3 = BUS1 on the Connector E<br> | ||
+ | /dev/ttyS2 = BUS2 on the Connector E<br> | ||
+ | '''Example:'''<br> | ||
+ | [[File:B modbus cfg.jpg]] | ||
==== MODBUS_RTU_R_COIL ==== | ==== MODBUS_RTU_R_COIL ==== | ||
Reads one coil register | Reads one coil register | ||
{| class="wikitable" | {| class="wikitable" | ||
− | | colspan="5" |[[ | + | | colspan="5" | [[Libraries for IEC 61131-3|Asynchronous interface]] |
|- | |- | ||
|in | |in | ||
Line 89: | Line 92: | ||
Read one discrete discrete input register | Read one discrete discrete input register | ||
{| class="wikitable" | {| class="wikitable" | ||
− | | colspan="5" |[[ | + | | colspan="5" | [[Libraries for IEC 61131-3|Asynchronous interface]] |
|- | |- | ||
|in | |in | ||
Line 125: | Line 128: | ||
Reads one holding register | Reads one holding register | ||
{| class="wikitable" | {| class="wikitable" | ||
− | | colspan="5" |[[ | + | | colspan="5" |[[Libraries for IEC 61131-3|Asynchronous interface]] |
|- | |- | ||
|in | |in | ||
Line 161: | Line 164: | ||
Reads one input register | Reads one input register | ||
{| class="wikitable" | {| class="wikitable" | ||
− | | colspan="5" |[[ | + | | colspan="5" |[[Libraries for IEC 61131-3|Asynchronous interface]] |
|- | |- | ||
|in | |in | ||
Line 197: | Line 200: | ||
Writes value to one coil register | Writes value to one coil register | ||
{| class="wikitable" | {| class="wikitable" | ||
− | | colspan="5" |[[ | + | | colspan="5" |[[Libraries for IEC 61131-3|Asynchronous interface]] |
|- | |- | ||
|in | |in | ||
Line 229: | Line 232: | ||
|value to write | |value to write | ||
|} | |} | ||
+ | '''Example:'''<br> | ||
+ | [[File:B modbus w coil.jpg]] | ||
==== MODBUS_RTU_W_HOLDING ==== | ==== MODBUS_RTU_W_HOLDING ==== | ||
Writes value to one holding register | Writes value to one holding register | ||
{| class="wikitable" | {| class="wikitable" | ||
− | | colspan="5" |[[ | + | | colspan="5" |[[Libraries for IEC 61131-3|Asynchronous interface]] |
|- | |- | ||
|in | |in |
Latest revision as of 07:44, 2 October 2018
Contents
Back to Libraries
MODBUS_RTU_CFG
Set bus parameters
in | Bus | string | path to bus device (/dev/ttyS0) | |
in | Baud | int | standard baudrates from 150 to 115200 | |
in | Parity | string[1] | "N" = none, "E" = even, "O" = odd | |
in | Databit | USINT | Databits (5,6,7,8) | |
in | Stopbit | USINT | Stopbits (1,2) | |
out | ERR | bool | indicates some error occurs (0 = OK) | |
out | ERR_ID | WORD | identifies occured error by unique code |
Note:
/dev/ttyS3 = BUS1 on the Connector E
/dev/ttyS2 = BUS2 on the Connector E
Example:
MODBUS_RTU_R_COIL
Reads one coil register
Asynchronous interface | ||||
in | Bus | string | path to bus device (/dev/ttyS0) | |
in | UnitID | byte | device bus address (0-247) | |
in | OfsAdr | word | register address (1-9999) | |
in | Timeout | byte | timeout in seconds | |
out | Q | bool | readed value |
MODBUS_RTU_R_DISCRETE
Read one discrete discrete input register
Asynchronous interface | ||||
in | Bus | string | path to bus device (/dev/ttyS0) | |
in | UnitID | byte | device bus address (0-247) | |
in | OfsAdr | word | register address (1-9999) | |
in | Timeout | byte | timeout in seconds | |
out | Q | bool | readed value |
MODBUS_RTU_R_HOLDING
Reads one holding register
Asynchronous interface | ||||
in | Bus | string | path to bus device (/dev/ttyS0) | |
in | UnitID | byte | device bus address (0-247) | |
in | OfsAdr | word | register address (1-9999) | |
in | Timeout | byte | timeout in seconds | |
out | Q | word | readed value |
MODBUS_RTU_R_INPUT
Reads one input register
Asynchronous interface | ||||
in | Bus | string | path to bus device (/dev/ttyS0) | |
in | UnitID | byte | device bus address (0-247) | |
in | OfsAdr | word | register address (1-9999) | |
in | Timeout | byte | timeout in seconds | |
out | Q | word | readed value |
MODBUS_RTU_W_COIL
Writes value to one coil register
Asynchronous interface | ||||
in | Bus | string | path to bus device (/dev/ttyS0) | |
in | UnitID | byte | device bus address (0-247) | |
in | OfsAdr | word | register address (1-9999) | |
in | Timeout | byte | timeout in seconds | |
in | VAL | bool | value to write |
MODBUS_RTU_W_HOLDING
Writes value to one holding register
Asynchronous interface | ||||
in | Bus | string | path to bus device (/dev/ttyS0) | |
in | UnitID | byte | device bus address (0-247) | |
in | OfsAdr | word | register address (1-9999) | |
in | Timeout | byte | timeout in seconds | |
in | VAL | word | value to write |