• 沒有找到結果。

SIMATIC System Software for S7-300/400 System and Standard Functions

N/A
N/A
Protected

Academic year: 2022

Share "SIMATIC System Software for S7-300/400 System and Standard Functions"

Copied!
658
0
0

加載中.... (立即查看全文)

全文

(1)

Organization Blocks

1

Common Parameters for SFCs

2

Copy and Block Functions

3

SFCs for Controlling Program Execution

4

SFCs for Handling the System Clock

5

SFCs for Handling Run-Time Meters

6

SFCs for Transferring Data Records

7

DPV1 SFBs According to PNO AK 1131

8

SFCs for Handling Time-of-Day Interrupts

9

SFCs for Handling Time-Delay Interrupts

10

SFCs for Handling Synchronous Errors

11

SFCs for Handling Interrupts and

Asynchronous Errors

12

SFCs for Diagnostics

13

SFCs and SFBs for Updating the Process

Image and Processing Bit Fields

14

System Functions for Addressing Modules

15

SFCs for Distributed I/Os

16

SFCs for Global Data Communication

17

Overview over the S7 Communication and the

S7 Basic Communication

18

S7 Communication

19

Communication SFCs for Non-Configured

S7 Connections

20

Generating Block-Related Messages

21

IEC Timers and IEC Counters

22

IEC Functions

23

SFBs for Integrated Control

24

SFBs for Compact CPUs

25

SFCs for H CPUs

26

Integrated Functions (for CPUs with

Integrated I/Os)

27

Plastics Techology

28

SIMATIC

System Software

for S7-300/400 System and Standard Functions

Reference Manual

This manual is part of the documentation package with the order number:

6ES7810-4CA06-8BR0

长沙工控帮教育科技有限公司整理

(2)

Copyright © Siemens AG 2002 All rights reserved The reproduction, transmission or use of this document or its contents is not permitted without express written authority.

Offenders will be liable for damages. All rights, including rights created by patent grant or registration of a utility model or design, are reserved.

Disclaimer of Liability

We have checked the contents of this manual for agreement with the hardware and software described. Since deviations cannot be precluded entirely, we cannot guarantee full agreement. However, the data in this manual are reviewed regularly and any necessary corrections included in subsequent editions. Suggestions for improvement are welcomed.

connected equipment against damage. These notices are highlighted by the symbols shown below and graded according to severity by the following texts:

!

Dangerindicates that death, severe personal injury or substantial property damage will result if proper precautions are not taken.

!

Warningindicates that death, severe personal injury or substantial property damage can result if proper precautions are not taken.

!

Cautionindicates that minor personal injury can result if proper precautions are not taken.

Caution

indicates that property damage can result if proper precautions are not taken.

Notice

draws your attention to particularly important information on the product, handling the product, or to a particular part of the documentation.

Qualified Personnel

Only qualified personnel should be allowed to install and work on this equipment. Qualified persons are defined as persons who are authorized to commission, to ground and to tag circuits, equipment, and systems in accordance with established safety practices and standards.

Correct Usage

Note the following:

!

WarningThis device and its components may only be used for the applications described in the catalog or the technical description, and only in connection with devices or components from other manufacturers which have been approved or recommended by Siemens.

This product can only function correctly and safely if it is transported, stored, set up, and installed correctly, and operated and maintained as recommended.

Trademarks

SIMATIC®, SIMATIC HMI® and SIMATIC NET® are registered trademarks of SIEMENS AG.

Third parties using for their own purposes any other names in this document which refer to trademarks might infringe upon the rights of the trademark owners.

长沙工控帮教育科技有限公司整理

(3)

Preface

Purpose

This manual provides you with a comprehensive overview of the organization blocks (OB), system functions (SFC), system and standard function blocks (SFC), and IEC functions contained in the operating systems of the CPUs of the S7-300 and S7-400. The appendix describes the diagnostic data, system status lists (SZL), and events.

Note

Refer to the reference section of the "S7-300 Programmable Controller, Hardware and Installation" manual /70/ or the "S7-400/M7-400 Programmable Controllers Module Specifications" reference manual /101/ or the Instruction List: S7-400 Programmable Controller /102/ (whichever version applies to your CPU) for details of which of these functions and blocks are available on which CPU. The properties of the CFBs and the S7 signaling functions for specific CPUs are described in /70/ and /101/.

For information about the CPU operating systems, program design, and the communications and diagnostic capabilities of the CPUs, refer to the "Configuring Hardware and Communication Connections STEP 7 V5.2" manual /234/ How to call functions and function blocks in your program is explained in the language descriptions.

You program and assign parameters for all these functions using the STEP 7 standard software. How to use this software is described in the "Programming with STEP 7 V5.2" manual /231/ and in the STEP 7 online help.

Audience

This manual is intended for programmers and engineers who are familiar with controlling processes and are responsible for writing programs for programmable logic controllers.

长沙工控帮教育科技有限公司整理

(4)

STEP 7 Documentation Packages

The print edition 06/2000 of this is part of the documentation package "STEP 7 Basic Information."

The following table displays an overview of the STEP 7 documentation:

Documentation Purpose Order Number

STEP 7 Basic Information with

• Working with STEP 7 V5.2, Getting Started Manual

• Programming with STEP 7 V5.2

• Configuring Hardware and Communication Connections, STEP 7 V5.2

• From S5 to S7, Converter Manual

Basic information for technical personnel describing the methods of implementing control tasks with STEP 7 and the S7-300/400 programmable controllers.

6ES7810-4CA06-8BA0

STEP 7 Reference with

• Ladder Logic (LAD)/Function Block Diagram (FBD)/Statement List (STL) for S7-300/400 manuals

• Standard and System Functions for S7-300/400

Provides reference information and describes the programming languages LAD, FBD, and STL, and standard and system functions extending the scope of the STEP 7 basic information.

6ES7810-4CA06-8BR0

Online Helps Purpose Order Number

Help on STEP 7 Basic information on

programming and configuring hardware with STEP 7 in the form of an online help.

Part of the STEP 7 Standard software.

Reference helps on STL/LAD/FBD Reference help on SFBs/SFCs Reference help on Organization Blocks

Context-sensitive reference information.

Part of the STEP 7 Standard software.

长沙工控帮教育科技有限公司整理

(5)

Online Help

The manual is complemented by an online help which is integrated in the software.

This online help is intended to provide you with detailed support when using the software.

The help system is integrated in the software via a number of interfaces:

There are several menu commands which you can select in the Help menu:

The Contents command opens the index for the Help on STEP 7.

Using Help provides detailed instructions on using the online help.

• The context-sensitive help offers information on the current context, for example, an open dialog box or an active window. You can open the context- sensitive help by clicking the "Help" button or by pressing F1.

• The status bar offers another form of context-sensitive help. It displays a short explanation for each menu command when the mouse pointer is positioned on the menu command.

• A brief explanation is also displayed for each icon in the toolbar when the mouse pointer is positioned on the icon for a short time.

If you prefer to read the information from the online help in printed format, you can print out individual help topics, books, or the entire online help.

This manual is an extract from the HTML-based Help on STEP 7. As the manual and the online help share an almost identical structure, it is easy to switch between the manual and the online help.

Feedback on Documentation

To help us to provide the best possible documentation for you and future STEP 7 users, we need your support. If you have any comments or suggestions relating to this manual or the online help, please complete the questionnaire at the end of the manual and send it to the address shown. Please include your own personal rating of the documentation.

Other Manuals

The various S7-300 and S7-400 CPUs and the S7-300 and S7-400 modules are described in the following manuals:

• For the S7-300 programmable logic controller, refer to the manuals:

"S7 300 Programmable Controller, Hardware and Installation" /70/, "S7-300, M7-300 Programmable Controllers Module Specifications" /71/ and in the Instruction List /72/.

• For the S7-400 programmable logic controller, refer to the manual:

"S7-400/M7-400 Programmable Controllers Module Specifications" /101/ and in the Instruction List /102/.

长沙工控帮教育科技有限公司整理

(6)

How to Use this Manual

This manual covers the following topics:

• Chapter 1 explains the functions of all the organization blocks.

• Chapter 2 describes the common parameters RET_VAL, REQ and BUSY.

• Chapters 3 to 28 describe the SFCs, SFBs and IEC-FCs.

• The Chapters sections 29 to 32 contain a description of the structure of the diagnostic data, an overview of the SZL-IDs, the possible events, lists of the SFCs, SFBs and FCs described in this manual, an overview of the SDBs.

• The bibliography contains a list of further manuals.

• The Glossary explains important terminology.

• The Index helps you to locate sections of text and topics quickly.

Conventions

References to other manuals and documentation are indicated by numbers in slashes /.../. These numbers refer to the titles of manuals listed in the bibliography.

