Siemens S5-155U User Manual

4 (1)

SIMATIC S5

S5-155U

CPU 948

Programming Guide

Order No. 6ES5 998-3PR21

Release 03

Introduction

User Program

Program Execution

Operating Statuses and Program

Execution Levels

Interrupt and Error Diagnosis

Integrated Special Functions

Extended Data Block DX 0

Memory Assignment and

Memory Organization

Memory Access Using

Absolute Addresses

Multiprocessor Mode and

Communication in the S5-155U

PG Interfaces and

Functions

Appendix

Further Reading

List of Abbreviations,

List of Key Words,

List of Tables and Figures

The Pocket Guide CPU 922/CPU 928/CPU 928B/ CPU 948

Order No. 6ES5 997-3UA22 is included with this manual.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

C79000-H8576-C848-03

Copyright

Copyright © Siemens AG 1993 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.

Technical data subject to change.

Safety-related guidelines

This manual contains notices which you should observe to ensure your own personal safety, as well as to protect the product and connected equipment. These notices are highlighted in the manual by a warning triangle and are marked as follows according to the level of danger:

!

Warning

indicates that death, severe personal injury or substantial property damage can result

if proper precautions are not taken.

 

 

Caution

!

indicates that minor personal injury or property damage can result if proper

precautions are not taken.

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 equipment, systems and circuits in accordance with established safety practices and standards.

Siemens Aktiengesellschaft

6ES5 998-3PR21

EWK Elektronikwerk Karlsruhe

Printed in the Federal Republic of Germany

How to Use this Manual

Scope

This programming guide describes the following versions of the

CPU 948 and its system software:

Versions of the CPU 948

CPU 948-1 with 640 Kbytes of user memory, Order no. 6ES5 948-3UA11, from version A03

CPU 948-2 with 1 664 Kbytes of user memory, Order no. 6ES5 948-3UA21, from version A03

CPU 948 Programming Guide

 

C79000-H8576-C848-03

0 - 1

How to Use this Manual

Overview of the Chapters

Chapter 1

This informs you about the areas of application of the S5-155U

 

programmable controller with the CPU 948 and its device structure.

 

It explains the typical mode of operation of the CPU and illustrates

 

how a CPU program is structured.

 

The chapter also contains suggestions about how to tackle

 

programming and which characteristics of the CPU 948 are important

 

for programming.

 

If you have already worked with the CPU 946/947 and want to know

 

the differences between these CPUs and the CPU 948 you will find

 

this information in this chapter.

Chapter 2

This explains the components of a STEP 5 user program and how the

 

program can be structured.

Chapter 3

This is intended for readers who do not yet have much experience of

 

using the STEP 5 programming language. It therefore deals with the

 

basics of STEP 5 programming and explains the STEP 5 operations in

 

detail (with examples).

 

Experienced readers who may find that the information about specific

 

operations in the pocket guide is inadequate, can use Section 3.5 as a

 

reference section.

Chapter 4

This provides an overview of the modes and program execution levels

 

of the CPU 948. It provides you with detailed information about

 

various start-up modes and the associated organization blocks in

 

which you can program your routines for differrent start-up situations.

 

The chapter also explains the differences between the program

 

execution levels "cyclic processing", "time-controlled processing" and

 

"interrupt-driven processing" and which blocks are available for your

 

user program.

Chapter 5

This informs you about errors to be avoided when planning and

 

writing your STEP 5 programs.

 

The chapter tells you about the help you can obtain from the system

 

program for diagnosing errors and which reactions can be expected

 

and informs you about the blocks in which you can program reactions

 

to certain errors.

 

The chapter also explains the CPU 948 self-test.

 

CPU 948 Programming Guide

0 - 2

C79000-H8576-C848-03

 

How to Use this Manual

Chapter 6

This covers the special functions integrated in the system program. It

 

tells you how to use the special functions and how to call and assign

 

parameters to the special function OBs. The chapter also explains how

 

to recognize and deal with errors in the processing of a special

 

function.

Chapter 7

This describes the use of data block DX 0 and its structure. The

 

chapter informs you of the significance of the various DX 0

 

parameters. Based on examples, you will learn how to create data

 

block DX 0 or how to assign the parameters in a screen form.

Chapter 8

This is a reference section for experienced system users. It provides

 

information about the memory organization of the CPU 948 and

 

certain system data words which contain information that can be

 

called up by the user.

Chapter 9

This is also for experienced system users. The chapter explains how to

 

address data in certain memory areas using absolute addresses.

Chapter 10

This explains when the multiprocessor mode can be used and how

 

data can be exchanged between the CPUs and CPs. The chapter

 

provides information about programming for multiprocessor operation.

 

The remainder of the chapter provides detailed information and

 

application examples for exchanging larger amounts of data in the

 

