Difference between revisions of "Blocks MODBUS RTU"

From IPLOG
Jump to: navigation, search
(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 |...")
 
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Modbus library ==
+
=== Master MODE ===
  
=== RTU ===
+
==== RTU ====
  
==== MODBUS_RTU_CFG ====
+
===== MODBUS_RTU_CFG =====
 
Set bus parameters
 
Set bus parameters
 
{| class="wikitable"
 
{| class="wikitable"
Line 11: Line 11:
 
|string
 
|string
 
|
 
|
|path to bus device (/dev/ttyS0)
+
|path to bus device (BUS1 = "/dev/ttyS3" or BUS2 = "/dev/ttyS2")  
 
|-
 
|-
 
|in
 
|in
Line 17: Line 17:
 
|int
 
|int
 
|
 
|
|standard baudrates from 150 to 115200
+
|standard baudrates from 150 to 115200 (allowed speeds: 150, 300, 600, 1200, 1800, 2400, 4800, 7200, 9600, 14400, 19200, 38400, 57600, 115200, 1000000)
 
|-
 
|-
 
|in
 
|in
Line 50: Line 50:
 
|}
 
|}
  
==== MODBUS_RTU_R_COIL ====
+
===== MODBUS_RTU_STATS =====
 +
The block provides statistical information on the responses from the slave that do not arrive on time. This is useful when debugging timeouts.
 +
{| class="wikitable"
 +
|in
 +
|Bus
 +
|string
 +
|path to bus device (BUS1 = "/dev/ttyS3" or BUS2 = "/dev/ttyS2")
 +
|-
 +
|out
 +
|TIMEOUT_CNT
 +
|UDINT
 +
|A counter of responses that do not arrive within the time limit.
 +
|-
 +
|out
 +
|FLUSH_CNT
 +
|UDINT
 +
|A counter of responses that arrive after a timeout.
 +
|-
 +
|out
 +
|DBG_TEXT
 +
|string[255]
 +
|String of the last flushed data.
 +
|}
 +
Example of usage:
 +
 
 +
[[File:Modbus rtu stats usage.jpg]]
 +
 
 +
===== MODBUS_RTU_R_COIL =====
 
Reads one coil register
 
Reads one coil register
 
{| class="wikitable"
 
{| class="wikitable"
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]]
+
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 
|-
 
|-
 
|in
 
|in
Line 77: Line 104:
 
|byte
 
|byte
 
|
 
|
|timeout in seconds
+
|timeout in seconds (default: 250ms)
 
|-
 
|-
 
|out
 
|out
Line 86: Line 113:
 
|}
 
|}
  
==== MODBUS_RTU_R_DISCRETE ====
+
===== MODBUS_RTU_R_COIL_8 =====
Read one discrete discrete input register
+
Reads up to 8 coil registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|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
 +
|Count
 +
|byte
 +
|
 +
|number of registers to read (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 250ms)
 +
|-
 +
|out
 +
|Q1
 +
|bool
 +
|
 +
|readed value of 1st register
 +
|-
 +
|out
 +
|Q2
 +
|bool
 +
|
 +
|readed value of 2nd register
 +
|-
 +
|out
 +
|Q3
 +
|bool
 +
|
 +
|readed value of 3rd register
 +
|-
 +
|out
 +
|Q4
 +
|bool
 +
|
 +
|readed value of 4th register
 +
|-
 +
|out
 +
|Q5
 +
|bool
 +
|
 +
|readed value of 5th register
 +
|-
 +
|out
 +
|Q6
 +
|bool
 +
|
 +
|readed value of 6th register
 +
|-
 +
|out
 +
|Q7
 +
|bool
 +
|
 +
|readed value of 7th register
 +
|-
 +
|out
 +
|Q8
 +
|bool
 +
|
 +
|readed value of 8th register
 +
|}
 +
 
 +
===== MODBUS_RTU_R_DISCRETE =====
 +
Read one discrete input register
 
{| class="wikitable"
 
{| class="wikitable"
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]]
+
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 
|-
 
|-
 
|in
 
|in
Line 113: Line 224:
 
|byte
 
