Sei sulla pagina 1di 10

SIEMENS

DECLARATION TABLE

SIEMENS
SIMATIC S7 1/13 November 5, 2019
SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Objectives

- Know How Temp. Variables Can Be Accessed & Where It Stored.


- Understand The Declaration Table & How To Use It.

SIMATIC S7 2/13 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Types of variables
The inputs and outputs in our programs
were coded directly with their actual
address assignments.
There is two types of variables:
Global Variables
• I/ O
• PII / PIQ
•M/T/C
• DB areas

Local Variables

Temporary variables:
Variables that are stored only while the
block is being executed. They can be
declared in all blocks (OB, FC, FB).

Static variables:
Variables to be retained even after the
block is executed, can only be declared in
function blocks. The instance DB
assigned to the FB is used as the storage
location for these static variables.

SIMATIC S7 3/13 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Temporary variables:
Temporary variables can be
used in all blocks (OB, FC, FB).
They are used to temporarily
store information while the
block is being executed. The
data are lost when the block is
IN Parameter
exited.
The data are stored in the L
stack (local data stack). The L OUT Parameter

stack is a separate memory


area in the CPU.

Declaration Table
Before a temporary variable
can be used in a block, it must
be declared in the block‘s
declaration table.
Type of Parameter:
The ‘in‘ declaration type
should be assigned only to
declaration types that will be
read.
The ‘out‘ declaration type for
paramaters that will be written
to within the function.

SIMATIC S7 4/13 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Declaration Table & Program in FC3

Program for starting and


stopping a motor using the
input & output declaration
table parameter.

SIMATIC S7 5/13 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Calling FC3

In FC4, FC3 can be called


& it can be called in any
other FC,FB or OB

SIMATIC S7 6/13 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Intering Data for FC3

Calling For FC3 In FC4

SIMATIC S7 7/13 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Calling In OB1 For FC4

When Calling The Motor Function


FC3, FC4 Is The Function That Will Be
Called In OB1

SIMATIC S7 8/13 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Exercise:

1- In FC5, Write a PLC program, using declaration table to calculate the following equation:

K = 4X + 5XYZ + 2Y/3Z + 2(X+Z)


Then find the value of K at: X=1, Y=2 and Z=1

SIMATIC S7 9/13 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Answer of Exercise 1:
IN The Declaration Table:

IN: X,Y,Z
OUT: K
Temp: ????
The value of K at: X=1, Y=2 and Z=1
K=19

SIMATIC S7 10/13 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved

Potrebbero piacerti anche