Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Common parameters of instructions for S7 communication (S7-1200, S7-1500)

Common parameters of instructions for S7 communication

Classification
The parameters of the instructions for S7 communication can be divided into the following five catego‐
ries according to their functions:

1. Control parameters are used to activate an instruction.


2. Addressing parameters are used to address the remote communication partner.
3. Send parameters point to the data areas that are to be sent to the remote partner.
4. Receive parameters point to the data areas where the data received from remote partners will
be entered.
5. Status parameters are used to monitor whether the instruction has completed its task without er‐
ror or for the analysis of any errors that have occurred.

Control parameter
Data exchange will only be activated if the appropriate control parameters have a defined value (for
example, are set) when the instruction is called or when the value has undergone a specific change
since the previous call (for example, a positive edge).

Addressing parameters

Parameter Description
Reference to the local connection description (specified by the configuration of the con‐
ID
nection).
With the R_ID parameter, you specify that a send and a receive instruction belong to‐
gether: The R_ID parameter must match in the instruction at the sending end and the
instruction at the receiving end.
This allows the communication of several instruction pairs via the same logic connec‐
R_ID tion.
• R_ID must be specified in the form DW#16#wxyzWXYZ.
• The instruction pairs of a logical connection specified in R_ID must be unique for this
connection.

Note
Addressing parameters ID and R_ID
You can reassign the addressing parameters ID and R_ID during runtime. The new parameters are
validated with each new job after the previous job has been closed.
You can use the following options to reduce the number of instance DBs and therefore the work
memory required:

1. With tag IDs, you can use several connections via one data instance block.
2. With tag R_IDs, you can define several pairs of sending and receiving instructions for one job
with a single instance.
3. You can combine cases 1 and 2.

-1-
Common parameters of instructions for S7 communication (S7-1200, S7-1500)

Please note that the new parameters are valid after the last job is executed. When you activate the
sending operation, the R_ID parameter in the instruction at the sending end must match its counter‐
part at the receiving end.

Status parameter
With the status parameters, you monitor whether the instruction has completed its task correctly or
whether it is still active. The status parameters also indicate errors.

Note
The status parameters are valid for one cycle only, namely from the first command following the
call until the next call. As a result, you must evaluate these parameters after each instruction cycle.

Send and receive parameters


For communication instructions configured at both ends
• The number of the SD_i and RD_i parameters used must match at the send and receive end.
• The data types of the SD_i and RD_i parameters that belong together must match at the send and
receive end.
• The amount of data to be sent according to the SD_i parameter must not exceed the range made
available by the corresponding RD_i (does not apply to "BSEND" / "BRCV"). The RD_i parameters
must (with exception of "BSEND"/"BRCV") have the identical data size.
If you do not keep to the rules above, this is indicated by ERROR = 1 and STATUS = 4.

Note
Supplying the send and receive parameters
With the VARIANT data type, send and receive parameters must always be supplied any time a
communication instruction is called. It is not possible, for example, to supply the send parameters
of the communication instructions at startup and to only trigger the send job in cyclic operation.

User data size


With the "USEND", "URCV", "GET" and "PUT" instructions, the amount of data to be transferred must
not exceed a defined user data size. The maximum user data size depends on:
• The instruction used

• The communication partner.

The guaranteed minimum size of the user data for an instruction with 1-4 tags is listed in the following
table:

Instruction Partner: S7-300 Partner: S7-400 Partner: S7-1200 Partner: S7-1500


PUT / GET 160 bytes 400 bytes 160 bytes 880 bytes
USEND / URCV 160 bytes 440 bytes - 920 bytes
• 65534 bytes
with standard
32768/65534 access
BSEND / BRCV 65534 bytes -
bytes • 65535 bytes
with optimized
access
Further information on the user data size can be found in the technical data of the respective CPU.

-2-
Common parameters of instructions for S7 communication (S7-1200, S7-1500)

Exact user data size


If the user data size specified above is insufficient you can determine the maximum byte length of the
user data as follows:
First read the data block size valid for communication from the following table:

Local CPU Remote CPU Data block size in bytes


S7-1200 Any 240
S7-300 240

S7-1500 S7-400 480


S7-1200 240
S7-1500 960

Use this value in the following table to read the maximum possible user data length in bytes as total of
the parameters used. It applies for even lengths of the areas SD_i, RD_i, and ADDR_i.
For each range of uneven length the maximum possible user data length is reduced by one byte.

Number of SD_i, RD_i, ADDR_i parameters used


Data block size Instruction 1 2 3 4
PUT/GET/
240 (S7-300) 160 - - -
USEND
PUT 212 - - -
240 (S7-300 via in‐
GET 222 - - -
tegrated interface)
USEND 212 - - -
PUT 212 196 180 164
240 (S7-400) GET 222 218 214 210
USEND 212 - - -
PUT 452 436 420 404
480 (S7-400) GET 462 458 454 450
USEND 452 448 444 440
PUT 212 196 180 164
240 (S7-1200)
GET 222 218 214 210
PUT 932 916 900 884
960 (S7-1500) GET 942 938 934 930
USEND 932 928 924 920

-3-

You might also like