|byte
 
|
 
|
|timeout in seconds
+
|timeout in seconds (default: 250ms)
 
|-
 
|-
 
|out
 
|out
Line 122: Line 233:
 
|}
 
|}
  
==== MODBUS_RTU_R_HOLDING ====
+
===== MODBUS_RTU_R_DISCRETE_8 =====
 +
Read up to 8 discrete input registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|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
 +
|Count
 +
|byte
 +
|
 +
|number of registers to read (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 250ms)
 +
|-
 +
|out
 +
|Q1
 +
|bool
 +
|
 +
|readed value of 1st register
 +
|-
 +
|out
 +
|Q2
 +
|bool
 +
|
 +
|readed value of 2nd register
 +
|-
 +
|out
 +
|Q3
 +
|bool
 +
|
 +
|readed value of 3rd register
 +
|-
 +
|out
 +
|Q4
 +
|bool
 +
|
 +
|readed value of 4th register
 +
|-
 +
|out
 +
|Q5
 +
|bool
 +
|
 +
|readed value of 5th register
 +
|-
 +
|out
 +
|Q6
 +
|bool
 +
|
 +
|readed value of 6th register
 +
|-
 +
|out
 +
|Q7
 +
|bool
 +
|
 +
|readed value of 7th register
 +
|-
 +
|out
 +
|Q8
 +
|bool
 +
|
 +
|readed value of 8th register
 +
|}
 +
 
 +
===== MODBUS_RTU_R_HOLDING =====
 
Reads one holding register
 
Reads one holding register
 
{| class="wikitable"
 
{| class="wikitable"
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]]
+
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 
|-
 
|-
 
|in
 
|in
Line 149: Line 344:
 
|byte
 
|byte
 
|
 
|
|timeout in seconds
+
|timeout in seconds (default: 250ms)
 
|-
 
|-
 
|out
 
|out
Line 158: Line 353:
 
|}
 
|}
  
==== MODBUS_RTU_R_INPUT ====
+
===== MODBUS_RTU_R_HOLDING_8 =====
 +
Reads up to 8 holding registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|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
 +
|Count
 +
|byte
 +
|
 +
|number of registers to read (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 250ms)
 +
|-
 +
|out
 +
|Q1
 +
|bool
 +
|
 +
|readed value of 1st register
 +
|-
 +
|out
 +
|Q2
 +
|bool
 +
|
 +
|readed value of 2nd register
 +
|-
 +
|out
 +
|Q3
 +
|bool
 +
|
 +
|readed value of 3rd register
 +
|-
 +
|out
 +
|Q4
 +
|bool
 +
|
 +
|readed value of 4th register
 +
|-
 +
|out
 +
|Q5
 +
|bool
 +
|
 +
|readed value of 5th register
 +
|-
 +
|out
 +
|Q6
 +
|bool
 +
|
 +
|readed value of 6th register
 +
|-
 +
|out
 +
|Q7
 +
|bool
 +
|
 +
|readed value of 7th register
 +
|-
 +
|out
 +
|Q8
 +
|bool
 +
|
 +
|readed value of 8th register
 +
|}
 +
 
 +
===== MODBUS_RTU_R2_HOLDING =====
 +
Reads two holding registers as 32bit number (lower register with higher weight)
 +
 
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|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 (default: 250ms)
 +
|-
 +
|out
 +
|Q
 +
|dword
 +
|
 +
|readed value
 +
|}
 +
 
 +
===== MODBUS_RTU_R_INPUT =====
 
Reads one input register
 
Reads one input register
 
{| class="wikitable"
 
{| class="wikitable"
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]]
+
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 
|-
 
|-
 
|in
 
|in
Line 185: Line 501:
 
|byte
 
|byte
 
|
 
|
|timeout in seconds
+
|timeout in seconds (default: 250ms)
 
|-
 
|-
 
|out
 
|out
Line 194: Line 510:
 
|}
 
|}
  
==== MODBUS_RTU_W_COIL ====
+
===== MODBUS_RTU_R_INPUT_8 =====
 +
Reads up to 8 input registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|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
 +
|Count
 +
