Function blocks
TX1200
10
Version: 1.0
Sample of calling the function block in FBD:
PROGRAM MAIN
VAR
fbModbusOpen : FB_ModbusTcpOpen;
bOpen : BOOL;
bBusy : BOOL;
bError : BOOL;
nErrId : WORD;
nConnectionPort: WORD;
END_VAR
In this sample, a rising edge at the
bOpen
input causes a TCP/IP connection to the remote partner with
network address '172.16.2.209' to be established.
Requirements
Development environment
Target platform
PLC libraries to include
TwinCAT v2.7.0 and below
BC9xxx (165) firmware version >=
0xB6
TcModbusTCPBC.Lb6
3.2
FB_ModbusTcpClose
The FB_ModbusTcpClose function block closes a connection to a remote partner that was opened with the
function block. The number of IP connections that may be open is restricted to
four, in order to maintain the use of resources at a minimum. If it is necessary to establish a further
connection, a connection that is not currently in use must first be closed. A connection is automatically
closed after about 10 seconds if it is not used during that period. A confirmation from the remote partner is
not expected when a connection is closed. This means that under certain circumstances (e.g., if network
communication has been interrupted) it can happen that a connection still exists. The remote partner should
then close any such open connections. A Bus Controller operating as a remote partner closes such open
connections automatically.
VAR_INPUT
VAR_INPUT
bStart : BOOL;
sRemoteIPAddr: STRING(15);
iMyPortNo : WORD;
END_VAR
bStart
: the function block is activated by a rising edge at this input.
sRemoteIPAddr
: this variable is a string containing the network address (IP address) of the remote partner
whose connection is to be closed.
Содержание TX1200
Страница 1: ...Manual EN TX1200 TwinCAT 2 PLC Library TcModbusTCPBC 2022 05 02 Version 1 0...
Страница 2: ......
Страница 4: ...Table of contents TX1200 4 Version 1 0...
Страница 15: ......