13 - Declaration Table
13 - Declaration Table
DECLARATION TABLE
SIEMENS
SIMATIC S7 1/13 March 27, 2024
SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS
Objectives
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.
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
IN Parameter
when the block is exited.
The data are stored in the L
stack (local data stack). The L OUT Parameter
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.
Calling FC3
Exercise:
1- In FC5, Write a PLC program, using declaration table to calculate the following equation:
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