|byte
 +
|
 +
|number of registers to read (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 250ms)
 +
|-
 +
|out
 +
|Q1
 +
|bool
 +
|
 +
|readed value of 1st register
 +
|-
 +
|out
 +
|Q2
 +
|bool
 +
|
 +
|readed value of 2nd register
 +
|-
 +
|out
 +
|Q3
 +
|bool
 +
|
 +
|readed value of 3rd register
 +
|-
 +
|out
 +
|Q4
 +
|bool
 +
|
 +
|readed value of 4th register
 +
|-
 +
|out
 +
|Q5
 +
|bool
 +
|
 +
|readed value of 5th register
 +
|-
 +
|out
 +
|Q6
 +
|bool
 +
|
 +
|readed value of 6th register
 +
|-
 +
|out
 +
|Q7
 +
|bool
 +
|
 +
|readed value of 7th register
 +
|-
 +
|out
 +
|Q8
 +
|bool
 +
|
 +
|readed value of 8th register
 +
|}
 +
 
 +
===== MODBUS_RTU_R2_INPUT =====
 +
Reads two input registers as 32bit number (lower register with higher weight)
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|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 (default: 250ms)
 +
|-
 +
|out
 +
|Q
 +
|dword
 +
|
 +
|readed value
 +
|}
 +
 
 +
===== MODBUS_RTU_W_COIL =====
 
Writes value to one coil register
 
Writes value to one coil register
 
{| class="wikitable"
 
{| class="wikitable"
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]]
+
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 
|-
 
|-
 
|in
 
|in
Line 221: Line 657:
 
|byte
 
|byte
 
|
 
|
|timeout in seconds
+
|timeout in seconds (default: 250ms)
 
|-
 
|-
 
|in
 
|in
Line 230: Line 666:
 
|}
 
|}
  
==== MODBUS_RTU_W_HOLDING ====
+
===== MODBUS_RTU_W_COIL_8 =====
 +
Writes value to up to 8 coil registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|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
 +
|Count
 +
|byte
 +
|
 +
|number of registers to write (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 250ms)
 +
|-
 +
|in
 +
|VAL1
 +
|bool
 +
|
 +
|value to write to 1st register
 +
|-
 +
|in
 +
|VAL2
 +
|bool
 +
|
 +
|value to write to 2nd register
 +
|-
 +
|in
 +
|VAL3
 +
|bool
 +
|
 +
|value to write to 3rd register
 +
|-
 +
|in
 +
|VAL4
 +
|bool
 +
|
 +
|value to write to 4th register
 +
|-
 +
|in
 +
|VAL5
 +
|bool
 +
|
 +
|value to write to 5th register
 +
|-
 +
|in
 +
|VAL6
 +
|bool
 +
|
 +
|value to write to 6th register
 +
|-
 +
|in
 +
|VAL7
 +
|bool
 +
|
 +
|value to write to 7th register
 +
|-
 +
|in
 +
|VAL8
 +
|bool
 +
|
 +
|value to write to 8th register
 +
|}
 +
 
 +
===== MODBUS_RTU_W_HOLDING =====
 
Writes value to one holding register
 
Writes value to one holding register
 
{| class="wikitable"
 
{| class="wikitable"
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]]
+
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 
|-
 
|-
 
|in
 
|in
Line 257: Line 777:
 
|byte
 
|byte
 
|
 
|
|timeout in seconds
+
|timeout in seconds (default: 250ms)
 
|-
 
|-
 
|in
 
|in
 
|VAL
 
|VAL
 
|word
 
|word
 +
|
 +
|value to write
 +
|}
 +
 +
===== MODBUS_RTU_W_HOLDING_8 =====
 +
Writes value to up to 8 holding registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|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
 +
|Count
 +
|byte
 +
|
 +
|number of registers to write (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 250ms)
 +
|-
 +
|in
 +
|VAL1
 +
|bool
 +
|
 +
|value to write to 1st register
 +
|-
 +
|in
 +
|VAL2
 +
|bool
 +
|
 +
|value to write to 2nd register
 +
|-
 +
|in
 +
|VAL3
 +
