Blocks MODBUS RTU
Contents
Modbus 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
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 |