At A Glance: Correspondence of Program Objects Between Step7 and Unity Pro
At A Glance: Correspondence of Program Objects Between Step7 and Unity Pro
At A Glance: Correspondence of Program Objects Between Step7 and Unity Pro
At a Glance
Introduction
Contents
Subject
1 Presentation, Description and Organization of the
Constituent Objects of a Step7 Project Program
Page
3
11
20
Presentati
on of
Constituen
t Objects
of a
Program
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
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:
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:
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
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
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):
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:
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:
Program
Organization
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:
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
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.
Presentatio
n of
Constituen
t Objects of
a Program
The program for a project consists of objects containing the code and
data used.
Description
of
Constituent
Objects of a
Program
program sections,
DFB sections,
sub-routines.
Calling of an EF:
Input/output parameters,
Public variables,
Private variables.
These blocks are used to create:
Code (C language),
Input/output parameters,
Public variables.
These blocks are used to create:
Calling of an instance:
Simple types:
Bool\Ebool
Byte\Word\Dword
Int\Dint\UInt\UDint
Real
Time\Time_Of_Day\Date_And_Time
String
Complex types:
Array
Structure
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)
Introduction
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)
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.
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.
UNITY PRO
Read_STS(%CHr.m.c)
Read_Param(%CHr.m.c)
or
Read_STS(Ioddt instance)
Read_Param(Ioddt instane)
-%MWr.m.c.d->%CHr.m.c
-%MDr.m.c.d->%CHr.m.c