|bool
 +
|
 +
|value to write to 3rd register
 +
|-
 +
|in
 +
|VAL4
 +
|bool
 +
|
 +
|value to write to 4th register
 +
|-
 +
|in
 +
|VAL5
 +
|bool
 +
|
 +
|value to write to 5th register
 +
|-
 +
|in
 +
|VAL6
 +
|bool
 +
|
 +
|value to write to 6th register
 +
|-
 +
|in
 +
|VAL7
 +
|bool
 +
|
 +
|value to write to 7th register
 +
|-
 +
|in
 +
|VAL8
 +
|bool
 +
|
 +
|value to write to 8th register
 +
|}
 +
 +
===== MODBUS_RTU_W2_HOLDING =====
 +
Writes value to two holding registers (lower register with higher weight)
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|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 (default: 250ms)
 +
|-
 +
|in
 +
|VAL
 +
|dword
 +
|
 +
|value to write
 +
|}
 +
 +
==== TCP ====
 +
 +
===== MODBUS_TCP_R_COIL =====
 +
Reads one coil register
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q
 +
|bool
 +
|
 +
|readed value
 +
|}
 +
 +
===== MODBUS_TCP_R_COIL_8 =====
 +
Reads up to 8 coil registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Count
 +
|byte
 +
|
 +
|number of registers to read (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q1
 +
|bool
 +
|
 +
|readed value of 1st register
 +
|-
 +
|out
 +
|Q2
 +
|bool
 +
|
 +
|readed value of 2nd register
 +
|-
 +
|out
 +
|Q3
 +
|bool
 +
|
 +
|readed value of 3rd register
 +
|-
 +
|out
 +
|Q4
 +
|bool
 +
|
 +
|readed value of 4th register
 +
|-
 +
|out
 +
|Q5
 +
|bool
 +
|
 +
|readed value of 5th register
 +
|-
 +
|out
 +
|Q6
 +
|bool
 +
|
 +
|readed value of 6th register
 +
|-
 +
|out
 +
|Q7
 +
|bool
 +
|
 +
|readed value of 7th register
 +
|-
 +
|out
 +
|Q8
 +
|bool
 +
|
 +
|readed value of 8th register
 +
|}
 +
 +
===== MODBUS_TCP_R_DISCRETE =====
 +
Read one discrete input register
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q
 +
|bool
 +
|
 +
|readed value
 +
|}
 +
 +
===== MODBUS_TCP_R_DISCRETE_8 =====
 +
Read up to 8 discrete input registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Count
 +
|byte
 +
|
 +
|number of registers to read (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q1
 +
|bool
 +
|
 +
|readed value of 1st register
 +
|-
 +
|out
 +
|Q2
 +
|bool
 +
|
 +
|readed value of 2nd register
 +
|-
 +
|out
 +
|Q3
 +
|bool
 +
|
 +
|readed value of 3rd register
 +
|-
 +
|out
 +
|Q4
 +
|bool
 +
|
 +
|readed value of 4th register
 +
|-
 +
|out
 +
|Q5
 +
|bool
 +
|
 +
|readed value of 5th register
 +
|-
 +
|out
 +
|Q6
 +
|bool
 +
|
 +
|readed value of 6th register
 +
|-
 +
|out
 +
|Q7
 +
|bool
 +
|
 +
|readed value of 7th register
 +
|-
 +
|out
 +
|Q8
 +
|bool
 +
|
 +
|readed value of 8th register
 +
|}
 +
 +
===== MODBUS_TCP_R_HOLDING =====
 +
Reads one holding register
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q
 +
|word
 +
|
 +
|readed value
 +
|}
 +
===== MODBUS_TCP_R_HOLDING_8 =====
 +
Reads up to 8 holding registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Count
 +
|byte
 +
|
 +
