Please enable JavaScript to view this site.

Function used to connect the Modbus client to the specified Modbus TCP server and configure the initial index for Modbus registers.

Syntax

i32 mbc_connect (i32 mbc, const char* ipAddr, i32 port [, i32 baseIdx=-1])

mbc

Handle Modbus returned by the previous function mbc_init()

ipAddr

IP address of the server to connect to

port

TCP port to be used for the connection. Typically 502

baseIdx

Parameter to determine how to handle the initial entity index. (optional, default -1)

Value

Meaning

< 0

Sys_cfg.5 is used to determine how to handle the initial entity index

0

The initial entity index is 0 (non-standard)

> 0

The initial entity index is 1 (standard)

Result

Returns:

Value

Meaning

> 0

Connection with server enabled

-1

Illegal arguments

-2

Client already connected to a server

Validity

Task

System Requirements

From RTE 34.30.0

Note


 

  

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