Download 81318674 Programming Guideline DOKU v13 en (1) PDF

Title81318674 Programming Guideline DOKU v13 en (1)
TagsPointeur (programmation) Type de données Paramètre (Programmation informatique) Tableau (structure de données) Mémoire (informatique)
File Size10.7 MB
Total Pages101
Table of Contents
                            Programming Guideline for S7-1200/S7-1500
Warranty and Liability
Table of Contents
1 Preface
2 S7-1200/1500 Innovations
	2.1 Introduction
	2.2 Terms
	2.3 Programming languages
	2.4 Optimized machine code
	2.5 Block creation
	2.6 Optimized blocks
		2.6.1 S7-1200: Setup of optimized blocks
		2.6.2 S7-1500: Setup of optimized blocks
		2.6.3 Best possible data storage in the processor on S7-1500
		2.6.4 Conversion between optimized and non-optimized tags
		2.6.5 Communication with optimized data
	2.7 Block properties
		2.7.1 Block sizes
		2.7.2 Number of organization blocks (OB)
	2.8 New data types for S7-1200/1500
		2.8.1 Elementary data types
		2.8.2 Date_Time_Long data type
		2.8.3 Further time data types
		2.8.4 Unicode data types
		2.8.5 VARIANT data type (only S7-1500)
	2.9 Instructions
		2.9.1 CALCULATE
		2.9.2 MOVE instructions
		2.9.3 VARIANT instructions (only S71500)
		2.9.4 RUNTIME
	2.10 Symbolic and comments
		2.10.1 Programming editor
		2.10.2 Comment lines in watch table
	2.11 System constants
	2.12 User constants
	2.13 Internal reference ID for controller and HMI tags
	2.14 STOP mode in the event of errors
3 General Programming
	3.1 Operating system and user program
	3.2 Program blocks
		3.2.1 Organization blocks (OB)
		3.2.2 Functions (FC)
		3.2.3 Function blocks (FB)
		3.2.4 Instances
		3.2.5 Multi-instances
		3.2.6 Global data blocks (DB)
		3.2.7 Downloading without reinitialization
		3.2.8 Reusability of blocks
		3.2.9 Auto numbering of blocks
	3.3 Block interface types
		3.3.1 Call-by-value with In interface type
		3.3.2 Call-by-reference with InOut interface type
	3.4 Storage concept
		3.4.1 Block interfaces as data exchange
		3.4.2 Global memory
		3.4.3 Local memory
		3.4.4 Access speed of memory areas
	3.5 Retentivity
	3.6 Symbolic addressing
		3.6.1 Symbolic instead of absolute addressing
		3.6.2 ARRAY data type and indirect field accesses
		3.6.3 STRUCT data type and PLC data types
		3.6.4 Access to I/O areas with PLC data types
		3.6.5 Slice access
	3.7 Libraries
		3.7.1 Types of libraries and library elements
		3.7.2 Type concept
		3.7.3 Differences for typifiable objects for CPU and HMI
		3.7.4 Versioning of a block
	3.8 Increasing performance with process interrupts
	3.9 Other performance recommendations
	3.10 SCL programming language: Tips and tricks
		3.10.1 Using call templates
		3.10.2 What instruction parameters are mandatory?
		3.10.3 Drag & drop with entire tag names
		3.10.4 Efficiently inserting CASE instruction
		3.10.5 No manipulation of loop counters for FOR loop
		3.10.6 FOR loop backwards
		3.10.7 Simple creating of instances for calls
		3.10.8 Handling of time tags
4 Hardware-Independent Programming
	4.1 Data types of S7-300/400 and S7-1200/1500
	4.2 No bit memory but global data blocks
	4.3 Programming of "clock bits"
5 STEP 7 Safety in the TIA Portal
	5.1 Introduction
	5.2 Terms
	5.3 Components of the safety program
	5.4 F-runtime group
	5.5 F signature
	5.6 Assigning the PROFIsafe address at the F-I/O
	5.7 Evaluation of F-I/O
	5.8 Value status (S7-1500F)
	5.9 Data types
	5.10 F-conform PLC data type
	5.11 TRUE/FALSE
	5.12 Data exchange between standard program and F program
	5.13 Testing the safety program
	5.14 STOP mode in the event of F errors
	5.15 Migration of tags
	5.16 General recommendations for safety
6 The Most Important Recommendations
7 Related Literature
8 History
                        
Document Text Contents
Page 1

http://www.siemens.com/simatic-programming-guideline

Background and System Description 09/2014

Programming Guideline for
S7-1200/S7-1500
STEP 7 (TIA Portal) and STEP 7 Safety in TIA Portal

http://www.siemens.com/simatic-programming-guideline

Page 2

Warranty and Liability

Programming Guideline for S7-1200/S7-1500
Entry-ID: 81318674, V1.3, 09/2014 2

S
ie

m
en

s
A

G
20

14
A

ll
rig

ht
s

re
se

rv
ed

Warranty and Liability

Note The Application Examples are not binding and do not claim to be complete
regarding the circuits shown, equipping and any eventuality. The Application
Examples do not represent customer-specific solutions. They are only intended
to provide support for typical applications. You are responsible for ensuring that
the described products are used correctly. These application examples do not
relieve you of the responsibility to use safe practices in application, installation,
operation and maintenance. When using these Application Examples, you
recognize that we cannot be made liable for any damage/claims beyond the
liability clause described. We reserve the right to make changes to these
Application Examples at any time without prior notice.
If there are any deviations between the recommendations provided in these
application examples and other Siemens publications – e.g. Catalogs – the
contents of the other documents have priority.

We do not accept any liability for the information contained in this document.

Any claims against us – based on whatever legal reason – resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
deficiency or breach of a condition which goes to the root of the contract
(“wesentliche Vertragspflichten”). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.

Any form of duplication or distribution of these Application Examples or excerpts
hereof is prohibited without the expressed consent of Siemens Industry Sector.

Security
informa-
tion

Siemens provides products and solutions with industrial security functions that
support the secure operation of plants, solutions, machines, equipment and/or
networks. They are important components in a holistic industrial security
concept. With this in mind, Siemens’ products and solutions undergo continuous
development. Siemens recommends strongly that you regularly check for
product updates.

For the secure operation of Siemens products and solutions, it is necessary to
take suitable preventive action (e.g. cell protection concept) and integrate each
component into a holistic, state-of-the-art industrial security concept. Third-party
products that may be in use should also be considered. For more information
about industrial security, visit http://www.siemens.com/industrialsecurity.

To stay informed about product updates as they occur, sign up for a product-
specific newsletter. For more information, visit
http://support.automation.siemens.com.

http://www.siemens.com/industrialsecurity
http://support.automation.siemens.com/

Page 50

3 General Programming
3.2 Program blocks

Programming Guideline for S7-1200/S7-1500
Entry-ID: 81318674, V1.3, 09/2014 50

C
op

yr
ig

ht
S

ie
m

en
s

A
G

20
14

A
ll

rig
ht

s
re

se
rv

ed

3.2.8 Reusability of blocks

The block concept offers you a number of options to program in a structured and
effective way.

Advantages

Blocks can be used universally in any location of the user program.
Blocks can be used universally in different projects.
When every block receives an independent task, a clear and well-structured

user program is automatically created.
There are clearly fewer sources of errors
Simple error diagnostic possible.

Recommendation
If you want to reuse the block, please note the following recommendations:
Always look at blocks as encapsulated functions. I.e. each block represents a

completed partial task within of the entire user program.
Use several cyclic Main OBs to group the plant parts.
Always execute a data exchange between the blocks via its interfaces and not

via its instances (see chapter 3.4.1 Block interfaces as data exchange).
Do not use project-specific data and avoid the following block contents:

– Access to global DBs and use of individual instance DBs
– Access to tags
– Access to global constants

Reusable blocks have the same requirements as know-how-protected blocks
in libraries. This is why you have to check the blocks for reusability based on
the “Block can be used as know-how protected library element” block property.
Compile the block before the check.

Figure 3-14: Block attributes

Page 51

3 General Programming
3.2 Program blocks

Programming Guideline for S7-1200/S7-1500
Entry-ID: 81318674, V1.3, 09/2014 51

C
op

yr
ig

ht
S

ie
m

en
s

A
G

20
14

A
ll

rig
ht

s
re

se
rv

ed

3.2.9 Auto numbering of blocks

For internal processing, required block numbers are automatically assigned by the
system (setting in the block properties).

Figure 3-15: Auto numbering of blocks