|number of registers to read (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q1
 +
|bool
 +
|
 +
|readed value of 1st register
 +
|-
 +
|out
 +
|Q2
 +
|bool
 +
|
 +
|readed value of 2nd register
 +
|-
 +
|out
 +
|Q3
 +
|bool
 +
|
 +
|readed value of 3rd register
 +
|-
 +
|out
 +
|Q4
 +
|bool
 +
|
 +
|readed value of 4th register
 +
|-
 +
|out
 +
|Q5
 +
|bool
 +
|
 +
|readed value of 5th register
 +
|-
 +
|out
 +
|Q6
 +
|bool
 +
|
 +
|readed value of 6th register
 +
|-
 +
|out
 +
|Q7
 +
|bool
 +
|
 +
|readed value of 7th register
 +
|-
 +
|out
 +
|Q8
 +
|bool
 +
|
 +
|readed value of 8th register
 +
|}
 +
===== MODBUS_TCP_R2_HOLDING =====
 +
Reads two holding registers (lower register with higher weight)
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q
 +
|dword
 +
|
 +
|readed value
 +
|}
 +
===== MODBUS_TCP_R_INPUT =====
 +
Reads one input register
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q
 +
|word
 +
|
 +
|readed value
 +
|}
 +
===== MODBUS_TCP_R_INPUT_8 =====
 +
Reads up to 8 input registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Count
 +
|byte
 +
|
 +
|number of registers to read (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q1
 +
|bool
 +
|
 +
|readed value of 1st register
 +
|-
 +
|out
 +
|Q2
 +
|bool
 +
|
 +
|readed value of 2nd register
 +
|-
 +
|out
 +
|Q3
 +
|bool
 +
|
 +
|readed value of 3rd register
 +
|-
 +
|out
 +
|Q4
 +
|bool
 +
|
 +
|readed value of 4th register
 +
|-
 +
|out
 +
|Q5
 +
|bool
 +
|
 +
|readed value of 5th register
 +
|-
 +
|out
 +
|Q6
 +
|bool
 +
|
 +
|readed value of 6th register
 +
|-
 +
|out
 +
|Q7
 +
|bool
 +
|
 +
|readed value of 7th register
 +
|-
 +
|out
 +
|Q8
 +
|bool
 +
|
 +
|readed value of 8th register
 +
|}
 +
===== MODBUS_TCP_R2_INPUT =====
 +
Reads two input registers (lower register with higher weight)
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|out
 +
|Q
 +
|dword
 +
|
 +
|readed value
 +
|}
 +
===== MODBUS_TCP_W_COIL =====
 +
Writes value to one coil register
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|in
 +
|VAL
 +
|bool
 +
|
 +
|value to write
 +
|}
 +
===== MODBUS_TCP_W_COIL_8 =====
 +
Writes value to up to 8 coil registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Count
 +
|byte
 +
|
 +
|number of registers to write (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|in
 +
|VAL1
 +
|bool
 +
|
 +
|value to write to 1st register
 +
|-
 +
|in
 +
|VAL2
 +
|bool
 +
|
 +
|value to write to 2nd register
 +
|-
 +
|in
 +
|VAL3
 +
|bool
 +
|
 +
|value to write to 3rd register
 +
|-
 +
|in
 +
|VAL4
 +
|bool
 +
|
 +
|value to write to 4th register
 +
|-
 +
|in
 +
|VAL5
 +
|bool
 +
|
 +
|value to write to 5th register
 +
|-
 +
|in
 +
|VAL6
 +
|bool
 +
|
 +
|value to write to 6th register
 +
|-
 +
|in
 +
|VAL7
 +
|bool
 +
|
 +
|value to write to 7th register
 +
|-
 +
|in
 +
|VAL8
 +
|bool
 +
|
 +
|value to write to 8th register
 +
|}
 +
===== MODBUS_TCP_W_HOLDING =====
 +
Writes value to one holding register
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|in
 +
|VAL
 +
|word
 +
|
 +
|value to write
 +
|}
 +
===== MODBUS_TCP_W_HOLDING_8 =====
 +
Writes value to up to 8 holding registers
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Count
 +
|byte
 +
|
 +
|number of registers to write (1-8)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|in
 +
|VAL1
 +
|bool
 +
|
 +
|value to write to 1st register
 +
|-
 +
|in
 +
|VAL2
 +
|bool
 +
|
 +
|value to write to 2nd register
 +
|-
 +