Special Note

The system functions can be interrupted. If there are any restrictions that apply to certain SFCs or situations, these are explained in the description of the particular SFC.

Documentation Reply Form

If you have comments about this manual or the online help, please fill out the questionnaire at the end of this manual and send it the address shown. Please take the time to add your own evaluation grade.

http://www.ad.siemens.de/partner

Training Centers

Siemens offers a number of training courses to familiarize you with the SIMATIC S7 automation system. Please contact your regional training center or our central training center in D 90327 Nuremberg, Germany for details:

Telephone: +49 (911) 895-3200.

http://www.sitrain.com/

长沙工控帮教育科技有限公司整理

(7)

A&D Technical Support

Worldwide, available 24 hours a day:

Beijing Nuremberg

Johnson City

Worldwide (Nuremberg) Technical Support

24 hours a day, 365 days a year Phone: +49 (0) 180 5050-222 Fax: +49 (0) 180 5050-223 E-Mail: adsupport@

siemens.com

GMT: +1:00

Europe / Africa (Nuremberg) Authorization

Local time: Mon.-Fri. 8:00 to 17:00 Phone: +49 (0) 180 5050-222 Fax: +49 (0) 180 5050-223 E-Mail: adsupport@

siemens.com

GMT: +1:00

United States (Johnson City) Technical Support and Authorization

Local time: Mon.-Fri. 8:00 to 17:00 Phone: +1 (0) 770 740 3505 Fax: +1 (0) 770 740 3699 E-Mail: isd-callcenter@

sea.siemens.com GMT: -5:00

Asia / Australia (Beijing) Technical Support and Authorization

Local time: Mon.-Fri. 8:30 to 17:30 Phone: +86 10 64 75 75 75 Fax: +86 10 64 74 74 74 E-Mail: adsupport.asia@

siemens.com

GMT: +8:00

The languages of the SIMATIC Hotlines and the authorization hotline are generally German and English.

长沙工控帮教育科技有限公司整理

(8)

Service & Support on the Internet

In addition to our documentation, we offer our Know-how online on the internet at:

http://www.siemens.com/automation/service&support where you will find the following:

• The newsletter, which constantly provides you with up-to-date information on your products.

• The right documents via our Search function in Service & Support.

• A forum, where users and experts from all over the world exchange their experiences.

• Your local representative for Automation & Drives via our representatives database.

• Information on field service, repairs, spare parts and more under "Services".

长沙工控帮教育科技有限公司整理

(9)

Contents

1 Organization Blocks ...1-1 1.1 Overview of the Organization Blocks (OBs)...1-1 1.2 Program Cycle Organization Block (OB1) ...1-4 1.3 Time-of-Day Interrupt Organization Blocks (OB10 to OB17)...1-6 1.4 Time-Delay Interrupt Organization Blocks (OB20 to OB23) ...1-10 1.5 Cyclic Interrupt Organization Blocks (OB30 to OB38) ...1-12 1.6 Hardware Interrupt Organization Blocks (OB40 to OB47) ...1-14 1.7 Status Interrupt OB (OB 55)...1-16 1.8 Update Interrupt OB (OB 56) ...1-17 1.9 Manufacturer Specific Interrupt OB (OB57) ...1-18 1.10 Multicomputing Interrupt Organization Block (OB60) ...1-19 1.11 Synchronous Cycle Interrupt OBs (OB 61 to OB 64)...1-21 1.12 I/O Redundancy Error OB (OB70) ...1-22 1.13 CPU Redundancy Error OB (OB72) ...1-24 1.14 Communication Redundancy Error OB (OB73) ...1-27 1.15 Time Error Organization Block (OB80) ...1-28 1.16 Power Supply Error Organization Block (OB81) ...1-31 1.17 Diagnostic Interrupt Organization Block (OB82) ...1-33 1.18 Insert / Remove Module Interrupt Organization Block (OB83) ...1-35 1.19 CPU Hardware Fault Organization Block (OB84) ...1-38 1.20 Priority Class Error Organization Block (OB85) ...1-39 1.21 Rack Failure Organization Block (OB86) ...1-43 1.22 Communication Error Organization Block (OB87) ...1-47 1.23 Processing Interrupt OB (OB 88) ...1-49 1.24 Background Organization Block (OB90) ...1-50 1.25 Startup Organization Blocks (OB100, OB101 and OB102) ...1-52 1.26 Programming Error Organization Block (OB121)...1-57 1.27 I/O Access Error Organization Block (OB122)...1-60 2 Common Parameters for SFCs ...2-1 2.1 Evaluating Errors with Output Parameter RET_VAL ...2-1 2.2 Meaning of the Parameters REQ, RET_VAL and BUSY

with Asynchronous SFCs ...2-6

长沙工控帮教育科技有限公司整理

(10)

3 Copy and Block Functions ...3-1 3.1 Copying Variables with SFC 20 "BLKMOV"...3-1 3.2 Uninterruptible Copying of Variables with SFC 81 "UBLKMOV" ...3-3 3.3 Initializing a Memory Area with SFC 21 "FILL" ...3-5 3.4 Creating a Data Block with SFC 22 "CREAT_DB"...3-7 3.5 Deleting a Data Block with SFC 23 "DEL_DB" ...3-9 3.6 Testing a Data Block with SFC 24 "TEST_DB" ...3-11 3.7 Compressing the User Memory with SFC 25 "COMPRESS" ...3-12 3.8 Transferring a Substitute Value to Accumulator 1

with SFC 44 "REPL_VAL"...3-14 3.9 Generating Data Blocks in Load Memory with SFC 82 "CREA_DBL"...3-15 3.10 Reading from a Data Block In Load Memory with SFC 83 "READ_DBL"...3-18 3.11 Writing a Data Block in Load Memory with SFC 84 "WRIT_DBL" ...3-20 4 SFCs for Controlling Program Execution ...4-1 4.1 Re-triggering Cycle Time Monitoring with SFC 43 "RE_TRIGR"...4-1 4.2 Changing the CPU to STOP with SFC 46 "STP" ...4-1 4.3 Delaying Execution of the User Program with SFC 47 "WAIT" ...4-2 4.4 Triggering a Multicomputing Interrupt with SFC 35 "MP_ALM" ...4-3 4.5 Controlling CiR with SFC 104 "CiR"...4-4 5 SFCs for Handling the System Clock ...5-1 5.1 Setting the TOD with SFC 0 "SET_CLK" ...5-1 5.2 Reading the Time with SFC 1 "READ_CLK" ...5-2 5.3 Synchronizing Slave Clocks with SFC 48 "SNC_RTCB" ...5-3 5.4 Setting the Time-of-Day and the TOD Status with SFC 100 "SET_CLKS" ...5-4 6 SFCs for Handling Run-Time Meters ...6-1 6.1 Runtime Meters ...6-1 6.2 Handling Runtime meters with SFC 101 "RTM" ...6-2 6.3 Setting the Runtime Meter with SFC 2 "SET_RTM" ...6-4 6.4 Starting and Stopping a Run-time Meter with SFC 3 "CTRL_RTM" ...6-5 6.5 Reading a Runtime Meter with SFC 4 "READ_RTM" ...6-6 6.6 Reading the System Time with SFC 64 "TIME_TCK"...6-7 7 SFCs for Transferring Data Records ...7-1 7.1 Writing and Reading Data Records...7-1 7.2 Reading Defined Parameters with SFC 54 "RD_DPARM" ...7-3 7.3 Reading Predefined Parameters with SFC 102 "RD_DPARA"...7-4 7.4 Writing Dynamic Parameters with SFC 55 "WR_PARM"...7-5 7.5 Writing Default Parameters with SFC 56 "WR_DPARM"...7-7 7.6 Assigning Parameters to a Module with SFC 57 "PARM_MOD"...7-8 7.7 Writing a Data Record with SFC 58 "WR_REC"...7-11 7.8 Reading a Data Record with SFC 59 "RD_REC" ...7-12 7.9 Further Error Information for SFCs 55 to 59 ...7-17 8 DPV1 SFBs According to PNO AK 1131...8-1 8.1 Reading a Data Record from a DP Slave with SFB 52 "RDREC" ...8-1 8.2 Writing a Data Record in a DP Slave with SFB53 "WRREC" ...8-3 8.3 Receiving an Interrupt from a DP Slave with SFB 54 "RALRM" ...8-5 8.4 Sending an Interrupt to the DP Master with SFB 75 "SALRM"...8-14

长沙工控帮教育科技有限公司整理

(11)

9 SFCs for Handling Time-of-Day Interrupts ...9-1 9.1 Handling Time-of-Day Interrupts ...9-1 9.2 Characteristics of SFCs 28 to 31 ...9-2 9.3 Setting a Time-of-Day Interrupt with SFC 28 "SET_TINT" ...9-4 9.4 Canceling a Time-of-Day Interrupt with SFC 29 "CAN_TINT"...9-5 9.5 Activating a Time-of-Day Interrupt with SFC 30 "ACT_TINT"...9-6 9.6 Querying a Time-of-Day Interrupt with SFC 31 "QRY_TINT" ...9-7 10 SFCs for Handling Time-Delay Interrupts ...10-1 10.1 Handling Time-Delay Interrupts ...10-1 10.2 Starting a Time-Delay Interrupt with SFC 32 "SRT_DINT"...10-3 10.3 Querying a Time-Delay Interrupt with SFC 34 "QRY_DINT" ...10-4 10.4 Canceling a Time-Delay Interrupt with SFC 33 "CAN_DINT"...10-5 11 SFCs for Handling Synchronous Errors ...11-1 11.1 Masking Synchronous Errors ...11-1 11.2 Masking Synchronous Errors with SFC 36 "MSK_FLT" ...11-9 11.3 Unmasking Synchronous Errors with SFC 37 "DMSK_FLT" ...11-10 11.4 Reading the Error Register with SFC 38 "READ_ERR" ...11-11 12 SFCs for Handling Interrupts and Asynchronous Errors...12-1 12.1 Delaying and Disabling Interrupt and Asynchronous Errors ...12-1 12.2 Disabling the Processing of New Interrupts and

Asynchronous Errors with SFC 39 "DIS_IRT" ...12-3 12.3 Enabling the Processing of New Interrupts and

Asynchronous Errors with SFC 40 "EN_IRT" ...12-5 12.4 Delaying the Processing of Higher Priority Interrupts and

Asynchronous Errors with SFC 41 "DIS_AIRT" ...12-6 12.5 Enabling the Processing of Higher Priority Interrupts and

Asynchronous Errors with SFC 42 "EN_AIRT" ...12-7 13 SFCs for Diagnostics ...13-1 13.1 System Diagnostics...13-1 13.2 Reading OB Start Information with SFC 6 "RD_SINFO" ...13-1 13.3 Reading a System Status List or Partial List with SFC 51 "RDSYSST" ...13-4 13.4 Writing a User-Defined Diagnostic Event to the Diagnostic Buffer

with SFC 52 "WR_USMSG"...13-10 13.5 Determining the OB Program Runtime with SFC 78 "OB_RT"...13-14 13.6 Diagnosis of the Current Connection Status with SFC 87 "C_DIAG" ...13-17 13.7 Identifying the Bus Topology of a DP Master System with SFC 103

"DP_TOPOL"...13-22 14 SFCs and SFBs for Updating the Process Image and Processing Bit Fields ...14-1 14.1 Updating the Process Image Input Table with SFC 26 "UPDAT_PI"...14-1 14.2 Updating the Process Image Output Table with SFC 27 "UPDAT_PO" ...14-3 14.3 Updating the Process Image Partition Input Table in a

Synchronous Cycle with SFC 126 "SYNC_PI" ...14-4 14.4 Updating the Process Image Partition Output Table in a

长沙工控帮教育科技有限公司整理

(12)

15 System Functions for Addressing Modules ...15-1 15.1 Querying the Logical Base Address of a Module

with SFC 5 "GADR_LGC" ...15-1 15.2 Querying the Module Slot Belonging to a Logical Address

with SFC 49 "LGC_GADR" ...15-2 15.3 Querying all Logical Addresses of a Module with SFC 50 "RD_LGADR"...15-4 16 SFCs for Distributed I/Os ...16-1 16.1 Triggering a Hardware Interrupt on the DP Master with SFC 7 "DP_PRAL" ..16-1 16.2 Synchronizing Groups of DP Slaves with SFC 11 "DPSYC_FR" ...16-3 16.3 Deactivating and Activating DP Slaves with SFC 12 "D_ACT_DP"...16-10 16.4 Reading Diagnostic Data of a DP Slave with SFC 13 "DPNRM_DG"

(Slave Diagnostics) ...16-15 16.5 Reading Consistent Data of a DP Standard Slave

with SFC 14 "DPRD_DAT"...16-19 16.6 Writing Consistent Data to a DP Standard Slave

with SFC 15 "DPWR_DAT"...16-21 17 SFCs for Global Data Communication ...17-1 17.1 Sending a GD Packet with SFC 60 "GD_SND" ...17-1 17.2 Programmed Acceptance of a Received GD Packet

with SFC 61 "GD_RCV" ...17-3 18 Overview over the S7 Communication and the S7 Basic Communication...18-1

18.1 Differences between the Blocks of the S7 Communication and the

S7 Basic Communication ...18-1 18.2 Data Consistency ...18-3 18.3 Overview of the S7 Communication Blocks ...18-5 18.4 Overview of the Blocks for the S7 Basic Communication ...18-8 19 S7 Communication ...19-1

19.1 Common Parameters of the SFBs/FBs and SFCs/FCs

for S7 Communication...19-1 19.2 Startup Routine of SFBs for Configured S7 Connections ...19-5 19.3 How SFBs React to Problems...19-7 19.4 Uncoordinated Sending of Data with SFB 8/FB 8 "USEND"...19-9 19.5 Uncoordinated Receiving of Data with SFB/FB 9 "URCV" ...19-12 19.6 Sending Segmented Data with SFB/FB 12 "BSEND"...19-15 19.7 Receiving Segmented Data with SFB/FB 13 "BRCV"...19-18 19.8 Writing Data to a Remote CPU with SFB/FB 15 "PUT" ...19-22 19.9 Read Data from a Remote CPU with SFB/FB 14 "GET" ...19-25 19.10 Sending Data to a Printer with SFB 16 "PRINT"...19-28 19.11 Initiating a Warm or Cold Restart on a Remote Device

with SFB 19 "START" ...19-34 19.12 Changing a Remote Device to the STOP State with SFB 20 "STOP"...19-36 19.13 Initiating a Hot Restart on a Remote Device with SFB 21 "RESUME" ...19-38 19.14 Querying the Status of a Remote Partner with SFB 22 "STATUS" ...19-40 19.15 Receiving the Status of a Remote Device with SFB 23 "USTATUS" ...19-42 19.16 Querying the Status of the Connection Belonging to an SFB Instance

with SFC 62 "CONTROL" ...19-45 19.17 Querying the Connection Status with FC 62 "C_CNTRL"...19-47 19.18 Work Memory Requirements of the S7 Communication SFBs/FBs ...19-48

长沙工控帮教育科技有限公司整理

(13)

20 Communication SFCs for Non-Configured S7 Connections ...20-1 20.1 Common Parameters of the Communication SFCs...20-1 20.2 Error Information of the Communication SFCs for Non-Configured

S7 Connections ...20-3 20.3 Sending Data to a Communication Partner outside the Local S7 Station

with SFC 65 "X_SEND"...20-7 20.4 Receiving Data from a Communication Partner outside the

Local S7 Station with SFC 66 "X_RCV"...20-9 20.5 Writing Data to a Communication Partner outside the Local S7 Station

with SFC 68 "X_PUT" ...20-13 20.6 Reading Data from a Communication Partner outside the

Local S7 Station with SFC 67 "X_GET"...20-15 20.7 Aborting an Existing Connection to a Communication Partner outside the

Local S7 Station with SFC 69 "X_ABORT"...20-17 20.8 Writing Data to a Communication Partner within the Local S7 Station

with SFC 73 "I_PUT"...20-18 20.9 Reading Data from a Communication Partner within the Local S7 Station

with SFC 72 "I_GET"...20-20 20.10 Aborting an Existing Connection to a Communication Partner

within the Local S7 Station with SFC 74 "I_ABORT" ...20-22 21 Generating Block-Related Messages ...21-1 21.1 Introduction to Generating Block-Related Messages with SFBs ...21-1 21.2 Generating Block-Related Messages without Acknowledgment

with SFB 36 "NOTIFY" ...21-5 21.3 Generating Block Related Messages without Acknowledgement Display

with SFB 31 "NOTIFY_8P"...21-7 21.4 Generating Block-Related Messages with Acknowledgment

with SFB 33 "ALARM"...21-10 21.5 Generating Block-Related Messages with Associated Values

for Eight Signals with SFB 35 "ALARM_8P" ...21-13 21.6 Generating Block-Related Messages without Associated Values

for Eight Signals with SFB 34 "ALARM_8" ...21-16 21.7 Sending Archive Data with SFB 37 "AR_SEND" ...21-18 21.8 Disabling Block-Related, Symbol-Related and Group Status Messages

with SFC 10 "DIS_MSG"...21-20 21.9 Enabling Block-Related, Symbol-Related, and Group Status Messages

with SFC 9 "EN_MSG"...21-22 21.10 Startup Behavior of the SFBs for Generating Block-Related Messages ...21-24 21.11 How the SFBs for Generating Block-Related Messages React

to Problems ...21-24 21.12 Introduction to Generating Block-Related Messages with SFCs ...21-25 21.13 Generating Acknowledgeable Block-Related Messages with SFC 17

"ALARM_SQ" and Permanently Acknowledged Block-Related Messages with SFC 18 "ALARM_S" ...21-28 21.14 Querying the Acknowledgment Status of the Last ALARM_SQ/ALARM_DQ

Entering Event Message with SFC 19 "ALARM_SC" ...21-31 21.15 Generating Acknowledgeable and Permanently Acknowledged Block Related

长沙工控帮教育科技有限公司整理

(14)

22 IEC Timers and IEC Counters...22-1 22.1 Generating a Pulse with SFB 3 "TP"...22-1 22.2 Generating an On Delay with SFB 4 "TON"...22-3 22.3 Generating an Off Delay with SFB 5 "TOF" ...22-5 22.4 Counting Up with SFB 0 "CTU"...22-7 22.5 Counting Down with SFB 1 "CTD" ...22-8 22.6 Up / Down Count with SFB 2 "CTUD"...22-9 23 IEC Functions...23-1 23.1 Overview ...23-1 23.2 Technical Data of the IEC Functions...23-3 23.3 Date and Time as Complex Data Types ...23-5 23.4 Time-of-Day Functions ...23-6 23.5 Comparing DATE_AND_TIME Variables...23-10 23.6 Comparing STRING Variables ...23-13 23.7 Editing Number Values ...23-16 23.8 Example in STL ...23-17 23.9 Example in STL ...23-18 23.10 Editing STRING Variables...23-19 23.11 Converting Data Type Formats ...23-24 24 SFBs for Integrated Control ...24-1 24.1 Continuous Control with SFB 41/FB 41 "CONT_C"...24-1 24.2 Step Control with SFB 42/FB 42 "CONT_S"...24-9 24.3 Pulse Generation with SFB 43/FB 43 "PULSEGEN" ...24-15 24.4 Example of the PULSEGEN Block...24-25 25 SFBs for Compact CPUs...25-1 25.1 Positioning With Analog Output Using SFB 44 "Analog" ...25-1 25.2 Positioning with Digital Output Using SFB 46 "DIGITAL" ...25-13 25.3 Controlling the Counter with SFB 47 "COUNT" ...25-24 25.4 Controlling the Frequency Measurement with SFB 48 "FREQUENC" ...25-29 25.5 Controlling Pulse Width Modulation with SFB 49 "PULSE" ...25-33 25.6 Sending Data (ASCII, 3964(R)) with SFB 60 "SEND_PTP" ...25-36 25.7 Receiving Data (ASCII, 3964(R)) with SFB 61 "RCV_PTP" ...25-39 25.8 Deleting the Receive Buffer (ASCII, 3964(R)) with SFB 62 "RES_RCVB"...25-42 25.9 Sending Data (512(R)) with SFB 63 "SEND_RK"...25-44 25.10 Fetching Data (RK 512) with SFB 64 "FETCH RK" ...25-48 25.11 Receiving and Providing Data (RK 512) with SFB 65 "SERVE_RK"...25-53 25.12 Additional Error Information of the SFBs 60 to 65 ...25-58 26 SFCs for H CPUs...26-1 26.1 Controlling Operation in H Systems with SFC 90 "H_CTRL"...26-1 27 Integrated Functions (for CPUs with integrated I/Os)...27-1 27.1 SFB 29 (HS_COUNT) ...27-1 27.2 SFB 30 (FREQ_MES) ...27-2 27.3 SFB 38 (HSC_A_B) ...27-3 27.4 SFB 39 (POS) ...27-4 28 Plastics Techology ...28-1 28.1 SFC 63 (AB_CALL) ...28-1

长沙工控帮教育科技有限公司整理

(15)

29 Diagnostic Data...29-1 29.1 Overview of the Structure of Diagnostic Data ...29-1 29.2 Diagnostic Data ...29-2 29.3 Structure of Channel-Specific Diagnostic Data...29-4 30 System Status Lists (SSL) ...30-1 30.1 Overview of the System Status Lists (SSL) ...30-1 30.2 Structure of a Partial SSL List ...30-3 30.3 SSL-ID...30-4 30.4 Possible Partial System Status Lists...30-5 30.5 SSL-ID W#16#xy11 - Module Identification ...30-6 30.6 SSL-ID W#16#xy12 - CPU Characteristics...30-7 30.7 SSL-ID W#16#xy13 - Memory Areas ...30-10 30.8 SSL-ID W#16#xy14 - System Areas ...30-11 30.9 SSL-ID W#16#xy15 - Block Types...30-13 30.10 SSL-ID W#16#xy19 - Status of the Module LEDs ...30-14 30.11 SSL-ID W#16#xy1C - Component Identification...30-16 30.12 SSL-ID W#16#xy22 - Interrupt Status...30-19 30.13 SSL ID W#16#xy25 - Assigning Process Images Partitions to the OBs...30-21 30.14 SSL-ID W#16#xy32 - Communication Status Data ...30-24 30.15 Data Record of the Partial List Extract with SSL-ID W#16#0132

Index W#16#0005 ...30-25 30.16 Data Record of the Partial List Extract with SSL-ID W#16#0132

Index W#16#0008 ...30-26 30.17 Data Record of the Partial List Extract with SSL-ID W#16#0132

Index W#16#000B...30-28 30.18 Data Record of the Partial List Extract with SSL-ID W#16#0132

Index W#16#000C ...30-29 30.19 Data Record of the Partial List Extract with SSL-ID W#16#0232

Index W#16#0004 ...30-30 30.20 SSL-ID W#16#xy71 - H CPU Group Information ...30-31 30.21 SSL-ID W#16#xy74 - Status of the Module LEDs ...30-34 30.22 SSL-ID W#16#xy75 - Switched DP Slaves in the H System ...30-36 30.23 SSL-ID W#16#xy90 - DP Master System Information ...30-38 30.24 SSL-ID W#16#xy91 - Module Status Information ...30-40 30.25 SSL-ID W#16#xy92 - Rack / Station Status Information ...30-44 30.26 SSL-ID W#16#xy95 - Extended DP Master System Information...30-48 30.27 SSL-ID W#16#xyA0 - Diagnostic Buffer ...30-50 30.28 SSL-ID W#16#00B1 - Module Diagnostic Information...30-51 30.29 SSL-ID W#16#00B2 - Diagnostic Data Record 1 with Physical Address ...30-53 30.30 SSL-ID W#16#00B3 - Module Diagnostic Data with Logical Base Address.30-54 30.31 SSL-ID W#16#00B4 - Diagnostic Data of a DP Slave ...30-55

长沙工控帮教育科技有限公司整理

(16)

31 Events ...31-1 31.1 Events and Event ID ...31-1 31.2 Event Class 1 - Standard OB Events ...31-2 31.3 Event Class 2 - Synchronous Errors ...31-3 31.4 Event Class 3 - Asynchronous Errors ...31-4 31.5 Event Class 4 - Stop Events and Other Mode Changes...31-6 31.6 Event Class 5 - Mode Run-time Events ...31-9 31.7 Event Class 6 - Communication Events...31-10 31.8 Event Class 7 - H/F Events ...31-11 31.9 Event Class 8 - Diagnostic Events for Modules ...31-13 31.10 Event Class 9 - Standard User Events ...31-15 31.11 Event Classes A and B - Free User Events ...31-17 31.12 Reserved Event Classes...31-17 32 List of SFCs, and SFBs ...32-1 32.1 List of SFCs, Sorted Numerically ...32-1 32.2 List of SFCs, Sorted Alphabetically...32-4 32.3 List of SFBs, Sorted Numerically ...32-7 32.4 List of SFBs, Sorted Alphabetically...32-9 Bibliography

Glossary Index

长沙工控帮教育科技有限公司整理

(17)

1 Organization Blocks

1.1 Overview of the Organization Blocks (OBs)

What Are Organization Blocks?

Organization Blocks (OBs) are the interface between the operating system of the CPU and the user program. OBs are used to execute specific program sections:

• At the startup of the CPU

• In a cyclic or clocked execution

• Whenever errors occur

• Whenever hardware interrupts occur.

Organization blocks are executed according to the priority they are allocated.

Which OBs Are Available?

Not all CPUs can process all of the OBs available in STEP 7. Refer to Operations lists /72/ and /102/ to determine which OBs are included with your CPU.