multiprocessor mode (multiprocessor communication).

Chapter 11

This tells you how to connect your CPU to a PG and the functions

 

provided by the PG software to test your STEP 5 program.

Chapter 12

This contains the Appendix with technical data (e.g. typical operation

 

execution times, system runtimes, memory capacity) of the CPU 948.

CPU 948 Programming Guide

 

C79000-H8576-C848-03

0 - 3

How to Use this Manual

Chapter 13 This lists documentation for further reading.

Chapter 14

This is intended to help you find themes quickly and contains a list of

 

abbreviations and a list of keywords as well as lists of all the

 

numbered tables and figures.

 

CPU 948 Programming Guide

0 - 4

C79000-H8576-C848-03

How to Use this Manual

Conventions used in the text

 

To provide you with an overview of the contents of the pages, the

 

manual uses the following conventions in addition to a 2nd and 3rd

 

order of titles:

Entries in the margin

Entries in the margin are keywords printed in italics on the left-hand

 

edge of a page. They provide information about the contents of one or

 

more paragraphs on the page.

Fourth order entries

Fourth order entries are not numbered but appear in the margin in bold

 

face and identify a longer section of text.

 

The following conventions are also used.

Notes

Note

Important information is indicated in this format.

Instructions

Instructions (often a sequence of operations to be performed) are

 

represented in tables, e.g.

 

 

 

 

 

 

Step

Action

Result

 

 

 

 

 

1

Switch the mode selector

The CPU is in the stop

 

 

from RUN to STOP.

mode. The STOP LED is lit

 

 

 

continuously.

 

 

 

 

 

2

Hold the reset switch in the

An OVERALL RESET is

 

 

OVERALL RESET position;

requested. The STOP LED

 

 

at the same time, switch the

flashes quickly.

 

 

mode selector from STOP to

 

 

 

RUN and back to STOP.

 

 

 

 

 

CPU 948 Programming Guide

 

C79000-H8576-C848-03

0 - 5

How to Use this Manual

Reference tables

Specific information you may require at any time is contained in

 

numbered tables as shown in the following example and can be found

 

in the list of tables (refer to Chapter 14).

Table 3-2 Binary logic operations

Operation

Operand

Function

 

 

 

A

 

AND logic operation with scan for signal state "1"

O

 

OR logic operation with scan for signal state "1"

 

I 0.0 to 127.7

of an input in the PII

 

......

........

 

 

 

Examples

Examples, some of which cover several pages, are highlighted by a gray

 

frame. When the examples cover more than one page this is clearly

 

indicated.

Example 1: Calling and assigning parameters to a function block in the methods of representation STL and LAD/CSF in a program block

Method of representation STL

......

 

CPU 948 Programming Guide

0 - 6

C79000-H8576-C848-03

Contents

Contents

1

Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. 1-3

1.1

Area of Application for the S5-155U with the CPU 948 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-4

1.2

Typical Mode of Operation of a CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-6

1.3

The Programs in a CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-8

1.4

Which Operands are available to the User Program? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-12

1.5

How much Memory is available for the User Program? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-15

1.6

How to Tackle Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-16

1.7

Programming Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-19

1.8

What is New with the CPU 948? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-20

1.8.1

CPU 948, Version A01 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-20

1.8.2

CPU 948, Version A02 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-23

1.8.3

CPU 948, Version A03 and higher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-23

1.9

Converting User Programs of the CPU 928B for the CPU 948. . . . . . . . . . . . . . . . . . . . . . . . . .

1-24

2

User Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-3

2.1

STEP 5 Programming Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-4

2.1.1

The LAD, CSF, STL Methods of Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-4

2.1.2

Structured Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-5

2.1.3

STEP 5 Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-6

2.1.4

Number Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-8

2.1.5

STEP 5 Blocks and Storing them in Memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-12

2.2

Program, Organization and Sequence Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-16

2.2.1

Organization Blocks as User Interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-18

2.2.2

Organization Blocks for Special Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-22

2.3

Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-23

2.3.1

Structure of Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-24

CPU 948 Programming Guide

 

C79000-J8576-C848-03

i

2.3.2

Programming Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-26

2.3.3

Calling Function Blocks and Assigning Parameters to them . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-28

2.3.4

Special Function Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-33

2.4

Data Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-35

2.4.1

Creating Data Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-37

2.4.2

Opening Data Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-38

2.4.3

Special Data Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2-41

3

Program Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-3

3.1

Principle of Program Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-4

3.2

Program Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-5

3.3

Storing Program and Data Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-10

3.4

Processing the User Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-11

3.4.1

Definition of Terms used in Program Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-12

3.5

STEP 5 Operations with Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-15

3.5.1

Basic Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-19

3.5.2

Programming Examples in the STL, LAD and CSF Methods of Representation . . . . . . . . . . . .

3-34

3.5.3

