Difference between revisions of "Blocks MODBUS RTU"
(2 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 56: | Line 56: | ||
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 92: | 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 128: | 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 164: | 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 200: | 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 232: | 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 |