System blocks for PROFIBUS DP and PROFINET IO

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

16.5 System blocks for distributed I/O

16.5.2 System blocks for PROFIBUS DP and PROFINET IO

The following system blocks can be used with PROFIBUS DP and PROFINET IO:

b GETIO Read all inputs of a station (FB 20) b SETIO Write to all outputs of a station (FB 21) b GETIO_PART Read some inputs of a station (FB 22) b SETIO_PART Write to some outputs of a station (FB 23) b D_ACT_DP Activate/deactivate distributed station (SFC 12) b DPRD_DAT Read user data consistently (SFC 14)

b DPWR_DAT Write user data consistently (SFC 15)

Fig. 16.20 shows the graphic representation of the system blocks for PROFIBUS DP and PROFINET IO.

GETIO Read all inputs of a station

GETIO uses DPRD_DAT to consistently read all input data of a DP standard slave or an IO device or all data of an input area in the case of modular stations. The right-hand word of the ID parameter contains the start address of the input area to be read.

The destination area specified with the INPUTS parameter must be exactly the same length as the configured length of the input area read that is also output with the LEN parameter.

SETIO Write to all outputs of a station

SETIO uses DPWR_DAT to consistently write all output data to a DP standard slave or IO device or all data of an output area in the case of modular stations. The Fig. 16.20 Graphic representation of system blocks for PROFIBUS DP and PROFINET IO

GETIO Instance data

GETIO_PART Instance data

D_ACT_DP

SETIO Instance data

SETIO_PART Instance data

DPRD_DAT DPWR_DAT

FB 20

Read all inputs of a station

FB 22

Read some inputs of a station

SFC 12

Activate/deactivate distributed station

FB 21

Write all outputs of a station

FB 23

Write some outputs of a station

SFC 14 Read user data consistently

SFC 15 Write user data consistently System blocks for PROFIBUS DP and PROFINET IO

ID

ID

REQ

ID LEN OUTPUTS

ID LEN

LADDR LADDR

OFFSET OUTPUTS

RECORD INPUTS

OFFSET

MODE LEN

LADDR INPUTS

STATUS

RET_VAL

RET_VAL

STATUS

STATUS

RET_VAL RET_VAL

LEN

BUSY

BUSY

ERROR

RECORD

right-hand word of the ID parameter contains the start address of the output area to be written to.

The source area specified with the OUTPUTS parameter must be exactly the same length as the configured length of the output area to be written to. This is why information in the LEN parameter is irrelevant.

GETIO_PART Read some inputs of a station

GETIO_PART uses UBLKMOV to consistently read some of the input data of a DP standard slave or IO device or some of the data of an input area in the case of mod- ular stations. The right-hand word of the ID parameter contains the start address of the input area, the OFFSET parameter contains the number of the first byte to be read, and the LEN parameter contains the number of bytes.

The input bytes to be read must be addressed in the process image input in order to use GETIO_PART. Please ensure that the OFFSET and LEN parameters do not violate any boundaries with neighboring data of other stations.

If the destination area specified by the INPUTS parameter is smaller than the input area read, the function only transfers as many bytes as can be written to the destina- tion area. If the destination area is larger, only the first LEN bytes of the area are writ- ten to. In both cases, no error is indicated on the ERROR parameter. ERROR only has signal state “1” if UBLKMOV signals an error.

SETIO_PART Write some outputs to a station

SETIO_PART uses UBLKMOV to consistently write some of the output data to a DP standard slave or IO device or some of the data of an output area in the case of mod- ular stations. The right-hand word of the ID parameter contains the start address of the output area, the OFFSET parameter contains the number of the first byte to be written, and the LEN parameter contains the number of bytes.

The output bytes to be written must be addressed in the process image output in order to use SETIO_PART. Please ensure that the OFFSET and LEN parameters do not violate any boundaries with neighboring data of other stations.

If the source area specified by the OUTPUTS parameter is smaller than the output area to be written, the function only transfers as many bytes as the source area con- tains. If the source area is larger, only the first bytes specified at the LEN parameter are transferred. In both cases, no error is indicated on the ERROR parameter. ERROR only has signal state “1” if UBLKMOV signals an error.

D_ACT_DP Activate/deactivate distributed station

D_ACT_DP deactivates and activates stations of the distributed I/O and allows scan- ning of the deactivated or activated status. A distributed station can be a DP slave or an IO device.

D_ACT_DP is called in the cyclic program; calling in the start-up routine is not sup- ported. D_ACT_DP works asynchronously, i.e. processing of a job can extend over several program cycles. An activation or deactivation job is started by “1” in the REQ

parameter. The REQ parameter must remain “1” for as long as the BUSY parameter has signal state “1”. The job has been completed if BUSY = “0”.

After deactivation, a configured (and existing) station is no longer addressed by the DP master or the IO controller. The output terminals of deactivated output modules carry zero or a substitute value. The process image input of deactivated input mod- ules is set to “0”.

A deactivated station can be removed from the bus without generating an error message; it is not signaled as faulty or missing. The calls of the asynchronous error organization blocks OB 85 (program execution error if the user data of the deacti- vated station is present in an automatically updated process image), and OB 86 (sta- tion failure) are omitted. You must not address the station from the program once it has been deactivated, since otherwise an I/O access error with calling of OB 122 will occur with direct access operations, or the station will be signaled as not pres- ent when reading a data record with RDREC.

D_ACT_DP also activates a deactivated station again. The station is configured and parameterized by the DP master or IO controller as with a return of station. The asynchronous error OBs 85 and 86 are not started when activating. If the BUSY pa- rameter has signal state “0” following activation, the station can be addressed from the user program.

In the case of a cold restart or warm restart, the operating system of a CPU 400 auto- matically activates the deactivated stations and continues the startup. Because acti- vating a distributed station can take a long time, I/O access errors will occur that, de- pending on configuration, call the OB 85 I/O access error organization block until the activation is completed. The activation status of the distributed stations does not change on hot restart.

DPRD_DAT Read user data consistently

DPRD_DAT reads consistent user data with a length of 3 bytes or greater than 4 bytes from a DP standard slave or IO device.

The LADDR parameter receives the module start address of the user data (input area). The RECORD parameter describes the area in which the read data is saved.

Tags with data types ARRAY and STRUCT, a PLC data type, or an ANY pointer with data type BYTE (e.g. P#DBzDBXy.x BYTE nnn) are permissible as actual parameters.

Note: If peripheral inputs (I:P) are addressed whose addresses are in the process im- age input (I), the process image is not updated.

DPWR_DAT Write user data consistently

DPWR_DAT writes consistent user data with a length of 3 bytes or greater than 4 bytes to a DP standard slave or IO device.

The LADDR parameter receives the module start address of the user data (output area). The RECORD parameter describes the area from which the transferred data is

read. Tags with data types ARRAY and STRUCT, a PLC data type, or an ANY pointer with data type BYTE (e.g. P#DBzDBXy.x BYTE nnn) are permissible as actual parameters.

If peripheral outputs (Q:P) are addressed whose addresses are in the process image output (Q), the process image is not updated.

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

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

(747 trang)