Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Page 1 of 10
The send job is executed when a rising edge is detected at the REQ parameter. With the LEN parameter, you specify the
maximum number of bytes sent with a send job. When sending data (rising edge at the REQ parameter), the CONT
parameter must have the value "1" in order to establish or maintain a connection. The data to be sent must not be edited
until the send job is completed. If the send job executes successfully, the DONE parameter is set to "1". Signal state "1"
at the DONE parameter is not confirmation that the data sent has already been read by the communications partner.
TSEND_C is executed again when the COM_RST parameter is set to "1". This terminates the existing communications
connection and a new connection is established. If data is being transferred when it executes again, this can lead to a loss of
data.
To enable "TSEND_C" again after the execution (DONE = 1), call the instruction once with REQ = 0.
Parameter
The following table shows the parameters of the "TSEND_C" instruction:
Parameter
Declaration
Data type
Memory area
Description
REQ
Input
BOOL
I, Q, M, D, L
CONT
Input
BOOL
I, Q, M, D, L
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
01/11/2016
Page 2 of 10
connection
Input
UINT
I, Q, M, D, L or
constant
CONNECT
InOut
TCON_Param
DATA
InOut
VARIANT
I, Q, M, D, L
COM_RST
InOut
BOOL
I, Q, M, D, L
DONE
BUSY
ERROR
STATUS
Output
Output
Output
Output
BOOL
BOOL
BOOL
WORD
I, Q, M, D, L
I, Q, M, D, L
I, Q, M, D, L
I, Q, M, D, L
0: Irrelevant
0: No error
1: Error occurred
You will find more detailed information on valid data types in "Overview of the valid data types".
Parameters BUSY, DONE, and ERROR
You can check the status of the execution with the BUSY, DONE, ERROR, and STATUS parameters. The BUSY parameter
indicates the processing status. With the DONE parameter, you can check whether or not a job executed successfully. The
ERROR parameter is set when errors occurred during execution of "TSEND_C". The error information is output at the
STATUS parameter.
The following table shows the relationship between the BUSY, DONE, and ERROR parameters:
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
01/11/2016
Page 3 of 10
BUSY
DONE
ERROR
Description
The job ended with an error. The cause of the error is specified in the STATUS
parameter.
STATUS*
Description
(W#16#...)
0
0000
7000
7001
Establish connection
7002
7003
Connection is terminated
7004
80A0
80A1
Communication error:
The specified connection is being terminated. Transfer via this connection is not
possible.
80A2
80A3
80A4
IP address of the remote endpoint of the connection is invalid, which means it corresponds to
the IP address of the local partner.
80A7
Communication error: You called the instruction with COM_RST = 1 before the send job was
complete.
80B2
The CONNECT parameter points to a data block that was generated with the attribute "Only
store in load memory".
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
01/11/2016
Page 4 of 10
80B3
Inconsistent parameter assignment: Group error for error codes 80A0 to 80A2, 80A4, 80B4
to 80B9.
80B4
You have violated one or both of the following conditions for passive connection
establishment (active_est = FALSE) when using the ISO-on-TCP protocol variant
(connection_type = B#16#12): "local_tsap_id_len >= B#16#02", and/or "local_tsap_id[1] =
B#16#E0".
80B5
80B6
Parameter assignment error in the connection_type parameter of the data block for
connection description.
80B7
Error in one of the following parameters of the data block for connection description:
block_length, local_tsap_id_len, rem_subnet_id_len, rem_staddr_len, rem_tsap_id_len,
next_staddr_len.
8085
8086
The ID parameter within the CONNECT parameter is outside the permitted range.
8087
8088
The value at the LEN parameter does not correspond to the receive area set at the DATA
parameter.
8089
8091
809A
The CONNECT parameter points to a field that does not correspond to the length of the
connection description.
809B
The ID of the local device in the connection description does not correspond to the CPU.
80C3
80C4
8722
CONNECT parameter: The source area is invalid. The area does not exist in the DB.
873A
CONNECT parameter: Access to the connection description is not possible (for example, DB
does not exist).
877F
8822
DATA parameter: Invalid source area, the area does not exist in the DB.
8824
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
01/11/2016
Page 5 of 10
8832
883A
CONNECT parameter: Access to specified connection data not possible (e.g. because the
DB does not exist).
887F
893A
DATA parameter: Access to send area not possible (e.g. because the DB does not exist).
* The error codes can be displayed as integer or hexadecimal values in the program editor. For additional information on
toggling display formats, refer to "See also".
Note
Error messages of the instructions "TCON", "TSEND" and "TDISCON"
Internally, the TRV_C instruction uses the "TCON", "TSEND" and "TDISCON" instructions. The error messages of these
instructions are contained in the respective descriptions.
TCP / UDP: Connection description via the structure TCON_IP_v4 at the parameter CONNECT
ISO-on-TCP: Connection description via the structure TCON_IP_RFC at the parameter CONNECT
ISO: Connection description via the structure TCON_ISOnative at the parameter CONNECT (only for CP1543-1)
FDL: Connection description via the structure TCON_FDL at the parameter CONNECT (only for CM1542-5)
An existing connection is terminated and the connection which has been set up is removed when the CPU goes into
STOP mode. To set up and establish the connection again, you must execute "TSEND_C" again. For information on the
number of possible communication connections, please refer to the technical specifications for your CPU.
2.
3.
If the send job executes successfully, the DONE parameter is set to "1". The communications connection may be terminated
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
01/11/2016
Page 6 of 10
before this (see the above description of the dependency on the CONT parameter). Signal state "1" at the DONE parameter
is not confirmation that the data sent has already been read by the communications partner.
TSEND_C is reset when the COM_RST parameter is set to "1". Data loss may occur if data is being transferred at this point.
The following scenarios are possible depending on the CONT parameter:
CONT = "0":
An existing communications connection is established.
The COM_RST parameter is reset following evaluation by the instruction "T_SEND". To enable "TSEND_C" again after the
execution (DONE = 1), call the instruction once with REQ = 0.
Parameters
The following table shows the parameters of the "TSEND_C" instruction:
Parameter
Declaration
Data type
Memory area
Description
REQ
Input
BOOL
I, Q, M, D, L, T,
C or constant
CONT
Input
BOOL
I, Q, M, D, L
CONNECT
Input
InOut
UDINT
VARIANT
I, Q, M, D, L or
constant
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
01/11/2016
Page 7 of 10
InOut
VARIANT
I, Q, M, D, L
ADDR
InOut
VARIANT
COM_RST
InOut
BOOL
I, Q, M, D, L
0: Irrelevant
BUSY
ERROR
Output
Output
Output
BOOL
BOOL
BOOL
I, Q, M, D, L
I, Q, M, D, L
I, Q, M, D, L
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
0: No error
01/11/2016
Page 8 of 10
STATUS
Output
WORD
I, Q, M, D, L
You will find more detailed information on valid data types in "Overview of the valid data types".
Parameters BUSY, DONE, and ERROR
You can check the status of the execution with the BUSY, DONE, ERROR, and STATUS parameters. The BUSY parameter
indicates the processing status. With the DONE parameter, you can check whether or not a send job executed successfully.
The ERROR parameter is set when errors occurred during execution of "TSEND_C". The error information is output at the
STATUS parameter.
The following table shows the relationship between the BUSY, DONE, and ERROR parameters:
BUSY
DONE
ERROR
Description
The connection establishment or the send job was completed with an error. The cause
of the error is specified in the STATUS parameter.
STATUS*
Description
(W#16#...)
0
0000
7000
7001
Establish connection.
7002
7003
7004
7005
80A0
80A1
Communication error:
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
01/11/2016
Page 9 of 10
80A2
80A3
80A4
IP address of the remote endpoint of the connection is invalid, which means it corresponds to
the IP address of the local partner.
80A7
Communication error: You called the instruction with COM_RST = 1 before the send job was
complete.
80B2
The CONNECT parameter points to a data block that was generated with the attribute "Only
store in load memory".
80B3
Inconsistent parameter assignment: Group error for error codes 80A0 to 80A2, 80A4, 80B4
to 80B9.
80B4
You have violated one or both of the following conditions for passive connection
establishment (active_est = FALSE) when using the ISO-on-TCP protocol variant
(connection_type = B#16#12):
local_tsap_id[1] = B#16#E0
80B5
80B6
Parameter assignment error in the connection_type parameter of the data block for
connection description.
80B7
Error in one of the following parameters of the data block for connection description:
block_length, local_tsap_id_len, rem_subnet_id_len, rem_staddr_len, rem_tsap_id_len,
next_staddr_len.
8085
8086
The ID parameter within the CONNECT parameter is outside the permitted range.
8087
8088
The value at the LEN parameter does not correspond to the receive area set at the DATA
parameter.
8089
8091
809A
The CONNECT parameter points to a field that does not correspond to the length of the
connection description.
809B
The ID of the local device in the connection description does not correspond to the CPU.
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
01/11/2016
80C3
80C4
Page 10 of 10
8722
CONNECT parameter: The source area is invalid. The area does not exist in the DB.
873A
CONNECT parameter: Access to the connection description is not possible (for example,
because DB does not exist).
877F
8822
DATA parameter: Invalid source area, the area does not exist in the DB.
8824
8832
883A
CONNECT parameter: Access to specified connection data not possible (e.g. because the
DB does not exist).
887F
893A
DATA parameter: Access to send area not possible (e.g. because the DB does not exist).
* The error codes can be displayed as integer or hexadecimal values in the program editor. For additional information on
toggling display formats, refer to "See also".
Note
Error messages of the instructions "TCON", "TSEND" and "TDISCON"
Internally, the TRV_C instruction uses the "TCON", "TSEND" and "TDISCON" instructions. The error messages of these
instructions are contained in the respective descriptions.
file://C:\Users\TOP\AppData\Local\Temp\~hh5203.htm
01/11/2016