Please enable JavaScript to view this site.

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.

Value

Meaning

> 0

Reference MBC code

-1

Illegal IP address

-2

Illegal port number

-3

Unable to create client

Validity

Task

Note

The function is blocking. It exits only when the operation is completed

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC