Function used for opening a MODBUS/TCP client-type communication.
Syntax |
i32 mbc_init (string strIp, i32 nPort, real timeout, real expTime, i32 buffDim [, i32 initCode<0]) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
strIp |
String with target IP address |
||||||||||
nPort |
Target port number |
||||||||||
timeout |
Timeout in seconds on command execution |
||||||||||
expTime |
Minimum guaranteed time, in seconds, that the response remains in the buffer before being discarded to make place for new messages if the modbus message handling buffer is full |
||||||||||
buffDim |
Size of the modbus message management buffer. Represents the maximum number of commands (modbus read/write functions) that can be used simultaneously |
||||||||||
initCode |
Indicates the initial index of units: •<0, the sys_cfg.5 bit is used to determine the initial index of units •0, the initial index of units is 0 (nonstandard value) regardless of the status of sys_cfg.5 •>0, the initial index of units is 1 (standard value) regardless of the state of sys_cfg.5 (optional, default <0) |
||||||||||
Result |
Returns the communication management handle that uniquely identifies the communication. It is used in all other modbus management functions.
|
||||||||||
Validity |
Task |
||||||||||
Note |
The function is blocking. It exits only when the operation is completed |
Example of use: |