Program instructions 
  7.3 Communication 
S7-200 SMART 
System Manual, V2.3, 07/2017, A5E03822230-AF 
219 
You use the TCON instruction to set up and establish a communication connection. Once 
the CPU establishes the connection, it is automatically maintained and monitored by the 
CPU. The TCON instruction has only one parameter which is the address of the TCON table. 
The TCON table contains the connection parameters. There are two formats for the TCON 
table based upon the protocol selected for the connection. UDP and TCP share a common 
table format. ISO-on-TCP has a special TCON table format. Refer to the TCON instruction 
tables below for further information. 
Set the REQ bit in the table to TRUE to initiate a connection. The CPU ignores the REQ bit 
while the TCON instruction is active and the connection is initializing and the Active bit is 
TRUE. The TCON instruction set the Done bit when the CPU has established the 
connection. The Error bit is set if there is a problem with the connection parameters or if the 
CPU cannot establish a connection to the remote device. The Error Code describes the 
reason for the connection failure if the Error bit is set. 
The TCON instruction is asynchronous and can take several scans to complete. The Active 
bit will be set while the connection operation is pending. 
The TCON instruction creates either an active (client) connection or a passive (server) 
connection. The CPU initiates contact with the remote devices for an active connection. 
Passive connections cause the CPU to wait on the remote device to contact the CPU. 
You can use the TCON instruction to determine the current status of a connection. If your 
program calls the TCON instruction with the REQ bit set to FALSE, the CPU reports the 
status of the connection:  
●  The instruction sets the Done bit (without Error) if the CPU establishes the connection 
and the connection is operational. 
●  The instruction sets the Active bit if the connection is still in the process of being 
connected. 
●  The instruction sets the Done and Error bits if no connection can be established. The 
Error Code gives the reason for the connection failure. 
The REQ bit in the table is level-triggered. It is recommended that you put a positive edge 
trigger on the REQ input to initiate a connection so that the CPU only requests the 
connection establishment one time. 
During the connection process (the call to the TCON instruction), your program assigns a 
Connection ID to the given connection. The Connection ID is a user-selected, 16-bit value 
passed into the TCON instruction. The Connection ID can be any number 0 to 65534 
inclusive. The CPU does not allow the Connection ID to be 65535 (0xFFFF). The Connection 
ID value is an input to all of the OUC instructions to identify the connection to be utilized for 
the given operation. 
You can select your own Connection ID, allowing you to use a number that is logical for your 
situation. For example, you can use part of your IP address as your connection ID. You can 
name your connection to IP address 192.168.2.10, connection ID 10. 
Note that the S7-200 SMART does not automatically attempt to reconnect to a device after 
the connection has been closed. After a connection has been disconnected, your program 
must execute another TCON instruction to reconnect the device. This is true for both active 
and passive connections.