Siemens SIMATIC S7 System Manual page 223

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

TSEND
You use the TSEND instruction to send data over an existing communication connection.
The TSEND table contains the connection parameters. There are two formats for the TSEND
table based upon the protocol selected for the connection. TCP and ISO-on-TCP share a
common table format. UDP has a special TSEND table format. Refer to the TSEND and
TRECV instruction tables below for further information.
The TSEND instruction initiates sending the specified number of bytes when your program
calls the TSEND instruction with the REQ bit set and the connection is not currently busy
with some other operation.
The REQ bit is level-triggered. It is recommended that you put a positive edge trigger on the
REQ input so that the CPU does not initiate unintended send operations. The CPU ignores
the REQ bit while the TSEND is Active. The status bits and error code show the status of the
TSEND for each call:
● Done without Error means the TSEND instruction completed with no errors.
● Active means that the TSEND instruction is still busy.
● Done with Error means there is a problem with the TSEND instruction. The Error Code
contains the reason for the failure.
The Done/Active/Error status is shown for one call of the TSEND instruction after the send
operation is complete. After that, the TSEND instruction responds with error code 24, which
means no operation pending, if your program calls the instruction with REQ set to FALSE. If
the REQ bit remains set, the TSEND instruction initiates another send operation.
The maximum amount of data that you can send in one message is 1024 bytes. Only one
TSEND instruction can be active at a time on a given connection. The program copies the
data from your send buffer in user memory to an internal buffer when the TSEND instruction
executes with REQ set, so you can change your send buffer after the TSEND instruction
executes.
TRECV
You use the TRECV instruction to retrieve data that the CPU has received over an existing
communication connection. You assign the receive area/buffer and the maximum length of
the receive area so that there is no possibility of a buffer overrun. The TRECV table contains
the parameters needed for the TRECV instruction. There are two formats for the TRECV
table based upon the protocol selected for the connection. TCP and ISO-on-TCP share a
common table format. UDP has a special TRECV table format. Refer to the TSEND and
TRECV tables below for further information.
The TRECV instruction does not have a REQ bit. After the first execution of the TRECV
instruction, the status bits show the instruction as Active. All subsequent calls to the TRECV
instruction show an Active status if no data has been received by the CPU for this
connection.
After a successful receipt of data, the instruction sets the Done bit in the status byte of the
table, and the returned Data Length value is the actual number of bytes received. The
TRECV instruction copies the received data from an internal buffer to the your receive buffer
only when the TRECV instruction executes and the Done bit is set to TRUE.
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
Program instructions
7.3 Communication
223

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents