For Loop Backwards; Simple Creating Of Instances For Calls; Handling Of Time Tags - Siemens S7-1200 Programming Manualline

Step 7 tia portal, background and system description
Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

3 General Programming
3.10 SCL programming language: Tips and tricks
3.10.6

FOR loop backwards

In SCL you can also increment the index of FOR loops backwards or in another
step width. For this, use the optional "BY" key word in the loop head.
Example
FOR #var := #upper TO #lower BY -2 DO
END_FOR;
If you are defining "BY" as "-2", as in the example, the counter is lowered by 2 in
every iteration. If you omit "BY", the default setting for "BY" is 1
3.10.7

Simple creating of instances for calls

If you prefer to work with the keyboard, there is a simple possibility to create
instances for blocks in SCL.
Example
Table 3-13: Easy creation of instances
Step
1.
2.
3.10.8

Handling of time tags

You can calculate the time tags in SCL just as with normal numbers i.e. you do not
need to look for additional functions, such as, e.g. T_COMBINE but you can use
simple arithmetic. This approach is called "overload of operands". The SCL
compiler automatically uses the suitable functions. You can use a reasonable
arithmetic for the time types and can therefore program more efficiently.
Example
TimeDifference := TimeStamp_1 – TimeStamp_2;
Programming Guideline for S7-1200/1500
V1.2, Entry ID: 81318674
Give the block name a: followed by a "." (dot). The automatic compilation now
shows you the following.
On the top you can see the already existing instances. In addition, you can
directly create a new single instance or multi-instance.
Use the shortcuts "s" or "m" to go directly to the respective entries in the
automatic compilation window.
Instruction
67

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

S7-1500

Table of Contents