Sie sind auf Seite 1von 28

Correspondence of Program Objects

between Step7 and Unity Pro

At a Glance
Introduction

This document establishes the correspondence between the data and


functions used in a Step7 program and those available in Unity Pro in
order to help users wishing to migrate a Step7 program to Unity Pro.
The conversion of Step7 programming languages to Unity Pro is not
covered in this version of this document.
This document is organized into three sections:
- the presentation, description and organization of the
constituent objects of a Step7 project program,
- the presentation, description and organization of the
constituent objects of a Unity Pro project program,
- correspondence tables showing the correspondence
between Step7 and Unity Pro programming objects.

Contents

Subject
1 Presentation, Description and Organization of the
Constituent Objects of a Step7 Project Program

Page
3

2 Presentation, Description and Organization of the


Constituent Objects of a Unity Pro Project Program

11

3 Conversion Tables for Step7 and Unity Pro Programming


Objects

20

1..................... Presentation, Description and


Organization of the Constituent Objects of a Step7
Project Program
Introduction

In the Step7 software workshop, all objects have a physical


address which is known to the user.
There are objects whose memory location is known in
advance (static addresses). For other objects, the memory
addresses are created during the course of project
development: Step7 calculates and provides these addresses
(dynamic addresses) progressively over time.
All objects can be symbolized using the symbol editor.

Presentati
on of
Constituen
t Objects
of a
Program

The program for a project consists of:


variables,
functions blocks and functions.

These objects can call each other, enabling structured programming.

Note: It is worth noting that DBxs may depend on function block types
(FBx\SFBx), data types (UDTx) and be untyped variables (DBx
Shared).
Description
of
Constituent
Objects of a
Program

In view of their different natures, these objects belong to the following


categories:
-Data types (instantiable objects):

FB (Function Block) function blocks defined by the


user, they perform a process function. These are data types
containing:

Code (CONT\LOG\LIST\SCL languages),

Input/output parameters,

Static variables,

Temporary variables.
An FB can be nested into another FB\SFB (which in this
case becomes a static variable) with the level of nesting
depending on the CPU.
The temporary variables are deleted after the block is
executed.
These blocks are used to create instances which are used
in the program.
By analogy with Unity Pro, an FB corresponds to a DFB
type (see Chapter 3 "Conversion Tables")
Identification of an FB:

By address -> FBx

By symbol -> FB_Name

SFB (System Function Block), these blocks perform


functions predefined by Siemens and are built into the
operating system of the CPU. These are data types

containing:

Code (C language),

Input/output parameters,
These blocks are used to create instances which are used
in the program.
By analogy with Unity Pro, an SFB corresponds to an
EFB type (see Chapter 3 "Conversion Tables")
Identification of an SFB:

By address -> SFBx

By symbol -> SFB_Name

UDT (User Data Type) user-defined data structures which


are made up of elements of the following types:

Simple types:

Bool,

Byte\Word\Dword,

Int\Dint,

Real,

Time\S5Time\Time_Of_Day\Date,

Char.

Complex types:

Date_And_Time,

String,

Array,

Structure,

UDT

A mix of simple/complex types.


These objects are used to create:

input\output parameters, static variables, and


temporary variables used in FBs (Functional
Blocks),

input\output parameters, temporary variables and


the return variable used in FCs (Functions),

temporary variables used in OBs,

UDT elements (nesting).


By analogy with Unity Pro, a UDT corresponds to a DDT
type (see Chapter 3 "Conversion Tables")
Identification of a UDT:

By address -> UDTx

By symbol -> UDT_Name

All these data types are instantiated as DBx (Data blocks) which
depending on the case in question are:
DBx instances, which are instances of FBx\SFBx
types.Depending on type, each instance has its own
input/output parameters, its static variables which are

remanent, and its temporary variables which are deleted


after execution. These instances are accessible from
throughout the program.
Calling of a DB instance:

By address -> DBx

By symbol -> DB_Name

DBx of type, which are instances of UDTx types. They


are global and available throughout the program.
Calling of a DB of type:

By address -> DBx

By symbol -> DB_Name

Specific case for DBx Shareds which do not depend on any predefined type:
only their component elements (simple variables\complex variables) are
assigned a type. They are global to the whole program.
Calling of a DB shared:
-By address -> DBx,
-By symbol -> DB_Name.
-Function blocks and functions (non-instantiable objects):

OB (Organization Blocks), these blocks serve as


interfaces between the operating system and the program.
They are called up by the operating system following the
event which triggers the call and are arranged into
categories with different priorities so as to control the
rights of mutual interruption. They contain:

Calls to other blocks (DB Instances + blocks


defined below). These calls are programmed by
the user ,

Temporary variables.
The temporary variables are deleted after the block is
executed.
By analogy with Unity Pro, an OB corresponds to a
Section contained in a Task (see Chapter 3 "Conversion
Tables")
Calling of an OB:

By address -> OBx

By symbol -> OB_Name

FC (Functions), these are functions defined by the user


(CONT\LOG\LIST\SCL language) which contain

repetitivetypes of processing.
They contain:

Code,

Input/output parameters,

Temporary variables,

A return variable.
The return variable provides an output value
used by the calling block.
The temporary variables are deleted after the function is
executed. To compensate for this non-remanence the FC
can use DBs of type or DBs shared (Data Blocks).
By analogy with Unity Pro, an FC corresponds to a single
instance DFB (see Chapter 3 "Conversion Tables")
Calling of an FC:

By address -> FCx

By symbol -> FC_Name

Program
Organization

SFC (System Functions) perform functions predefined by


Siemens and are built into the operating system of the
CPU.
They contain:

Code (C language),

Input/output parameters,

A return variable.
The return variable provides an output value used by the
calling blocks.
By analogy with Unity Pro, an SFC corresponds to an EF
type (see Chapter 3 "Conversion Tables")
Calling of an SFC:

By address -> SFCx

By symbol -> SFC_Name

This diagram shows the various possible interconnections between the


various objects.

: Call between objects.


: Use of a data block.

Scan
Cycl
e

These diagrams show the scan cycle up to 10\1998 and from 10\1998. In this
example, OB1 (main program) is interrupted by OB10. The priority level of each
OBx available in Step7 is defined in the technical documentation.

Addressing

Memory Variables (Memento):


Address
Description
M
Memory Bit
MB
Memory Byte
MW
Memory Word
MD
Memory Double
These variables are the only ones which belong to a memory area
which is predefined in advance according to the configured CPU.
They can be used by any other object and can be symbolized.
Input/Output Variables (implicit exchanges):
Address
Description
I
Input Bit
IB
Input Byte
IW
Input Word
ID
Input Double Word

Q
Output Bit
QB
Output Byte
QW
Output Word
QD
Output Double Word
Can be symbolized.
Local Variables:
Address
Description
L
Local Data Bit
LB
Local Data Byte
LW
Local Data Word
LD
Local Data Double Word
Correspond to addresses of the temporary variables for FB instances
and to addresses of temporary variables for FCs.
These addresses are assigned when variables are created (symbols).
Data Blocks:
Address
Description
DBx
Data Block Bit
DBB
Data Block Byte
DBW
Data Block Word
DBD
Data Block Double Word
Correspond to the addresses of static variables and the input\output
parameters of FB instances, to the addresses of the input\output
parameters of FB instances and to the addresses UDT\DBshared
elements. These addresses are assigned when the variables (symbols)
and elements (symbols) are created.
Input/Output Variables (explicit exchanges):
Address
Description
PIB
Peripheric Input Byte
PIW
Peripheric Input Word
PID
Peripheric Input Double Word
PQB
Peripheric Output Byte
PQW
Peripheric Output Word
PQD
Peripheric Output DoubleWord
Can be symbolized.

2.................... Presentation, Description and


Organization of the Constituent Objects of a Unity Pro
Project Program
Introduction

In Unity Pro, a memory area is reserved for objects which


have a predefined address (known to the user). Some of these
objects can be symbolized.
Another memory area is reserved for objects created during
the course of project development, which can be accessed via
symbols and for which the memory address is calculated by
Unity Pro when the project is built. It is, however, still
possible to also refer to these objects by physical addresses
defined by the user.

Presentatio
n of
Constituen
t Objects of
a Program

The program for a project consists of objects containing the code and
data used.

These objects can call each other, enabling


structured programming.

Description
of

In view of their different nature, these objects belong to the following


categories:

Constituent
Objects of a
Program

-Objects and functions (non-instantiable):

Tasks, are used to optimize program execution time by


distributing processing between different tasks
(multitasking system). They contain sections and subroutines and the system triggers them either cyclically or
periodically while managing the assigned priority levels:
-Mast (cyclic or periodic from 1 to 255ms): main
task of program which is mandatory,
-Fast (periodic from 1 to 255ms): of higher priority
than
the Mast task. It is best suited to short types of
processing,
-Auxiliary (periodic from 10ms to 2.55s): used
to execute the parts of the application with lower
processing priority. Four auxiliary tasks are
available, with Aux0 having the highest level of
priority and Aux3 the lowest level,

EVT (Events), used to execute the parts of the program


responding to interrupts. Processing of these events has
priority over other types of processing.
There are two types of events:
- hardware events reported by the I/O modules
(highest priority),
- timer events.
The EVT0 event has the highest priority.

Sections: defined by the user (LD\ST\FBD\LIST\SFC


languages), these contain the processing relating to a
process function and are called in succession by the tasks
which contain them according to the order in which they
are positioned in these tasks. Their execution may be set to
depend on an activation condition. Sections have a custom
name.

SR (Subroutine): defined by the user


(LD\ST\FBD\LIST\SFC language) they contain repetitive
types of processing; They can only be called by sections
belonging to the same task. SRs have a custom name.

EF (Elementary Function): functions written in C


language. These functions are either predefined by
Schneider or created by the user using the EFBToolKit.
They are used for more complex types of algorithmic

processing and their variables are deleted once processing


is complete.
These functions are called by:

program sections,

DFB sections,

sub-routines.
Calling of an EF:

By a name (defined by Schneider or by the user)

Not accessible via an address.


-Data types (instantiable objects):

DFB (Derived Function Block) function blocks defined by


the user or Schneider. They can be used to simplify
program design, data entry and legibility and to reduce the
volume of code generated. These are data types containing:

Code (LD\FBD\ST\IL languages),

Input/output parameters,

Public variables,

Private variables.
These blocks are used to create:

DFB instances which are called in program


sections and subroutines,

Private DFB variables constituting nested DFB


structures (8 levels of nesting are possible).
Identification of a type:

By a name (defined by Schneider or by the user),


Calling of an instance:

By a symbol (defined by the user),

Not accessible via an address.

EFB (Elementary Function Block) these function blocks


are either predefined by Schneider or created by the user
using the EFBToolKit. They are used for more complex
types of algorithmic processing. These are data types
containing:

Code (C language),

Input/output parameters,

Public variables.
These blocks are used to create:

EFB instances which are called in program


sections and subroutines,

Private DFB variables.


Identification of a type:

By a name (defined by Schneider or by the user),

Calling of an instance:

By a symbol (defined by the user),

Not accessible via an address.

DDT (Derived Data Type) user-defined data structures


which are made up of elements of the following types:

Simple types:

Bool\Ebool

Byte\Word\Dword

Int\Dint\UInt\UDint

Real

Time\Time_Of_Day\Date_And_Time

String

Complex types:

Array

Structure

A mix of simple/complex types.


These types are used to create:

Input\output parameters , public variables, private


DFB (Derived Function Block) variables,

DDT instances which are instances of global data


used by the program.
Identification of a type:

By a name (defined by Schneider or by the user),


Calling of an instance:

By a symbol (defined by the user).

By an address -> %MWx if the DDT is


referenced to memory.

IODDT (Inputs\Outputs Derived Data Type): data


structures made up of simple types of element which
represent the channels of application-specific modules.
These types are predefined by Schneider and exist for the
various different application-specific modules.
These types are used to create:

IODDT instances which gives the program


simplified access to application-specific channels.

Input\Output Parameters used in the DFBs


(Derived Function Blocks),
Identification of a type:

By a name (defined by Schneider),


Calling of an IODDT:

By a symbol (defined by the user),

By an alias (defined by the user),

By an address -> %CHr.m.c.

EDT (Elementary Data Type): simple predefined data


types used to guarantee safety and legibility:

Integer (Int, Uint, Dint, Udint) and floating point


data types for arithmetic operations,

Bit string data types (Word, Dword, Byte) for


logical operations (AND, OR, XOR, etc.),

Boolean data types for the use of single bits


(Bool) or with edge management (Ebool),

Time management data types (Date, Time, TOD,


DT),

Character string data types (String).


Calling of an EDT:

By a symbol (defined by the user),

By address -> %M (for EBools) and %MW for


other data types if the EDT is referenced to
memory.

Program
Organizatio
n

This diagram shows the various possible interconnections between the various
objects.
: Call between objects.
: Use of a data block.

Addressing

Unity Pro processors have a reserved memory area for static data (not
created during project development). Such data is can be accessed in
the program by physical addresses and some of them can be
symbolized.
Memory Variables:
Address
Description
%M
Bit (Ebool)
%MW
Word (Int)
%MD
Double Word (Dint)
%MF
Flottant (Real)
%MW.x
Word Bit (Bool)
Only the addresses %M, %MW and %MW.x can be symbolized.
Constants:
Address
Description
%KW
Word (Int)
%KD
Double Word (Dint)
%KF
Floating Point (Real)
%KW.x
Word Bit (Bool)
Only the addresses %KW and %KW.x can be symbolized.
System Variables:
Address
Description
%S
Bit (Ebool)
%SW
Word (Int)
%SD
Double Word (Dint)
Input/Output Variables (implicit exchanges):
Address
Description
Inputs
%Ir.m.c.d
Bit (Ebool)
%IWr.m.c.d Word (Int)
%IDr.m.c.d
Double Word (Dint)
%IFr.m.c.d
Floating Point (Real)
Outputs
%Qr.m.c.d
Bit (Ebool)
%QWr.m.c.d Word (Int)
%QDr.m.c.d Double Word (Dint)
%QFr.m.c.d Floating Point (Real)

All the addresses can be symbolized.


Input/Output Variables (explicit exchanges):
Address
Description
%MWr.m.c.d Word (Int)
%MDr.m.c.d Double Word (Dint)
%MFr.m.c.d Flottant (Real)
%KWr.m.c.d Word (Int)
%KDr.m.c.d Double Word (Dint)
%KFr.m.c.d
Flottant (Real)
%CHr.m.c
Channel
All the addresses can be symbolized.

3.................. Conversion Tables for Step7 and Unity


Pro Programming Objects

Introduction

The tables below provide a solution for migration to Unity Pro


for the majority of objects used in Step7. We refer to this as a
migration solution as there is no strict equivalence between
the objects in the two products.
It should also be noted that certain objects cannot be
transposed due to their very specific nature.

Conversion Tables

OB (Organization Blocks) :
STEP7
OB1 (periodic IT),
contains the main
program
OB10 -> OB17 (time
IT)

UNITY PRO
Section (unconditioned)belonging
to the Mast task configured as
periodic.
Sections belonging to the
Mast\Fast\Aux task depending on
priority, with activation bit
triggered on testing of a TOD

variable.
OB20 -> OB23 (time- Sections belonging to the
delayed IT)
Mast\Fast\Aux task depending on
priority, with activation bit
triggered when a Timer value is
attained.
OB30 -> OB38 (Cyclic Sections (unconditioned)
IT)
belonging to the Mast
(periodic)\Fast\Aux or EVT
timer task depending on priority.
OB40 ->
EVTs I\O
OB57 (hardware IT)
OB60 (multiprocessing No multiprocessors
IT)
OB80 -> OB87 (CPU
Specific to hardware, case by
errors IT)
case analysis (see system bits and
words associated with Unity
processors).
OB90 (Basic
Section of an AUX task
processing IT)
depending on priority level.
OB100 -> OB102
Section of the Mast task with
management of cold start (%S0)
and warm start (%S1) system
bits
Reminder:
Step7 allows you to symbolize OBs.
In Unity Pro the names of tasks and events are predefined.
Only sections are named by the user.

Function blocks :
STEP7
FB (Function Block)

UNITY PRO
DFB (Derived Function
Block)
EFB (Elementary Function
Block)
DFB\EFB Instance
Mono-instance DFB
EF (Elementary Function)

SFB (System Function


Block)
DB instance (Data Block)
FC (Function)
SFC (System Function)
Reminder:
STEP7 allows you to symbolize function block types and
instances.
In Unity Pro:
- DFB\EFB types and EFs are identified by a name,
- DFB\EFB instances are symbolized,
- DFB\EFB instances are not referenced to addresses,

SRs have names.

Structured and simple variables :


STEP7
UNITY PRO
UDT (User data type)
DDT (Derived Data Type)
DB of type (Data block)
DDT Instance
-DB Shared (Data block)
-DDT Instance
-If containing only one
-Anonymous Array
table
EDT (Elementary Data
EDT (Elementary Data
Type)
Type)
-Bool
-Bool
-Byte
-Byte
-Word
-Word
-Dword
-Dword
-Real
-Real
-Time
-Time
-S5Time
-Time_Of_Day
-TOD
-Date
-Date
-Date_And_Time
-DT
-Char
-Array[0..0] of String
-String
-String
Reminder:
STEP7 allows you to symbolize function block types and
variables.
In Unity Pro:
- DDT types are identified by a name
- DDT instances are symbolized and can be referenced to
addresses,
- EDTs are symbolized and can be referenced to addresses.

Memory Variables:
STEP7
UNITY PRO
M (Memory Bit)
%M (Ebool)
MB (Memory Byte)
MW (Memory Word)
%MW (Int)
MD (Memory Double)
%MD (Dint
Reminder:
Step7 allows you to symbolize memory variables.
Unity Pro only allows you to symbolize %M and %MW.

Local variables (addresses providing access to temporary

variables for instances of FBs and FCs):


STEP7
UNITY PRO
L (Local Data Bit)
LB (Local Data Byte)
LW (Local Data Word)
LD (Local Data Double)
Reminder:
Step7 allows you to symbolize temporary variables.
In Unity Pro, the temporary variables for EFs can only be
accessed by symbols.

Data Block (addresses providing access to static variables and


I\O parameters of FB instances, to I\O parameters of SFB
instances and to elements of DBs of Type\DB shared):
STEP7
UNITY PRO
DBx (Data Block Bit)
%MW for DDT instances
DBB (Data Block Byte)
referenced to addresses.
DBW (Data Block Word)
DBD (Data Block Double)
Reminder:
Step7 allows you symbolize static variables, I\O parameters
and elements of DBs of type and DBshared.
In Unity Pro:
- the public variables of DFB\EFBs can only be accessed by
symbols,
- the elements of DDT instances can only be accessed by
symbols unless the instances are referenced to addresses.

Addresses of Input/Output Variables (implicit exchanges)


STEP7
I (Input Bit)
IB (Input Byte)
IW (Input Word)
ID (Input Double)

UNITY PRO
Inputs
%Ir.m.c.d (Ebool)
%IWr.m.c.d (Int)
%Idr.m.c.d (Double)
IODDT instance

Q (Output Bit)
QB (Output Byte)
QW (Output Word)
QD (Output Double)

Outputs
%Qr.m.c.d (Ebool)
%QWr.m.c.d (Int)
%Qdr.m.c.d (Double)

IODDT instance
Definitions:
- r -> rack number,
- m -> module number,
- c -> channel number,
- d -> channel data.
Reminder:
Step7 allows you to symbolize Input\Output variables.
In Unity Pro the Input\Output variables can also be
symbolized, but it is totally adequate to use IODDTs (Input
Output Data Types), which enable you to achieve better
legibility.

Addresses of Input/Output Variables (explicit exchanges)


STEP7

UNITY PRO
Read_STS(%CHr.m.c)
Read_Param(%CHr.m.c)
or
Read_STS(Ioddt instance)
Read_Param(Ioddt instane)

-PIB (Periph Input Byte)


-PIW (Periph Input Word)
-PID (Periph Input
Double word)

-%MWr.m.c.d <- %CHr.m.c


-%MDr.m.c.d <- %CHr.m.c
Write_CMD(%MWr.m.c.d)
Write_Param(MMWr.m.c.d)
or
Write_CMD(Ioddt instance)
Write_Param(Ioddt instanc)

-PQB (Periph Out Byte)


-PQW (Periph Out Word)
-PQD (Periph Out
Double word)
Definitions:
- r -> rack number,
- m -> module number,
- c -> channel number,
- d -> channel data.
Reminder:

-%MWr.m.c.d->%CHr.m.c
-%MDr.m.c.d->%CHr.m.c

Step7 allows you to symbolize Input\Output variables.


In Unity Pro the Input\Output variables can also be
symbolized, but it is totally adequate to use IODDTs (Input
Output Data Types), which enable you to achieve better
legibility.