Kopieren und Einfügen
Konflikt durch gleiche

Blocknummer

Beim Übersetzen nummeriert das
System den kopierten Baustein um und

löst den Konflikt.

Advantages
Conflicting block numbers, e.g. as a result of copying, automatically deletes the

TIA Portal during compilation.

Recommendation
Activate the automatic numbering of the blocks.

Figure 3-16: Setting in the block

Page 100

7 Related Literature

Programming Guideline for S7-1200/S7-1500
Entry-ID: 81318674, V1.3, 09/2014 100

S
ie

m
en

s
A

G
20

14
A

ll
rig

ht
s

re
se

rv
ed

7 Related Literature

Table 7-1

Topic Title

\1\ Siemens Industry Online Support http://support.automation.siemens.com
\2\ Download page of the entry http://support.automation.siemens.com/WW

/view/en/81318674
\3\ TIA Portal - An Overview of the Most

Important Documents and Links
http://support.automation.siemens.com/WW
/view/en/65601780

\4\ STEP 7 (TIA Portal) manuals http://support.automation.siemens.com/WW
/view/en/29156492/133300

\5\ S7-1200 Manuals http://support.automation.siemens.com/WW
/view/en/34612486/133300

\6\ S7-1500 Manuals http://support.automation.siemens.com/WW
/view/en/56926743/133300

\7\ S7-1200 Getting Started http://support.automation.siemens.com/WW
/view/en/39644875

\8\ S7-1500 Getting Started http://support.automation.siemens.com/WW
/view/en/78027451

\9\ SIMATIC S7-1200 / S7-1500
Comparison list for programming
languages

http://support.automation.siemens.com/WW
/view/en/86630375

http://support.automation.siemens.com/
http://support.automation.siemens.com/WW/view/en/81318674
http://support.automation.siemens.com/WW/view/en/81318674
http://support.automation.siemens.com/WW/view/en/65601780
http://support.automation.siemens.com/WW/view/en/65601780
http://support.automation.siemens.com/WW/view/en/29156492/133300
http://support.automation.siemens.com/WW/view/en/29156492/133300
http://support.automation.siemens.com/WW/view/en/34612486/133300
http://support.automation.siemens.com/WW/view/en/34612486/133300
http://support.automation.siemens.com/WW/view/en/56926743/133300
http://support.automation.siemens.com/WW/view/en/56926743/133300
http://support.automation.siemens.com/WW/view/en/39644875
http://support.automation.siemens.com/WW/view/en/39644875
http://support.automation.siemens.com/WW/view/en/78027451
http://support.automation.siemens.com/WW/view/en/78027451
http://support.automation.siemens.com/WW/view/en/86630375
http://support.automation.siemens.com/WW/view/en/86630375

Page 101

8 History

Programming Guideline for S7-1200/S7-1500
Entry-ID: 81318674, V1.3, 09/2014 101

S
ie

m
en

s
A

G
20

14
A

ll
rig

ht
s

re
se

rv
ed

8 History

Table 8-1

Version Date Modifications

V1.0 09/2013 First version

V1.1 10/2013 Corrections in the following chapters:
2.6.3 Best possible data storage in the processor on S7-1500
2.13 Internal reference ID for controller and HMI tags
3.2.2 Functions (FC)
3.2.3 Function blocks (FB)
3.4.3 Local memory

V1.2 03/2014 New chapter:
2.6.4 Conversion between optimized and non-optimized tags
2.6.5 Communication with optimized data
2.9.2 MOVE instructions
2.9.3 VARIANT instructions (only S7-1500)
3.6.4 Access to I/O areas with PLC data types

Extension of following chapter:
2.2 Terms
2.3 Programming languages
2.6 Optimized blocks
2.10 Symbolic and comments
3.2 Program blocks
3.5 Retentivity
4.3 Programming of "clock bits"

Several corrections in different chapter

V1.3 09/2014 New chapter:
2.8.4 Unicode data types
2.10.2 Comment lines in watch table
2.12 User constants
3.2.9 Auto numbering of blocks
5 STEP 7 Safety in the TIA Portal

Extension of following chapter:
2.7 Block properties
2.8 New data types for S7-1200/1500
2.9 Instructions
2.10 Symbolic and comments
3.6.3 STRUCT data type and PLC data types
3.7 Libraries

Several corrections in different chapter

Similer Documents