System blocks for station-external S7 basic communication

Một phần của tài liệu Automating with SIMATIC s7 400 inside TIA portal publicis (2013) (Trang 680 - 683)

The following system blocks handle data transfer between different PLC stations on the MPI subnet:

b X_SEND Send data (SFC 65) b X_RCV Receive data (SFC 66)

b X_GET Read data (SFC 67) b X_PUT Write data (SFC 68)

b X_ABORT Abort connection (SFC 69)

The system blocks can be found in the program elements catalog under Communication > MPI communication. The graphic representation of the calls is shown in Fig. 17.4.

X_SEND Send data

X_SEND sends data which is received in the partner station by X_RCV. The partner device is specified with the MPI address at parameter DEST_ID. A job is triggered by REQ = “1” and BUSY = “0” (“initial call”). BUSY is set to “1” during execution of the job; changes to the REQ parameter now no longer have an effect. BUSY is returned to “0” at the end of the job. If REQ is still “1”, the job is started again immediately.

The operating system reads all data from the source area into an internal buffer during the initial call and transfers it to the partner device.

BUSY is “1” for the duration of the send procedure. BUSY if set to “0” when the part- ner signals that the data has been fetched and the send job is finished.

With CONT = “0”, the connection is canceled again and the corresponding CPU re- sources are then available for other communication connections. With CONT = “1”, the connection is retained. By means of the REQ_ID parameter you can send an ID together with the send data which you can evaluate at X_RCV in the partner station.

Fig. 17.4 Graphic representation of the SFCs for station-external S7 basic communication X_SEND

X_GET

X_RCV

X_PUT X_ABORT

SFC 65 Send data

SFC 67 Read data

SFC 66 Receive data

SFC 68 Write data

SFC 69

Abort connection System blocks for station-external S7 basic communication

REQ

REQ

EN_DT

REQ CONT DEST_ID VAR_ADDR SD

REQ DEST_ID CONT

CONT DEST_ID

DEST_ID REQ_ID

VAR_ADDR SD

RET_VAL

RET_VAL

RET_VAL

RET_VAL REQ_ID

BUSY NDA RD

RET_VAL BUSY BUSY

BUSY RD

The SD parameter describes the area from which the data to be sent is read. Oper- ands, tags, or any data areas addressed by an ANY pointer are permissible as actual parameters. A data type test between the send and receive data is not carried out.

X_RCV Receive data

X_RCV receives data which was sent by the partner station by X_SEND. The received data is saved in an internal buffer. Several send operations can be saved in a queue in the chronological order of arrival.

You use EN_DT = “0” to check that data has been received; NDA is then “1”, RET_VAL shows the number of bytes of received data, and REQ_ID shows the same assign- ment as the corresponding parameter of X_SEND. With EN_DT = “1”, the system function transfers the initially entered (oldest) sent data completely into the desti- nation area; NDA is then “1” and RET_VAL shows the number of transmitted bytes.

If no data is present in the internal queue when EN_DT = “1”, NDA is then “0”.

Upon a cold restart or warm restart, all data waiting for sending in the queue is re- jected.

Upon cancellation of a connection and upon a hot restart, the oldest entry in the queue is retained if it has already been “scanned” with EN_DT = “0”, otherwise it is rejected like all other entries in the queue.

The RD parameter describes the area into which the received data is written. Oper- ands, tags, or any data areas addressed by an ANY pointer are permissible as actual parameters.

A data type test between the send and receive data is not carried out. If the received data is irrelevant, an “empty” ANY pointer (NIL pointer) is permissible at the RD pa- rameter.

X_GET Read data

X_GET reads data from the partner station. A job is triggered by REQ = “1” and BUSY = “0” (“Initial call”). BUSY is set to “1” during execution of the job; changes to the REQ parameter now no longer have an effect.

BUSY is returned to “0” at the end of the job. If REQ is still “1”, the job is started again immediately.

Following triggering of the read operation, the operating system in the partner de- vice assembles the data requested by VAR_ADDR and sends it. When the communi- cation function is called, the received data is entered completely into the destina- tion area specified at the RD parameter. RET_VAL then indicates the number of transferred bytes.

If CONT = “0”, the communication connection is cleared again. CONT = “1” retains the connection. The data is even read if the communication partner is at STOP.

The RD and VAR_ADDR parameters describe the area from which the data to be sent is read or into which the received data is to be written. Operands, tags, or any data

areas addressed by an ANY pointer are permissible as actual parameters. A data type test between the send and receive data is not carried out.

X_PUT Write data

X_PUT writes data to a partner station. A job is triggered by REQ = “1” and BUSY =

“0” (“Initial call”). BUSY is set to “1” during execution of the job; changes to the REQ parameter now no longer have an effect.

BUSY is returned to “0” at the end of the job. If REQ is still “1”, the job is started again immediately.

Following triggering of the write operation, the operating system accepts all data from the source area specified at the SD parameter into an internal buffer during the initial call and sends it to the partner device. The received data is written there by its operating system into the data area specified at the VAR_ADDR parameter.

BUSY is subsequently set to “0”.

The data is even written if the communication partner is at STOP.

The SD and VAR_ADDR parameters describe the area from which the data to be sent is read or into which the received data is to be written. Operands, tags, or any data areas addressed by an ANY pointer are permissible as actual parameters.

A data type test between the send and receive data is not carried out.

X_ABORT Cancel connection

X_ABORT aborts an existing connection. REQ = “1” starts the job. X_ABORT can only be used to abort connections established using X_SEND, X_GET, or X_PUT in the own station.

Một phần của tài liệu Automating with SIMATIC s7 400 inside TIA portal publicis (2013) (Trang 680 - 683)

Tải bản đầy đủ (PDF)

(747 trang)