Supplementary Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-49

3.5.4

Executive Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-59

3.5.5

Semaphore Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3-75

4

Operating Statuses and Program Execution Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-3

4.1

Introduction and Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-4

4.2

Program Execution Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-7

4.3

STOP Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-12

4.3.1

SOFT STOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-12

4.3.2

HARD STOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-16

4.3.3

OVERALL RESET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-17

4.4

START-UP Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-19

4.4.1

MANUAL and AUTOMATIC COLD RESTART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-20

4.4.2

MANUAL and AUTOMATIC WARM RESTART. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-21

4.4.3

Comparison between COLD RESTART and WARM RESTART . . . . . . . . . . . . . . . . . . . . . . . .

4-24

4.4.4

RETENTIVE COLD RESTART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-25

4.4.5

Comparison of COLD RESTART and RETENTIVE COLD RESTART . . . . . . . . . . . . . . . . . .

4-26

4.4.6

User Interfaces for Start-Up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-27

4.4.7

Extended AUTOMATIC WARM RESTART with the CPU 948 (HOT RESTART). . . . . . . . . .

4-30

4.4.8

Interruptions during START-UP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-31

4.5

RUN Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-33

4.5.1

Cyclic Program Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-34

4.5.2

Specifying Time and Interrupt-Driven Program Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-36

4.5.3

Time-Controlled Program Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-37

4.5.4

Interrupt-Driven Program Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4-45

 

CPU 948 Programming Guide

ii

C79000-J8576-C848-03

5

Interrupt and Error Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5-3

5.1

Frequent Errors in the User Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5-4

5.2

Error Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5-5

5.3

Procedure for Error Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5-8

5.4

Control Bits and Interrupt Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5-9

5.4.1

Control Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5-10

5.4.2

ISTACK Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5-14

5.4.3

Example of Error Diagnosis using the ISTACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5-19

5.5

Error Handling Using Organization Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5-20

5.6 Causes of Error and Reactions of the CPU. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-23