长沙工控帮教育科技有限公司整理

(18)

Where to Find More Information?

Refer to the online help and the following manuals for more information:

/70/: this manual contains the technical data that describe the capabilities of the different S7-300 CPUs.

/101/: this manual contains the technical data that describe the capabilities of the different S7-400 CPUs.

The following table contains the start event belonging to each OB as well as the default priority class.

OB Start Event Default Priority Class Explanation

OB1 End of startup or end of OB1 1 Free cycle

OB10 OB11 OB12 OB13 OB14 OB15 OB16 OB17

Time-of-day interrupt 0 Time-of-day interrupt 1 Time-of-day interrupt 2 Time-of-day interrupt 3 Time-of-day interrupt 4 Time-of-day interrupt 5 Time-of-day interrupt 6 Time-of-day interrupt 7

2 2 2 2 2 2 2 2

No default time specified

OB20 OB21 OB22 OB23

Time-delay interrupt 0 Time-delay interrupt 1 Time-delay interrupt 2 Time-delay interrupt 3

3 4 5 6

No default time specified

OB30 OB31 OB32 OB33 OB34 OB35 OB36 OB37 OB38

Cyclic interrupt 0 (default interval: 5 s) Cyclic interrupt 1 (default interval: 2 s) Cyclic interrupt 2 (default interval: 1 s) Cyclic interrupt 3 (default interval: 500 ms) Cyclic interrupt 4 (default interval: 200 ms) Cyclic interrupt 5 (default interval: 100 ms) Cyclic interrupt 6 (default interval: 50 ms) Cyclic interrupt 7 (default interval: 20 ms) Cyclic interrupt 8 (default interval: 10 ms)

7 8 9 10 11 12 13 14 15

Cyclic interrupts

OB40 OB41 OB42 OB43 OB44 OB45 OB46 OB47

Hardware interrupt 0 Hardware interrupt 1 Hardware interrupt 2 Hardware interrupt 3 Hardware interrupt 4 Hardware interrupt 5 Hardware interrupt 6 Hardware interrupt 7

16 17 18 19 20 21 22 23

Hardware interrupts

OB55 Status interrupt 2 DPV1 interrupts

OB56 Update interrupt 2

OB57 Manufacturer specific interrupt 2

长沙工控帮教育科技有限公司整理

(19)

OB Start Event Default Priority Class Explanation OB 61

OB 62 OB 63 OB 64

Synchronous Cycle Interrupt 1 Synchronous Cycle Interrupt 2 Synchronous Cycle Interrupt 3 Synchronous Cycle Interrupt 4

25 25 25 25

Synchronous Cycle Interrupt

OB70 OB72 OB 73

I/O redundancy error (only in H CPUs) CPU redundancy error (only in H CPUs) Communication redundancy error OB (only in H CPUs)

25 28 25

Redundancy error interrupts

OB80 OB81 OB82 OB83 OB84 OB85 OB86 OB87 OB 88

Time error Power supply fault Diagnostic interrupt

Insert/remove-module interrupt CPU hardware fault

Program error

Failure of an expansion rack, DP master system or station for distributed I/Os Communication error

Processing interrupt

26, 28 1) 25, 28 1) 25, 28 1) 25, 28 1) 25, 28 1) 25, 28 1) 25, 28 1) 25, 28 1) 28

Asynchronous error interrupts

OB90 Warm or cold restart or delete a block being executed in OB90 or load an OB90 on the CPU or terminate OB90

29 2) Background cycle

OB100 OB101 OB102

Warm restart Hot restart Cold restart

27 1) 27 1) 27 1)

Startup

OB121

OB122

Programming error

I/O access error

Priority of the OB causing the error Priority of the OB causing the error

Synchronous error interrupts

1) Priority classes 27 and 28 are valid in the priority class model of the startup.

2) Priority class 29 corresponds to priority 0.29. This means that the background cycle has lower priority than the free cycle.

长沙工控帮教育科技有限公司整理

(20)

1.2 Program Cycle Organization Block (OB1)

Description

The operating system of the S7 CPU executes OB1 periodically. When OB1 has been executed, the operating system starts it again. Cyclic execution of OB1 is started after the startup has been completed. You can call other function blocks (FBs, SFBs) or functions (FCs, SFCs) in OB1.

Understanding the Operation of OB1

OB1 has the lowest priority of all of the OBs whose run-times are monitored, in other words, all of the other OBs except OB90 can interrupt the execution of OB1.

The following events cause the operating system to call OB1:

• The startup is completed.

• The execution of OB1 (the previous cycle) has finished.

When OB1 has been executed, the operating system sends global data. Before restarting OB1, the operating system writes the process-image output table to the output modules, updates the process-image input table and receives any global data for the CPU.

S7 monitors the maximum scan time, ensuring a maximum response time. The value for the maximum scan time is preset to 150 ms. You can set a new value or you can restart the time monitoring anywhere within your program with SFC43

"RE_TRIGR." If your program exceeds the maximum cycle time for OB1, the operating system calls OB80 (time error OB); if OB80 is not programmed, the CPU changes to the STOP mode.

Apart from monitoring the maximum scan time, it is also possible to guarantee a minimum scan time. The operating system will delay the start of a new cycle (writing of the process image output table to the output modules) until the minimum scan time has been reached.

Refer to the manuals /70/ and /101/ for the ranges of the parameters "maximum"

and "minimum" scan time. You change parameter settings using STEP 7.

长沙工控帮教育科技有限公司整理

(21)

Local Data for OB1

The following table describes the temporary (TEMP) variables for OB1. The variable names are the default names of OB1.

Variable Type Description

OB1_EV_CLASS BYTE Event class and identifiers: B#16#11: OB1 active OB1_SCAN_1 BYTE • B#16#01: completion of a warm restart

• B#16#02: completion of a hot restart

• B#16#03: completion of the main cycle

• B#16#04: completion of a cold restart

• B#16#05: first OB1 cycle of the new master CPU after master-reserve switchover and STOP of the previous master

OB1_PRIORITY BYTE Priority class 1

OB1_OB_NUMBR BYTE OB number (01)

OB1_RESERVED_1 BYTE Reserved

OB1_RESERVED_2 BYTE Reserved

OB1_PREV_CYCLE INT Run time of previous scan (ms)

OB1_MIN_CYCLE INT Minimum cycle time (ms) since the last startup OB1_MAX_CYCLE INT Maximum cycle time (ms) since the last startup OB1_DATE_TIME DATE_AND_TIME DATE_AND_TIME of day when the OB was called

长沙工控帮教育科技有限公司整理

(22)

1.3 Time-of-Day Interrupt Organization Blocks (OB10 to OB17)

Description

STEP 7 provides up to eight OBs (OB10 to OB17) which can be run once or periodically. You can assign parameters for CPU using SFCs or STEP 7 so that these OBs are processed at the following intervals:

• Once

• Every minute

• Hourly

• Daily

• Weekly

• Monthly

• At the end of each month

Understanding the Operation of Time-of-Day Interrupt OBs

To start a time-of-day interrupt, you must first set and then activate the interrupt.

The three following start possibilities exist:

• Automatic start of the time-of-day interrupt. This occurs once you have set and then activated the time-of-day interrupt with STEP 7. The following table shows the basic possibilities for activating a time-of-day interrupt with STEP 7.

• You set the time-of-day interrupt with STEP 7 and then activate it by calling SFC30 "ACT-TINT" in your program.

• You set the time-of-day interrupt by calling SFC28 "SET_TINT" and then activate it by calling SFC30 "ACT_TINT."

Interval Description

Not activated The time-of-day interrupt is not executed, even when loaded in the CPU. It can be activated by calling SFC30.

Activated once only The time-of-day OB is canceled automatically after it runs the one time specified.

Your program can use SFC28 and SFC30 to reset and reactivate the OB.

Activated periodically When the time-of-day interrupt occurs, the CPU calculates the next start time for the time-of-day interrupt based on the current time of day and the period.

The behavior of the time-of-day interrupt when you move the clock forwards or backwards is described in /234/.

长沙工控帮教育科技有限公司整理

(23)

Note

If you configure a time-of-day interrupt in such a way that the corresponding OB is to be processed once, the DATE_AND_TIME must not be in the past (relative to the real-time clock of the CPU).

If you configure a time-of-day interrupt in such a way that the corresponding OB is to be processed periodically, the start DATE_AND_TIME, however, are in the past, then the time- of-day interrupt will be processed the next time it is due. This is illustrated in the following figure.

You can disable or delay and re-enable time-of-day interrupts using SFCs 39 to 42.

Preset start time

Current time

Preset interval

Point at which the time-of-day interrupt OB is first executed.