|in
 +
|VAL3
 +
|bool
 +
|
 +
|value to write to 3rd register
 +
|-
 +
|in
 +
|VAL4
 +
|bool
 +
|
 +
|value to write to 4th register
 +
|-
 +
|in
 +
|VAL5
 +
|bool
 +
|
 +
|value to write to 5th register
 +
|-
 +
|in
 +
|VAL6
 +
|bool
 +
|
 +
|value to write to 6th register
 +
|-
 +
|in
 +
|VAL7
 +
|bool
 +
|
 +
|value to write to 7th register
 +
|-
 +
|in
 +
|VAL8
 +
|bool
 +
|
 +
|value to write to 8th register
 +
|}
 +
 +
===== MODBUS_TCP_W2_HOLDING =====
 +
Writes value to two holding registers (lower register with higher weight)
 +
{| class="wikitable"
 +
| colspan="5" |[[#Asynchronous operations|Asynchronous interface]] - internal implementation
 +
|-
 +
|in
 +
|IP
 +
|string
 +
|
 +
|IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
 +
|-
 +
|in
 +
|Port
 +
|int
 +
|
 +
|TCP port of slave device (default: 502)
 +
|-
 +
|in
 +
|UnitID
 +
|byte
 +
|
 +
|Device bus address (default: 1)
 +
|-
 +
|in
 +
|OfsAdr
 +
|word
 +
|
 +
|register address (1-9999)
 +
|-
 +
|in
 +
|Timeout
 +
|byte
 +
|
 +
|timeout in seconds (default: 1s)
 +
|-
 +
|in
 +
|VAL
 +
|dword
 
|
 
|
 
|value to write
 
|value to write
 
|}
 
|}

Latest revision as of 04:49, 16 July 2025

Master MODE

RTU

MODBUS_RTU_CFG

Set bus parameters

in Bus string path to bus device (BUS1 = "/dev/ttyS3" or BUS2 = "/dev/ttyS2")
in Baud int standard baudrates from 150 to 115200 (allowed speeds: 150, 300, 600, 1200, 1800, 2400, 4800, 7200, 9600, 14400, 19200, 38400, 57600, 115200, 1000000)
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
MODBUS_RTU_STATS

The block provides statistical information on the responses from the slave that do not arrive on time. This is useful when debugging timeouts.

in Bus string path to bus device (BUS1 = "/dev/ttyS3" or BUS2 = "/dev/ttyS2")
out TIMEOUT_CNT UDINT A counter of responses that do not arrive within the time limit.
out FLUSH_CNT UDINT A counter of responses that arrive after a timeout.
out DBG_TEXT string[255] String of the last flushed data.

Example of usage:

Modbus rtu stats usage.jpg

MODBUS_RTU_R_COIL

Reads one coil register

Asynchronous interface - internal implementation
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 (default: 250ms)
out Q bool readed value
MODBUS_RTU_R_COIL_8

Reads up to 8 coil registers

Asynchronous interface - internal implementation
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 Count byte number of registers to read (1-8)
in Timeout byte timeout in seconds (default: 250ms)
out Q1 bool readed value of 1st register
out Q2 bool readed value of 2nd register
out Q3 bool readed value of 3rd register
out Q4 bool readed value of 4th register
out Q5 bool readed value of 5th register
out Q6 bool readed value of 6th register
out Q7 bool readed value of 7th register
out Q8 bool readed value of 8th register
MODBUS_RTU_R_DISCRETE

Read one discrete input register

Asynchronous interface - internal implementation
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 (default: 250ms)
out Q bool readed value
MODBUS_RTU_R_DISCRETE_8

Read up to 8 discrete input registers

Asynchronous interface - internal implementation
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 Count byte number of registers to read (1-8)
in Timeout byte timeout in seconds (default: 250ms)
out Q1 bool readed value of 1st register
out Q2 bool readed value of 2nd register
out Q3 bool readed value of 3rd register
out Q4 bool readed value of 4th register
out Q5 bool readed value of 5th register
out Q6 bool readed value of 6th register
out Q7 bool readed value of 7th register
out Q8 bool readed value of 8th register
MODBUS_RTU_R_HOLDING

Reads one holding register

Asynchronous interface - internal implementation
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 (default: 250ms)
out Q word readed value
MODBUS_RTU_R_HOLDING_8

Reads up to 8 holding registers

Asynchronous interface - internal implementation
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 Count byte number of registers to read (1-8)
in Timeout byte timeout in seconds (default: 250ms)
out Q1 bool readed value of 1st register
out Q2 bool readed value of 2nd register
out Q3 bool readed value of 3rd register
out Q4 bool readed value of 4th register
out Q5 bool readed value of 5th register
out Q6 bool readed value of 6th register
out Q7 bool readed value of 7th register
out Q8 bool readed value of 8th register
MODBUS_RTU_R2_HOLDING

Reads two holding registers as 32bit number (lower register with higher weight)

Asynchronous interface - internal implementation
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 (default: 250ms)
out Q dword readed value
MODBUS_RTU_R_INPUT

Reads one input register

Asynchronous interface - internal implementation
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 (default: 250ms)
out Q word readed value
MODBUS_RTU_R_INPUT_8

Reads up to 8 input registers

Asynchronous interface - internal implementation
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 Count byte number of registers to read (1-8)
in Timeout byte timeout in seconds (default: 250ms)
out Q1 bool readed value of 1st register
out Q2 bool readed value of 2nd register
out Q3 bool readed value of 3rd register
out Q4 bool readed value of 4th register
out Q5 bool readed value of 5th register
out Q6 bool readed value of 6th register
out Q7 bool readed value of 7th register
out Q8 bool readed value of 8th register
MODBUS_RTU_R2_INPUT

Reads two input registers as 32bit number (lower register with higher weight)

Asynchronous interface - internal implementation
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 (default: 250ms)
out Q dword readed value
MODBUS_RTU_W_COIL

Writes value to one coil register

Asynchronous interface - internal implementation
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 (default: 250ms)
in VAL bool value to write
MODBUS_RTU_W_COIL_8

Writes value to up to 8 coil registers

Asynchronous interface - internal implementation
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 Count byte number of registers to write (1-8)
in Timeout byte timeout in seconds (default: 250ms)
in VAL1 bool value to write to 1st register
in VAL2 bool value to write to 2nd register
in VAL3 bool value to write to 3rd register
in VAL4 bool value to write to 4th register
in VAL5 bool value to write to 5th register
in VAL6 bool value to write to 6th register
in VAL7 bool value to write to 7th register
in VAL8 bool value to write to 8th register
MODBUS_RTU_W_HOLDING

Writes value to one holding register

Asynchronous interface - internal implementation
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 (default: 250ms)
in VAL word value to write
MODBUS_RTU_W_HOLDING_8

Writes value to up to 8 holding registers

Asynchronous interface - internal implementation
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 Count byte number of registers to write (1-8)
in Timeout byte timeout in seconds (default: 250ms)
in VAL1 bool value to write to 1st register
in VAL2 bool value to write to 2nd register
in VAL3 bool value to write to 3rd register
in VAL4 bool value to write to 4th register
in VAL5 bool value to write to 5th register
in VAL6 bool value to write to 6th register
in VAL7 bool value to write to 7th register
in VAL8 bool value to write to 8th register
MODBUS_RTU_W2_HOLDING

Writes value to two holding registers (lower register with higher weight)

Asynchronous interface - internal implementation
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 (default: 250ms)
in VAL dword value to write

TCP

MODBUS_TCP_R_COIL

Reads one coil register

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Timeout byte timeout in seconds (default: 1s)
out Q bool readed value
MODBUS_TCP_R_COIL_8

Reads up to 8 coil registers

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Count byte number of registers to read (1-8)
in Timeout byte timeout in seconds (default: 1s)
out Q1 bool readed value of 1st register
out Q2 bool readed value of 2nd register
out Q3 bool readed value of 3rd register
out Q4 bool readed value of 4th register
out Q5 bool readed value of 5th register
out Q6 bool readed value of 6th register
out Q7 bool readed value of 7th register
out Q8 bool readed value of 8th register
MODBUS_TCP_R_DISCRETE

Read one discrete input register

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Timeout byte timeout in seconds (default: 1s)
out Q bool readed value
MODBUS_TCP_R_DISCRETE_8

Read up to 8 discrete input registers

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Count byte number of registers to read (1-8)
in Timeout byte timeout in seconds (default: 1s)
out Q1 bool readed value of 1st register
out Q2 bool readed value of 2nd register
out Q3 bool readed value of 3rd register
out Q4 bool readed value of 4th register
out Q5 bool readed value of 5th register
out Q6 bool readed value of 6th register
out Q7 bool readed value of 7th register
out Q8 bool readed value of 8th register
MODBUS_TCP_R_HOLDING

Reads one holding register

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Timeout byte timeout in seconds (default: 1s)
out Q word readed value
MODBUS_TCP_R_HOLDING_8

Reads up to 8 holding registers

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Count byte number of registers to read (1-8)
in Timeout byte timeout in seconds (default: 1s)
out Q1 bool readed value of 1st register
out Q2 bool readed value of 2nd register
out Q3 bool readed value of 3rd register
out Q4 bool readed value of 4th register
out Q5 bool readed value of 5th register
out Q6 bool readed value of 6th register
out Q7 bool readed value of 7th register
out Q8 bool readed value of 8th register
MODBUS_TCP_R2_HOLDING

Reads two holding registers (lower register with higher weight)

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Timeout byte timeout in seconds (default: 1s)
out Q dword readed value
MODBUS_TCP_R_INPUT

Reads one input register

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Timeout byte timeout in seconds (default: 1s)
out Q word readed value
MODBUS_TCP_R_INPUT_8

Reads up to 8 input registers

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Count byte number of registers to read (1-8)
in Timeout byte timeout in seconds (default: 1s)
out Q1 bool readed value of 1st register
out Q2 bool readed value of 2nd register
out Q3 bool readed value of 3rd register
out Q4 bool readed value of 4th register
out Q5 bool readed value of 5th register
out Q6 bool readed value of 6th register
out Q7 bool readed value of 7th register
out Q8 bool readed value of 8th register
MODBUS_TCP_R2_INPUT

Reads two input registers (lower register with higher weight)

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Timeout byte timeout in seconds (default: 1s)
out Q dword readed value
MODBUS_TCP_W_COIL

Writes value to one coil register

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Timeout byte timeout in seconds (default: 1s)
in VAL bool value to write
MODBUS_TCP_W_COIL_8

Writes value to up to 8 coil registers

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Count byte number of registers to write (1-8)
in Timeout byte timeout in seconds (default: 1s)
in VAL1 bool value to write to 1st register
in VAL2 bool value to write to 2nd register
in VAL3 bool value to write to 3rd register
in VAL4 bool value to write to 4th register
in VAL5 bool value to write to 5th register
in VAL6 bool value to write to 6th register
in VAL7 bool value to write to 7th register
in VAL8 bool value to write to 8th register
MODBUS_TCP_W_HOLDING

Writes value to one holding register

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Timeout byte timeout in seconds (default: 1s)
in VAL word value to write
MODBUS_TCP_W_HOLDING_8

Writes value to up to 8 holding registers

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Count byte number of registers to write (1-8)
in Timeout byte timeout in seconds (default: 1s)
in VAL1 bool value to write to 1st register
in VAL2 bool value to write to 2nd register
in VAL3 bool value to write to 3rd register
in VAL4 bool value to write to 4th register
in VAL5 bool value to write to 5th register
in VAL6 bool value to write to 6th register
in VAL7 bool value to write to 7th register
in VAL8 bool value to write to 8th register
MODBUS_TCP_W2_HOLDING

Writes value to two holding registers (lower register with higher weight)

Asynchronous interface - internal implementation
in IP string IP address of slave device (syntax: "aaa.bbb.ccc.ddd")
in Port int TCP port of slave device (default: 502)
in UnitID byte Device bus address (default: 1)
in OfsAdr word register address (1-9999)
in Timeout byte timeout in seconds (default: 1s)
in VAL dword value to write