5.6.1 OB 19: Calling a Logic Block That Is Not Loaded (KB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-24 5.6.2 OB 19: Calling a Data Block That Is Not Loaded (KDB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-24 5.6.3 OB 23/24, OB 28/29:Timeout Error (QVZ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-25 5.6.4 OB 25: Addressing Error (ADF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-26 5.6.5 OB 26: Cycle Time Exceeded Error (ZYK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-27 5.6.6 OB 27: (Substitution Error SUF). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-28 5.6.7 OB 30: Parity Error and Timeout Error in the User Memory (PARE) . . . . . . . . . . . . . . . . . . . . 5-28 5.6.8 OB 32: Load and Transfer Error (TRAF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-29 5.6.9 OB 33: Collision of Timed Interrupts Error (WEFES/WEFEH) . . . . . . . . . . . . . . . . . . . . . . . . . 5-30 5.6.10 OB 34: Error with G DB/GX DX (FEDBX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-32 5.6.11 OB 35: Communication Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-32 5.6.12 OB 36: Error in Self-test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-33

5.7 Self-Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-34

5.7.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-34

5.7.2 Description of the Test Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-35

5.7.3 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-37

5.7.4 Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-38

6

Integrated Special Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-3

6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4 6.2 OB 121: Set/Read System Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 6.3 OB 122: "Disable Interrupts" On/Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 6.4 OB 124: Delete STEP 5 Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13 6.5 OB 125: Generate STEP 5 Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16 6.6 OB 126: Define, Transfer Process Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19 6.7 OB 129: Battery State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-24 6.8 OB 131: Delete ACCUs 1, 2, 3 and 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-25 6.9 OB 132/133: Roll-Up ACCU/Roll-Down ACCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-27 6.10 OB 141: "Disable Single Cyclic Timed Interrupts" On/Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-29 6.11 OB 142: "Delay All Interrupts" On/Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-32

CPU 948 Programming Guide

 

C79000-J8576-C848-03

iii

6.12

OB 143: "Delay Single Cyclic Timed Interrupts" On/Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-35

6.13

OB 150: Set/Read System Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-38

6.14

OB 151: Set/Read Time for Clock-Controlled Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-43

6.15

OB 153: Set/Read Time for Delayed Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-50

6.16

OB 180: Variable Data Block Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-53

6.17

OB 181: Test Data Blocks (DB/DX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-57

6.18

OB 182: Copy Data Area. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-59

6.19

OB 202 to 205: Multiprocessor Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-62

6.20

OB 222: Restart Cycle Monitoring Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-63

6.21

OB 223: Compare Start-Up Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-64

6.22

OB 254/255: Copy/Duplicate Data Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-65

7

Extended Data Block DX 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7-3

7.1

Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7-4

7.2

Structure of DX 0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7-5

7.2.1

Example of Input in DX 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7-7

7.3

Parameters for DX 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7-8

7.4

Examples of Parameter Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7-12

7.4.1

STEP 5 Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7-12

7.4.2

Parameter Assignment using the PG Screen Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7-14

8

Memory Assignment and Memory Organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-3

8.1

Structure of the Memory Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-4

8.2

Memory Assignment in the CPU 948 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-5

8.2.1

Memory Assignment for the System RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-6

8.2.2

Memory Assignment for the Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-8

8.3

User Memory Organization in the CPU 948. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-10

8.3.1

Block Headers in User Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-12

8.3.2

Block Address List in Data Block DB 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-13

8.3.3

RI/RJ Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-14

8.3.4

RS/RT Area. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-15

8.3.5

Bit Assignment of the System Data Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-18

8.3.6

Addressable System Data Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-42

 

CPU 948 Programming Guide

iv

C79000-J8576-C848-03

9

Memory Access Using Absolute Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . 9-3

9.1

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. 9-4

9.2

Memory Access via Address in ACCU 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. 9-8

9.2.1

LIR/TIR: Loading to or Transferring from a 16-Bit Memory Area Indirectly . . . . . . . . . . . . . .

. 9-9

9.2.2

Examples of Access to DW > 255 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9-15

9.2.3

LDI/TDI: Loading to or Transferring from a 32-Bit Memory Area Indirectly . . . . . . . . . . . . . .

9-17

9.3

Transferring Memory Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9-19

9.4

Operations with the Base Address Register (BR Register) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9-22

9.4.1

Operations for Transfer between Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9-23

9.4.2

Accessing the Local Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9-24

9.4.3

Accessing the Global Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9-25

9.4.4

Accessing the Dual-Port RAM Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9-29

10

Multiprocessor Mode and Communication in the S5-155U . . . . . . . . . . . . . . . . . . . . . . . . . .

10-3

10.1

Multiprocessor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-4

10.1.1

When to use the Multiprocessor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-4

10.1.2

What Communications Mechanisms are Available? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-4

10.1.3

Exchanging Data via IPC Flags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-5

10.1.4

Exchanging Data via Handling Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-8

10.1.5

What needs to be Programmed for the Multiprocessor Mode? . . . . . . . . . . . . . . . . . . . . . . . . . .

10-9

10.1.6

How to Create Data Block DB 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-9

10.1.7

Starting up in the Multiprocessor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-13

10.1.8

Test Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-14

10.2

Multiprocessor Communication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-15

10.2.1

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-15

10.2.2

How the Transmitter and Receiver are Identified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-16

10.2.3

Why Data is Buffered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-17

10.2.4

How the Buffer is Processed and Managed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-18

10.2.5

System Start-Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-21

10.2.6

Calling Communication OBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-22

10.2.7

How to Assign Parameters to Communication OBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-23

10.2.8

How to Evaluate the Output Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-24

10.3

Runtimes of the Communication OBs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-31

10.4

INITIALIZE Function (OB 200) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-33

10.4.1

Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-33

10.4.2

Call Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-35

10.4.3

Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-35

10.4.4

Output Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-38

10.5

SEND Function (OB 202) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-40

10.5.1

Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-40

10.5.2

Call Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-40

10.5.3

Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-40

10.5.4

Output Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-42

CPU 948 Programming Guide

 

C79000-J8576-C848-03

v

10.6 SEND TEST Function (OB 203) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-45

10.6.1 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-45

10.6.2 Call Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-45

10.6.3 Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-45

10.6.4 Output Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-45

10.7 RECEIVE Function (OB 204) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-47

10.7.1 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-47

10.7.2 Call Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-47

10.7.3 Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-47

10.7.4 Output Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-48

10.8 RECEIVE TEST Function (OB 205) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-51

10.8.1 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-51

10.8.2 Call Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-51

10.8.3 Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-51

10.8.4 Output Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-51

10.9

Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-53

10.9.1

Calling the Special Function OB using Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-53

10.9.2

Transferring Data Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-60

10.9.3

Extending the IPCFlag Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10-66

11

PG Interfaces and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-3

11.1

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-4

11.2

PG Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-5

11.2.1

Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-6

11.2.2

Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-7

11.2.3

Program Test. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-8

11.3

Serial Link PG - PLC via 1st or 2nd Serial Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-16

11.4

Parallel Operation of Two Serial PG Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-17

11.4.1

Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-19

11.4.2

Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-19

11.4.3

Sequence in Certain Operating Situations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-21

11.5

PG Functions via the S5 Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-26

11.5.1

Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-26

11.5.2

How the PG Functions Work via the S5 Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-28

11.5.3

Installation and Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-30

11.5.4

Condition Codes Indicating Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11-34

 

CPU 948 Programming Guide

vi

C79000-J8576-C848-03

12 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3

Appendix 1: Jumper Settings for System Interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 - 4

Appendix 2: Inserting and Removing the PG Submodule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 - 5

Appendix 3: Technical Data of the CPU 948, CPU 946/947 and CPU 928B. . . . . . . . . . . . . . . . . . . . 12 - 7

Appendix 4: Results IDs of some of the Special Function OBs in ACCU 1 . . . . . . . . . . . . . . . . . . . 12 - 10 Byte IDs in ACCU-1-LL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 - 10 Word IDs in ACCU-1-L. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 - 12

13 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 - 3

14 Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 - 1

List of Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 - 3

List of Key Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

14 - 5

List of Tables and Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 - 11

List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 - 11

List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 - 17

CPU 948 Programming Guide

 

C79000-J8576-C848-03

vii

Introduction

1

 

Contents of Chapter 1

1.1

Area of Application for the S5-155U with the CPU 948 . . . . . . . . . . . . . . . . . . . . . . . .

1 - 4

1.2

Typical Mode of Operation of a CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 6

1.3

The Programs in a CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 8

 

System program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 8

 

User program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 10

1.4

Which Operands are available to the User Program? . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 12

1.5

How much Memory is available for the User Program? . . . . . . . . . . . . . . . . . . . . . . .

1 - 15

1.6

How to Tackle Programming? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 16

1.7

Programming Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 19

1.8

What is New with the CPU 948?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 20

1.8.1

CPU 948, Version A01 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 20

1.8.2

CPU 948, Version A02 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 23

1.8.3

CPU 948, Version A03 and Higher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 - 23

1.9

Converting User Programs of the CPU 928B for the CPU 948 . . . . . . . . . . . . . . . . . .

1 - 24

CPU 948 Programming Guide

 

C79000-D8576-C848-03

1 - 1

1

Introduction

1

Aims of the manual

This manual is intended to provide specialized information about

 

programming the CPU 948 for users who already have basic

 

knowledge of programming PLCs and want to use the CPU 948 in the

 

S5-155U programmable controller. If you do not yet have this basic

 

knowledge, we strongly advise you read the documentation

 

introducing the programming language STEP 5 /3/ or take part in a

 

course at our training center. SIEMENS provides comprehensive

 

training for SIMATIC S5. For more detailed information, contact your

 

local SIEMENS office.

Contents of Chapter 1

Chapter 1 explains how to use the manual and deals with the areas of

 

application of the S5-155U programmable controller with the

 

CPU 948 and its structure.

 

The chapter explains the typical mode of operation of a CPU and the

 

structure of the CPU program.

 

You will also find a few suggestions about how to tackle

 

programming and will learn some of the features of the CPU 948

 

which are important for programming.

 

If you have already worked with the CPU 946/947 and would like to

 

know the differences between these modules and the CPU 948, refer

 

to Section 1.8.

 

Chapter 1 also informs you about differences between versions A01

 

and A02 of the CPU 948 and explains points you should remember

 

when converting "928B" programs for the CPU 948.

CPU 948 Programming Guide

 

C79000-D8576-C848-03

1 - 3

Area of Application for the S5-155U with the CPU 948

1.1Area of Application for the S5-155U with the CPU 948

SIMATIC S5 family

The S5-155U programmable controller belongs to the family of

 

SIMATIC S5 programmable controllers. With the CPU 948, it is the

 

most powerful multiprocessor unit for process automation (open and

 

closed loop control, signalling, monitoring, logging).

 

Owing to its modularity and high performance, it can be used for

 

medium to extremely large control systems as well as for complex

 

automation tasks at the plant and process supervision level.

Suitability

The S5-155U with the CPU 948 is particularly suitable for the

 

following:

 

∙ Tasks requiring fast bit and word-oriented processing and fast reaction

 

times, i.e. with extremely fast open and closed loop controls.

 

Examples of this are fast processes in mechanical engineering

 

(bottling plant, packing machines or similar systems) and in the

 

automobile industry.

 

∙ Tasks requiring an extremely high storage capacity and fast access

 

times, e.g. in the automobile industry, process and plant

 

engineering.

 

∙ Tasks requiring fast communication with other CPUs installed in

 

the PLC and operating in the multiprocessor mode and with CP

 

modules (e.g. when connected to bus systems, host computers, for

 

visualization, operation and monitoring).

 

∙ Complex tasks which can be handled efficiently and clearly using

 

the high level languages C and SCL.

 

CPU 948 Programming Guide

1 - 4

C79000-D8576-C848-03

Siemens S5-155U User Manual

Area of Application for the S5-155U with the CPU 948

Example of application

Fig. 1-1 illustrates the use of the S5-155U programmable controller in

a cement works.

1

PG 770

PG 770

PG 770

PG 770

PG 770

 

System management

Data base/

Quarry,

Coal mill,

Cement

 

 

logging

Raw meal silo,

Kiln

mills,

 

 

 

Crusher,

 

Dispatch

 

 

 

Raw mill

 

 

 

Service system

Control room

 

 

 

 

 

 

 

 

SINEC H1

bus

 

 

 

 

 

 

PG

770

Process data control

 

 

 

 

 

 

Operation and monitoring (COROS)

 

 

 

Process

 

 

 

 

 

 

 

data

 

 

 

 

 

 

 

editing

 

S5-155U

S5-155U

S5-155U

S5-155U

S5-155U

S5-155U

S5-155U

 

Crusher,

Raw mill

Coal mill

Heat

Clinker cooler

Telephone

Cement mills

 

Test station,

Raw meal

Dryer

exchanger

Clinker transport

system

Distribution

 

Limestone

silos

 

Rotary

Dust collector

Central

 

 

store

 

 

kiln

 

control room

 

 

Fig. 1-1 Example of application of the S5-155U with the CPU 948

CPU 948 Programming Guide

C79000-D8576-C848-03

1 - 5

Typical Mode of Operation of a CPU

1.2Typical Mode of Operation of a CPU

Mode of operation of a CPU The following modes of operation are possible in a CPU:

1.

2.

3.

Cyclic processing

Time-controlled processing

Interrupt-driven processing

Cyclic processing

This is the main part of all activities in the CPU. As the name already

 

 

 

 

 

says, the same operations are repeated in an endless cycle.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Cyclic processing can be divided into three main phases, as follows:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Phase

Sequence

 

 

CPU

 

 

 

 

Process

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

All the input modules assigned to the

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

CPU are scanned by the system

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

program and the values read in are

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

stored in the process image of the

 

Read in process image

 

 

 

Input I 1.3

 

inputs (PII).

 

 

 

 

 

 

Input I 1.4

 

 

of

the inputs

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Input I 1.5

 

The values contained in the PII are

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Evaluate input signals,

 

 

 

 

 

 

 

2

processed by the user program and the

 

set output signals

 

 

 

 

 

 

 

 

values to be output are entered in the

 

I 1.5

 

&

 

 

 

 

 

 

 

 

 

 

 

 

 

I 1.6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

process image of the outputs (PIQ).

 

I 1.4

 

 

 

= 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

&

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I 1.3

 

 

 

 

 

Q

3.1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The values contained in the process

 

 

 

 

 

 

 

 

 

Output Q 2.0

 

 

Output process image

 

 

 

3

image of the outputs are output by the

 

 

 

 

 

 

 

 

of

the outputs

 

 

 

 

 

 

Output Q 3.1

 

system program to the output modules

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Output Q 4.7

 

assigned to the CPU.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CPU 948 Programming Guide

1 - 6

C79000-D8576-C848-03

Typical Mode of Operation of a CPU

Time-controlled processing In addition to the cyclic processing, time-controlled processing is also available for processes requiring control signals at constant intervals,

e.g. non-time critical monitoring functions performed every second.

1

Interrupt-driven processing If the reaction to a particular process signal must be particularly fast, this should be handled with interrupt-driven processing. With, for example, a system interrupt, triggered via an interrupt generating module, you can activate a special processing section within your program.

Processing according to

The types of processing listed above are handled by the CPU

priority

according to their priority.

 

 

 

 

 

Since a fast reaction is required to a time or interrupt event, the CPU

 

 

 

 

 

 

 

 

 

 

interrupts cyclic processing to handle a time or interrupt event. Cyclic

 

 

 

 

 

processing therefore has the lowest priority.

 

 

 

 

 

Whether or not the time-controlled processing is more important than

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

the interrupt controlled processing depends, among other things, on

 

 

 

 

 

the particular task. For this reason, the priority of time and

 

 

 

 

 

interrupt-driven processing on the CPU 948 can be selected.

CPU 948 Programming Guide

 

C79000-D8576-C848-03

1 - 7

The Programs in a CPU

1.3The Programs in a CPU

System program

Update process image of the inputs

Output process image of the outputs

Manage memory

The program existing on every CPU is divided into the following:

the system program

and

the user program.

The system program organizes all the functions and sequences of the CPU which do not involve a specific control task (refer to Fig. 1-2).

Execute start-up

System

Call

 

 

user

program

processing

 

 

(inter-

 

faces)

Communication with

Handle errors

the PG

Fig. 1-2 Tasks of the system program

 

CPU 948 Programming Guide

1 - 8

C79000-D8576-C848-03

The Programs in a CPU

Tasks

The tasks include the following: 1)

∙ cold and warm restart,

1

updating the process image of the inputs and outputting the process image of the outputs,

calling the cyclic, time-controlled and interrupt-driven programs,

detection and handling of errors,

memory management,

communication with the programmer (PG).

User interfaces

As the user, you can influence the reaction of the CPU to particular

 

situations and errors via special interfaces to the system program.

Storing the system program After switching on the power supply to the PLC (POWER UP) the system program is read from the EPROM to the internal operating system RAM.

System program defaults The following chapters, except for Chapter 7, describe the default system reaction to process events or errors. Depending on the defaults, the CPU changes to the stop mode if an operation code error occurs and the error organization block is not loaded.

Modifying the defaults

You can modify the system response by assigning parameters for the

 

data block DX 0.

 

Chapter 7 describes the system response following modification.

1)When operating with several CPUs (multiprocessing) further tasks are involved.

CPU 948 Programming Guide

 

C79000-D8576-C848-03

1 - 9

The Programs in a CPU

User program

 

 

Tasks

The user program contains all the functions required for processing a

 

specific control task. In general terms, these functions can be

 

assigned to the interface provided by the system program for the

 

various types of processing, as follows:

 

 

 

 

Type of processing

Task

 

 

 

 

Cold and warm restart

To provide the conditions under which

 

 

the other processing functions can start

 

 

from a defined status following a cold or

 

 

warm restart of the control system (e.g.

 

 

assigning specific values to signals).

 

 

 

 

Cyclic processing

Constantly repeated signal processing

 

 

(e.g. logic operations on binary signals,

 

 

reading in and analyzing analog values,

 

 

specifying binary signals for output,

 

 

outputting analog values).

 

 

 

 

Time-controlled processing

Special, time-dependent processing with

 

 

the following time conditions:

 

 

- faster than the average cycle,

 

 

- at a time interval greater than the

 

 

average cycle time,

 

 

- at a specified point in time.

 

 

 

 

Interrupt-driven processing

Special, fast reactions to certain process

 

 

signals.

 

 

 

 

Error reaction

Handling problems within the normal

 

 

sequence of the program.

 

 

 

 

CPU 948 Programming Guide

1 - 10

C79000-D8576-C848-03

The Programs in a CPU

Structure

User memory

1

User program

 

 

Code blocks

 

 

 

 

 

Organization

Program

 

Function

Sequence

blocks

blocks

 

blocks

blocks

 

 

OB

PB

 

FB/FX

 

SB

 

 

STEP 5

STEP 5

 

STEP 5

STEP 5

 

 

operations

operations

 

operations

operations

I 1.5

&

 

 

FB 8

 

 

 

F 1.7

 

 

 

F 50.1

 

 

 

 

 

 

 

 

 

 

 

 

I 2.6

S

 

I 1.6

 

= 1

 

SEGMENT 1

 

= 1

 

 

 

 

 

 

F 50.2

 

 

 

 

 

 

NAME

:TRANS

 

 

 

I 1.4

&

 

 

 

 

 

 

 

 

 

I 1.3

R

Q

 

 

 

Q 5.3

 

 

 

I 1.3

 

F 50.3

0005

:L

IB

3

 

 

 

Q 3.1

 

0006

:T

FW 200

 

 

 

 

 

 

0007

:C

DB

5

 

 

 

 

 

 

0008

:DO

FW 200

 

 

 

 

 

 

0009

:L

DW

0

 

 

 

 

 

 

000A

:T

QW

6

 

 

 

 

 

 

000B

:BE

 

 

 

 

Data blocks

DB

 

 

1:

KH = 0101;

static

or dynamic data

 

2:

KF = +120;

(bits,

bytes, words, double

words)

3:

KS = xy;

4:

KY = 4.5;

 

 

 

5:

KG =

 

 

 

6:

KM =

 

 

 

7:

 

 

 

 

 

 

 

 

 

 

 

DX

 

 

1:

KH = FFFF;

static

or dynamic data

 

2:

KH = FFFF;

words)

3:

KH = FFFF;

(bits,

bytes, words, double

4:

KH = FFFF;

 

 

 

5:

KH = FFFF;

 

 

 

6:

KH = FFFF;

 

 

 

7:

 

 

 

 

 

 

Fig. 1-3 Structure of a STEP 5 user program

Storing the user program After programming the user program, you must load it in the user memory of the CPU 948 (directly from the PG) or via a memory card whose contents are copied to the user memory by an OVERALL RESET of the CPU.

Interfaces to the

Organization blocks are available as interfaces to the system program

system program

for the special types of processing.

CPU 948 Programming Guide

C79000-D8576-C848-03

1 - 11

Which Operands are available to the User Program?

1.4Which Operands are available to the User Program?

The CPU 948 provides the following operand areas for programming:

process image and I/Os

flags (F flags and S flags)

timers/counters

data blocks

Process image of the inputs and outputs PII/PIQ

 

 

Characteristics

Size

 

 

 

 

The user program can access the following data types

128 bytes

 

in the process image extremely quickly:

each for

 

-

single bits,

inputs and

 

-

bytes,

outputs

 

-

words,

 

 

-

double words

 

 

 

 

 

I/O area (P area)

 

 

 

 

Characteristics

Size

 

 

 

 

The user program can access the I/O modules directly

256 bytes

 

via the S5 bus.

each for

 

 

 

inputs and

 

The following data types are possible:

outputs

 

-

bytes,

 

 

-

words.

 

 

 

 

 

Extended I/O area (O area)

 

 

 

 

Characteristics

Size

 

 

 

 

The user program can access the I/O modules directly

256 bytes

 

via the S5 bus.

each for

 

 

 

inputs and

 

The following data types are possible:

outputs

 

-

bytes,

 

 

-

words.

 

 

 

 

 

 

CPU 948 Programming Guide

1 - 12

C79000-D8576-C848-03

Which Operands are available to the User Program?

F flags

 

Characteristics

Size

 

 

 

 

1

 

 

 

 

The flag area is a memory area which the user

2048 bits

 

 

 

 

program can access extremely quickly with certain

 

 

 

operations.

 

 

 

The flag area should be used ideally for working data

 

 

 

required often.

 

 

 

The following data types can be accessed:

 

 

 

-

single bits,

 

 

 

-

bytes,

 

 

 

-

words,

 

 

 

-

double words.

 

 

 

Single flag bytes can be used as interprocessor

 

 

 

communication flags (IPC flags) to exchange data

 

 

 

between the CPUs in the multiprocessor mode (refer

 

 

 

to Chapter 10). IPC flags are updated by the system

 

 

 

program at the end of the cycle via a buffer in the

 

 

 

coordinator or CP/IP.

 

 

 

 

 

 

 

 

S flags (extended flag area)

Characteristics

Size

 

 

The CPU 948 also contains an additional flag area, the

32 768 bits

S flag area. The user program can also access this area

 

extremely quickly as with the F flags.

 

S flags cannot however by used as actual operands

 

with function block calls nor as IPC flags for data

 

exchange between the CPUs. The bit test operations of

 

the CPU 948 can also not be used with the S flags.

 

These flags can only be used with the PG system

 

software "S5-DOS" from version 3.0 upwards or

 

"S5-DOS/MT" from version 1.0 upwards.

 

 

 

CPU 948 Programming Guide

 

C79000-D8576-C848-03

1 - 13

Which Operands are available to the User Program?

Timers (T)

Characteristics

Size

 

 

The user program loads timer cells with a time value

256 timer

between 10 ms and 9990 s and by means of a start

cells

operation, decrements the timer from this value at the

 

preselected intervals until it reaches the value zero.

 

 

 

Counters (C)

Characteristics

Size

 

 

The user program loads counter cells with a start value

256

(max. 999) and then increments or decrements them.

counters

 

 

Data words in the current data block

 

Characteristics

Size

 

 

A data block contains constants and/or variables in the

256

byte, word or double word format. With STEP 5

words

operations, you can always access the "current" data

1)

block (refer to Section 2.4.2).

 

The following data types can be accessed:

 

-

single bits,

 

-

bytes,

 

-

words,

 

-

double words.

 

 

 

 

1)In data blocks with a length greater than 256 words, you can only access data words with the numbers > 255 with operations for absolute memory access (refer to Chapter 9).

 

CPU 948 Programming Guide

1 - 14

C79000-D8576-C848-03

How much Memory is available for the User Program?

1.5How much Memory is available for the User Program?

For storing logic and data blocks, the CPU 948 only has the user

1

memory in the internal RAM.

 

The CPU 948 is available with two versions of the user memory:

 

Version 1: with 640 Kbytes,

 

Version 2: with 1,664 Kbytes.

 

CPU 948 Programming Guide

 

C79000-D8576-C848-03

1 - 15

How to Tackle Programming

1.6How to Tackle Programming

If you are an experienced user, you have probably found the most suitable method for creating programs for yourself and you can skip this section.

Less experienced readers will find tips for designing, programming, testing and starting up your STEP 5 program.

Implementation stages

The implementation of the STEP 5 control program can be divided

 

into three stages:

 

 

 

 

Stage

Activity

 

 

 

 

1

Determining the technological task

 

 

 

 

2

Designing the program

 

 

 

 

3

Creating, testing and starting the program

Recursive procedure

 

 

In practice, you will recognize that certain steps must be repeated

 

(recursive procedure), e.g. when you realize that more signals are

 

required to improve the handling of the task.

Stage 1

Determining the technological task:

 

 

 

 

 

Stage

Activity

1Create a general block diagram outlining the control tasks of your process.

2Create a list of the input and output signals required for the task.

3Improve the block diagram by assigning the signals and any particular time conditions and/or counter statuses to the individual blocks.

 

CPU 948 Programming Guide

1 - 16

C79000-D8576-C848-03

Loading...
+ 532 hidden pages