Conditions That Affect Time-of-Day Interrupt OBs

Since a time-of-day interrupt occurs only at specified intervals, certain conditions can affect the operation of the OB during the execution of your program. The following table shows some of these conditions and describes the effect on the execution of the time-of-day interrupt OB.

Condition Result

Your program calls SFC29 (CAN_TINT) and cancels a time-of-day interrupt.

The operating system clears the start event

(DATE_AND_TIME) for the time-of-day interrupt. You must set the start event again and activate it before the OB can be called again.

Your program attempted to activate a time-of- day interrupt OB, but the OB was not loaded on the CPU.

The operating system calls OB85. If OB85 has not been programmed (loaded on the CPU), the CPU changes to the STOP mode.

When synchronizing or correcting the system clock of the CPU, you set the time ahead and skipped the start event date or time for the time- of-day OB.

The operating system calls OB80 and encodes the number of the time-of-day OB and the start event information in OB80.

The operating system then runs the time-of-day OB once, regardless of the number of times that this OB

长沙工控帮教育科技有限公司整理

(24)

Condition Result When synchronizing or correcting the system

clock of the CPU, the time was set back so that the start event, date, or time for the OB is repeated.

If the time-of-day OB had already been activated before the clock was set back, it is not called again.

The CPU runs through a warm or cold restart. Any time-of-day OB that was configured by an SFC is changed back to the configuration that was specified in STEP 7.

If you have configured a time-of-day interrupt for a one- time start of the corresponding OB, set it with STEP 7, and activated it, the OB is called once after a warm or cold restart of the operating system, if the configured start time is in the past (relative to the real-time clock of the CPU).

A time-of-day OB is still being executed when the start event for the next interval occurs.

The operating system calls OB80. If OB80 is not programmed, the CPU changes to the STOP mode.

If OB80 is loaded, both OB80 and the time-of-day interrupt OB are first executed and then second the requested interrupt is executed.

长沙工控帮教育科技有限公司整理

(25)

Local Data for Time-of-Day Interrupt OBs

The following table describes the temporary (TEMP) variables for a time-of-day interrupt OB. The variable names are the default names of OB10.

Variable Type Description

OB10_EV_CLASS BYTE Event class and identifiers: B#16#11 = interrupt is active

OB10_STRT_INFO BYTE B#16#11: start request for OB10 (B#16#12: start request for OB11)

: :

(B#16#18: start request for OB17) OB10_PRIORITY BYTE Assigned priority class; default 2

OB10_OB_NUMBR BYTE OB number (10 to 17)

OB10_RESERVED_1 BYTE Reserved

OB10_RESERVED_2 BYTE Reserved

OB10_PERIOD_EXE WORD The OB is executed at the specified intervals:

W#16#0000: once

W#16#0201: once every minute W#16#0401: once hourly W#16#1001: once daily W#16#1201: once weekly W#16#1401: once monthly W#16#1801: once yearly W#16#2001: end of month

OB10_RESERVED_3 INT Reserved

OB10_RESERVED_4 INT Reserved

OB10_DATE_TIME DATE_AND_TIME DATE_AND_TIME of day when the OB was called

长沙工控帮教育科技有限公司整理

(26)

1.4 Time-Delay Interrupt Organization Blocks (OB20 to OB23)

Description

S7 provides up to four OBs (OB20 to OB23) which are executed after a specified delay. Every time-delay OB is started by calling SFC32 (SRT_DINT). The delay time is an input parameter of the SFC.

When your program calls SFC32 (SRT_DINT), you provide the OB number, the delay time, and a user-specific identifier. After the specified delay, the OB starts.

You can also cancel the execution of a time-delay interrupt that has not yet started.

Understanding the Operation of Time-Delay Interrupt OBs

After the delay time has expired (value in milliseconds transferred to SFC32 together with an OB number), the operating system starts the corresponding OB.

To use the time-delay interrupts, you must perform the following tasks:

• You must call SFC32 (SRT_DINT).

• You must download the time-delay interrupt OB to the CPU as part of your program.

Time-delay OBs are executed only when the CPU is in the RUN mode. A warm or a cold restart clears any start events for the time-delay OBs. If a time-delay interrupt has not started, you can use SFC33 (CAN_DINT) to cancel its execution.

The delay time has a resolution of 1 ms. A delay time that has expired can be started again immediately. You can query the status of a delay-time interrupt using SFC34 (QRY_DINT).

The operating system calls an asynchronous error OB if one of the following events occur:

• If the operating system attempts to start an OB that is not loaded and you specified its number when calling SFC32 "SRT_DINT."

• If the next start event for a time-delay interrupt occurs before the time-delay OB has been completely executed.

You can disable or delay and re-enable delay interrupts using SFCs 39 to 42.

长沙工控帮教育科技有限公司整理

(27)

Local Data for Time-Delay Interrupt OBs

The following table describes the temporary (TEMP) variables for a time-delay interrupt OB. The variable names are the default names of OB20.

Variable Type Description

OB20_EV_CLASS BYTE Event class and identifiers:

B#16#11: interrupt is active OB20_STRT_INF BYTE B#16#21: start request for OB20

(B#16#22: start request for OB21) (B#16#23: start request for OB22) (B#16#24: start request for OB23)

OB20_PRIORITY BYTE Assigned priority class: default values 3 (OB20) to 6 (OB23)

OB20_OB_NUMBR BYTE OB number (20 to 23)

OB20_RESERVED_1 BYTE Reserved

OB20_RESERVED_2 BYTE Reserved

OB20_SIGN WORD User ID: input parameter SIGN from the call for SFC32 (SRT_DINT)

OB20_DTIME TIME Configured delay time in ms

OB20_DATE_TIME DATE_AND_TIME DATE_AND_TIME of day when the OB was called

长沙工控帮教育科技有限公司整理

(28)

1.5 Cyclic Interrupt Organization Blocks (OB30 to OB38)

Description

S7 provides up to nine cyclic interrupt OBs (OB30 to OB38) which interrupt your program at fixed intervals. The following table shows the default intervals and priority classes for the cyclic interrupt OBs.

OB Number Default Interval Default Priority Class

OB30 5 s 7

OB31 2 s 8

OB32 1 s 9

OB33 500 ms 10

OB34 200 ms 11

OB35 100 ms 12

OB36 50 ms 13

OB37 20 ms 14

OB38 10 ms 15

Understanding the Operation of Cyclic Interrupt OBs

The equidistant start times of the cyclic interrupt OBs are determined by the interval and the phase offset. Refer to /234/ for the relationship between the start time, time cycle, and phase offset of an OB.

Note

You must make sure that the run time of each cyclic interrupt OB is significantly shorter than its interval. If a cyclic interrupt OB has not been completely executed before it is due for execution again because the interval has expired, the time error OB (OB80) is started. The cyclic interrupt that caused the error is executed later.

You can disable or delay and re-enable cyclic interrupts using SFCs 39 to 42 Refer to the specifications of your specific CPU for the range of the parameters interval, priority class, and phase offset. You can change the parameter settings using STEP 7.

长沙工控帮教育科技有限公司整理

(29)

Local Data for Cyclic Interrupt OBs

The following table describes the temporary (TEMP) variables for a cyclic interrupt OB. The variable names are the default names of OB35.

Variable Type Description

OB35_EV_CLASS BYTE Event class and identifiers

B#16#11: interrupt is active

OB35_STRT_INF BYTE B#16#30: Start request for cyclic interrupt OB with special criteria (only for H-CPUs and there only if explicitly configured for them)

B#16#31 : start request for OB30 :

B#16#36 : start request for OB35 :

B#16#39 : start request for OB38 OB35_PRIORITY BYTE Assigned priority class: defaults 7 (OB30) to 15

(OB38)

OB35_OB_NUMBR BYTE OB number (30 to 38)

OB35_RESERVED_1 BYTE Reserved

OB35_RESERVED_2 BYTE Reserved

OB35_PHASE_OFFSET WORD Phase offset [ms]

OB35_RESERVED_3 INT Reserved

OB35_EXC_FREQ INT Interval in milliseconds

OB35_DATE_TIME DATE_AND_TIME DATE_AND_TIME of day when the OB was called

长沙工控帮教育科技有限公司整理

(30)

1.6 Hardware Interrupt Organization Blocks (OB40 to OB47)

Description

S7 provides up to eight independent hardware interrupts each with its own OB.

By assigning parameters with STEP 7, you specify the following for each signal module that will trigger hardware interrupts:

• Which channels trigger a hardware interrupt under what conditions.

• Which hardware interrupt OB is assigned to the individual groups of channels (as default, all hardware interrupts are processed by OB40).

With CPs and FMs, you assign these parameters using their own software.

You select the priority classes for the individual hardware interrupt OBs using STEP 7.

Understanding the Operation of Hardware Interrupt OBs

After a hardware interrupt has been triggered by the module, the operating system identifies the slot and the corresponding hardware interrupt OB. If this OB has a higher priority than the currently active priority class, it will be started. The channel- specific acknowledgement is sent after this hardware interrupt OB has been executed.

If another event that triggers a hardware interrupt occurs on the same module during the time between identification and acknowledgement of a hardware interrupt, the following applies:

• If the event occurs on the channel that previously triggered the hardware interrupt, then the new interrupt is lost. This is illustrated in the following figure based on the example of a channel of a digital input module. The triggering event is the rising edge. The hardware interrupt OB is OB40.

Process signal

OB40 Execution of OB40

These hardware interrupts are not detected

• If the event occurs on another channel of the same module, then no hardware interrupt can currently be triggered. This interrupt, however, is not lost, but is triggered after the acknowledgement of the currently active hardware interrupt.

长沙工控帮教育科技有限公司整理

(31)

If a hardware interrupt is triggered and its OB is currently active due to a hardware interrupt from another module, the new request is recorded and the OB processed when it is free.

You can disable or delay and re-enable hardware interrupts using SFCs 39 to 42.

You can assign parameters for the hardware interrupts of a module not only with STEP 7 but also with SFCs 55 to 57.

Local Data for Hardware Interrupt OBs

The following table describes the temporary (TEMP) variables for a hardware interrupt OB. The variable names are the default names of OB40.

Variable Type Description

OB40_EV_CLASS BYTE Event class and identifiers:

B#16#11: interrupt is active

OB40_STRT_INF BYTE • B#16#41: interrupt via interrupt line 1

• B#16#42: interrupt via interrupt line 2 (only with an S7-400)

• B#16#43: interrupt via interrupt line 3 (only with an S7-400)

• B#16#44: interrupt via interrupt line 4 (only with an S7-400)

• B#16#45: WinAC: interrupt triggered via PC OB40_PRIORITY BYTE Assigned priority class: defaults 16 (OB40) to 23 (OB47)

OB40_OB_NUMBR BYTE OB number (40 to 47)

OB40_RESERVED_1 BYTE Reserved

OB40_IO_FLAG BYTE Input module: B#16#54

Output module: B#16#55

OB40_MDL_ADDR WORD Logical base address of the module that triggers the interrupt OB40_POINT_ADDR DWORD • For digital modules:

bit field with the statuses of the inputs on the module (Bit 0 corresponds to the first input)

• For analog modules:

Bit field, informing which channel has exceeded which limit (for detailed info on the structure refer to /71/ or /101/).

• For CPs or IMs:

Module interrupt status (not user relevant) OB40_DATE_TIME DATE_AND_TIME DATE_AND_TIME of day when the OB was called

Note

长沙工控帮教育科技有限公司整理

(32)

1.7 Status Interrupt OB (OB 55)

Note

A status interrupt OB (OB 55) is only available for DPV1 capable CPUs.

Description

The CPU operating system calls OB55 if a status interrupt was triggered via the slot of a DPV1 slave. This might be the case if a component (module or rack) of a DPV1 slaves changes its operating mode, for example from RUN to STOP. For precise information on events that trigger a status interrupt, refer to the

documentation of the DPV1 slave‘s manufacturer.

Local data of the status interrupt OB

The table below contains the temporary (TEMP) variables of the status interrupt OB. Selected variable names are the default names of OB55.

Variable Data type Description

OB55_EV_CLASS BYTE Event class and identifiers:

B#16#11 (upcoming event) OB55_STRT_INF BYTE B#16#55 (Start request for OB55) OB55_PRIORITY BYTE Configured priority class, default values 2

OB55_OB_NUMBR BYTE OB number (55)

OB55_RESERVED_1 BYTE Reserved

OB55_IO_FLAG BYTE Input module: B#16#54

Output module: B#16#55

OB55_MDL_ADDR WORD logical base address of the interrupt triggering component (module)

OB55_LEN BYTE Data block length supplied by the interrupt OB55_TYPE BYTE ID for the interrupt type “Status interrupt”

OB55_SLOT BYTE slot number of the interrupt triggering component (module)

OB55_SPEC BYTE Specifier

• Bit 0 to 1: Interrupt specifier

• Bit 2: Add_Ack

• Bit 3 to 7: Seq. no.e

OB55_DATE_TIME DATE_AND_TIME Date and time at which the OB was called

Note

You can obtain the full auxiliary information on the interrupt the DP message frame contains by calling SFB54 "RALRM" with OB55.

长沙工控帮教育科技有限公司整理

(33)

1.8 Update Interrupt OB (OB 56)

Note

A update interrupt OB (OB 56) is only available for DPV1 capable CPUs.

Description

The CPU operating system calls OB56 if an update interrupt was triggered via the slot of a DPV1 slave. This can be the case if you have changed the parameters for the slot of a DPV1 slave (via local or remote access). For precise information on events that trigger an update interrupt, refer to the documentation of the DPV1 slave‘s manufacturer.

Local data of the update interrupt OB

The table below contains the temporary (TEMP) variables of the update interrupt OB. Selected variable names are the default names of OB56.

Variable Data type Description

OB56_EV_CLASS BYTE Event class and identifiers:

B#16#11 (upcoming event) OB56_STRT_INF BYTE B#16#56 (Start request for OB56) OB56_PRIORITY BYTE Configured priority class, default values 2

OB56_OB_NUMBR BYTE OB number (56)

OB56_RESERVED_1 BYTE Reserved

OB56_IO_FLAG BYTE Input module: B#16#54

Output module: B#16#55

OB56_MDL_ADDR WORD logical base address of the interrupt triggering component (module)

OB56_LEN BYTE Data block length supplied by the interrupt OB56_TYPE BYTE ID for the interrupt type “Update interrupt”

OB56_SLOT BYTE slot number of the interrupt triggering component (module)

OB56_SPEC BYTE Specifier

• Bit 0 to 1: Interrupt specifier

• Bit 2: Add_Ack

• Bit 3 to 7: Seq. no.

OB56_DATE_TIME DATE_AND_TIME Date and time at which the OB was called

Note

You can obtain the full auxiliary information on the interrupt the DP message frame contains by calling SFB54 "RALRM" with OB55.

长沙工控帮教育科技有限公司整理

(34)

1.9 Manufacturer Specific Interrupt OB (OB57)

Note

An OB for manufacturer specific interrupts(OB57) is only available for DPV1 capable CPUs.

Description

The CPU operating system calls OB57 if an manufacturer specific interrupt was triggered via the slot of a DPV1 slave.

Local data of the OB for manufacturer specific interrupts

The table below contains the temporary (TEMP) variables of the OB for

manufacturer specific interrupt interrupts. Selected variable names are the default names of OB57.

Variable Data type Description

OB57_EV_CLASS BYTE Event class and identifiers:

B#16#11 (upcoming event) OB57_STRT_INF BYTE B#16#57 (Start request for OB57) OB57_PRIORITY BYTE Configured priority class, default values 2

OB57_OB_NUMBR BYTE OB number (57)

OB57_RESERVED_1 BYTE Reserved

OB57_IO_FLAG BYTE Input module: B#16#54

Output module: B#16#55

OB57_MDL_ADDR WORD logical base address of the interrupt triggering component (module)

OB57_LEN BYTE Data block length supplied by the interrupt

OB57_TYPE BYTE ID for the interrupt type “Manufacturer specific interrupt”

OB57_SLOT BYTE slot number of the interrupt triggering component (module)

OB57_SPEC BYTE Specifier

• Bit 0 to 1: Interrupt specifier

• Bit 2: Add_Ack

• Bit 3 to 7: Seq. no.

OB57_DATE_TIME DATE_AND_TIME Date and time at which the OB was called

Note

You can obtain the full auxiliary information on the interrupt the DP message frame contains by calling SFB54 "RALRM" with OB57.

长沙工控帮教育科技有限公司整理

(35)

1.10 Multicomputing Interrupt Organization Block (OB60)

Description

Using the multicomputing interrupt, you can make sure that the reaction of the CPUs is synchronized to an event during multicomputing. In contrast to hardware interrupts triggered by signal modules, the multicomputing interrupt can only be output by CPUs.

Understanding the Operation of Multicomputing Interrupt OBs

A multicomputing interrupt is triggered by calling SFC35 "MP_ALM." During multicomputing, this brings about a synchronized OB60 start on all CPUs of the bus segment unless you have disabled OB60 (with SFC39 "DIS_IRT") or delayed it (with SFC41 "DIS_AIRT"). If you have not loaded OB60 on a CPU, the CPU returns to the last priority class before the interrupt and continues program execution there. In single processor operation and when using segmented racks, OB60 is only started on the CPU on which you called SFC35 "MP_ALM."

When your program calls SFC35 "MP_ALM," you supply a job ID. This ID is transferred to all CPUs. This allows you to react to a specific event. If you program OB60 differently on the various CPUs, this may result in different execution times for the OB. In this case, the CPUs return to the interrupted priority class at different times. If the next multicomputing interrupt is output by a CPU while another CPU is still busy executing the OB60 of the previous multicomputing interrupt, then OB60 is not started either on the requesting or on any other CPU belonging to the bus segment. This is illustrated in the following figure taking the example of two CPUs.

You are informed of the outcome by the function value of the called SFC35.

CPU 1:

CPU 2:

OB60 execution

OB60 execution OB60 execution

Cycle

OB60 execution

Cycle

"CALL SFC35"

"CALL SFC35" "CALL SFC35"

长沙工控帮教育科技有限公司整理

(36)

Local Data for Multicomputing Interrupt OBs

The following table describes the temporary (TEMP) variables of the

multicomputing interrupt OB. The variable names are the default names of OB60.

Variable Data Type Description

OB60_EV_CLASS BYTE Event class and IDs:

B#16#11: Interrupt is active

OB60_STRT_INF BYTE • B#16#61:

Multicomputing interrupt triggered by own CPU

• B#16#62:

Multicomputing interrupt triggered by another CPU OB60_PRIORITY BYTE Assigned Priority class: default 25

OB60_OB_NUMBR BYTE OB number: 60

OB60_RESERVED_1 BYTE Reserved

OB60_RESERVED_2 BYTE Reserved

OB60_JOB INT Job ID: input variable JOB of SFC35 "MP_ALM"

OB60_RESERVED_3 INT Reserved

OB60_RESERVED_4 INT Reserved

OB60_DATE_TIME DATE_AND_TIME DATE_AND_TIME of day at which the OB was called.

长沙工控帮教育科技有限公司整理

(37)

1.11 Synchronous Cycle Interrupt OBs (OB 61 to OB 64)

Description

Synchronous cycle interrupts give you the option of starting programs in synchronous cycle with the DP cycle. OB 61 serves as an interface OB to the synchronous cycle interrupt TSAL1. You can set the priority for OB 61 between 0 (OB deselected) and from 2 to 26.

Local Data for the Synchronous Cycle Interrupt OBs

The following table describes the temporary (TEMP) variables of the synchronous cycle interrupt OBs. The variable names are the default names of OB 61.

Variable Data Type Description

OB61_EV_CLASS BYTE Event class and IDs:

B#16#11: Interrupt is active OB61_STRT_INF BYTE B#16#64: Start request for OB 61

:

B#16#67: Start request for OB 64 OB61_PRIORITY BYTE Assigned Priority class; default: 25

OB61_OB_NUMBR BYTE OB number: 61 … 64

OB61_RESERVED_1 BYTE Reserved

OB61_RESERVED_2 BYTE Reserved

OB61_GC_VIOL BOOL GC violation

OB61_FIRST BOOL First use after startup or stop status

OB61_MISSED_EXEC BYTE Number of failed starts of OB 61 since last execution of OB 61

OB61_DP_ID BYTE DP master system ID of the synchronous DP master system

OB61_RESERVED_3 BYTE Reserved

OB61_RESERVED_4 WORD Reserved

OB61_RESERVED_5 WORD Reserved

OB61_DATE_TIME DATE_AND_TIME DATE_AND_TIME of day at which the OB was called.

长沙工控帮教育科技有限公司整理

(38)

1.12 I/O Redundancy Error OB (OB70)

Note

The I/O redundancy error OB (OB70) can only be used with H CPUs.

Description

The operating system of the H CPU calls OB70 when there is a loss of redundancy on PROFIBUS DP (for example, a bus failure for the active DP master or when an error occurs in the interface module of the DP slave) or when the active DP master of DP slaves with connected I/Os changes.

The CPU does not change to the STOP mode if a start event occurs and OB70 is not programmed. If OB70 is loaded and if the H system is in the redundant mode, OB70 is executed on both CPUs. The H system remains in the redundant mode.

Local Data of the I/O Redundancy OB

The following table contains the temporary (TEMP) variables of the I/O redundancy error OB. The variable names selected are the default names of OB70.

Variable Type Description

OB70_EV_CLASS BYTE Event class and IDs:

• B#16#72: outgoing event

• B#16#73: incoming event OB70_FLT_ID BYTE Error code (possible values:

B#16#A2, B#16#A3

OB70_PRIORITY BYTE Priority class; can be assigned via STEP 7 (hardware configuration)

OB70_OB_NUMBR BYTE OB number (70)

OB70_RESERVED_1 WORD Reserved

OB70_INFO_1 WORD Dependent on error code

OB70_INFO_2 WORD Dependent on error code

OB70_INFO_3 WORD Dependent on error code

OB70_DATE_TIME DATE_AND_TIME DATE_AND_TIME at which the OB was called

The following table shows which event resulted in OB70 being started.

OB70_FLT_ID Start Event of OB70

B#16#A2 Failure of a DP master or a DP master system respectively.

B#16#A3 Loss of redundancy / Return of redundancy of a DP slave.

长沙工控帮教育科技有限公司整理

(39)

The variables that depend on the error code have the following significance:

Error code Bit Meaning

B#16#A2

OB70_INFO_1:

OB70_INFO_2:

OB70_INFO_3: 0 to 7:

8 to 15:

Logical base address of the affected DP master Reserved

Reserved

DP master system ID of the affected DP master B#16#A3

OB70_INFO_1:

OB70_INFO_2:

OB70_INFO_3

0 to 14:

15:

0 to 7:

8 to 15:

Logical base address of the DP master Affected DP Slave:

Logical base address, if an S7 slave is used, or diagnostic address if a DP norm slave is used.

I/O identification Affected DP slave:

Number of the DP station DP master system ID

Note

If you are using a DPV1 capable CPU you can obtain additional information on the interrupt with the help of SFB54 "RALRM" which exceeds the start information of the OB. This also applies when you operate the DP Master in S7 compatible mode.

长沙工控帮教育科技有限公司整理

(40)

1.13 CPU Redundancy Error OB (OB72)

Note

The CPU redundancy error OB (OB72) exists only with H CPUs.

Description

The operating system of the H CPU calls OB72 when one of the following events occurs:

• Loss of CPU redundancy

• Reserve-master switchover

• Synchronization error

• Error in a SYNC module

• Updating aborted

• Comparison error (for example, RAM, PIQ)

OB72 is executed by all CPUs that are in the RUN or STARTUP mode following a suitable start event.

Local Data of the CPU Redundancy Error OB

The following table contains the temporary (TEMP) variables of the CPU

redundancy error OB. The default names of OB72 have been used as the variable names.

Variable Type Description

OB72_EV_CLASS BYTE Event class and IDs:

• B#16#78: outgoing event

• B#16#73, B#16#75, B#16#79: incoming event

OB72_FLT_ID BYTE Error code (possible values: B#16#01, B#16#02,

B#16#03, B#16#20, B#16#21, B#16#22, B#16#23, B#16#31, B#16#33, B#16#34, B#16#35, B#16#40, B#16#41, B#16#42, B#16#43, B#16#44, B#16#50, B#16#51, B#16#52, B#16#53, B#16#54, B#16#55, B#16#56, B#16#C1, B#16#C2)

OB72_PRIORITY BYTE Priority class; can be assigned via STEP 7 (hardware configuration)

OB72_OB_NUMBR BYTE OB number (72)

长沙工控帮教育科技有限公司整理

參考文獻

相關文件

Like the governments of many advanced economies which have formulated strategies to promote the use of information technology (IT) in learning and teaching,

Now, nearly all of the current flows through wire S since it has a much lower resistance than the light bulb. The light bulb does not glow because the current flowing through it

This kind of algorithm has also been a powerful tool for solving many other optimization problems, including symmetric cone complementarity problems [15, 16, 20–22], symmetric

Briefing Session on the Initial Recommendations for the Ultimate Way Forward of the Business, Accounting and Financial Studies (BAFS) Curriculum and Assessment Event Date &

The manufacturing cycle time (CT) of completing the TFT-LCD processes is about 9~13 days which is the summation of about 5-7 days for Array process, 3-5 days for Cell process and 1

“A Comprehensive Model for Assessing the Quality and Productivity of the Information System Function Toward a Theory for Information System Assessment.”,

According to analysis results, the system satisfaction have nearly 43% variance explained by system quality, information quality, training experience and

The exploration of the research can be taken as a reference that how to dispose the resource when small and medium enterprise implement management information system.. The