Professional Documents
Culture Documents
3.1 Program Structure
3.1 Program Structure
Program Structure
www.hcmute.edu.vn
Types of Program Structure
A linear program executes all of the instructions
for your automation tasks in sequence, one after
the other
Typically, the linear program puts all of the program
instructions into the OB for the cyclic execution of the
program (OB1)
www.hcmute.edu.vn
www.hcmute.edu.vn
Function (FC)
FCs are blocks without cyclic data
storages
The values of block parameters
cannot be saved until the next call
and have to be provided with actual
parameters when called
www.hcmute.edu.vn
www.hcmute.edu.vn
Function Block (FB)
FBs are blocks with cyclic data
storage, in which values are
permanently stored
The cyclic data storage is realized in
an instance DB
www.hcmute.edu.vn
www.hcmute.edu.vn
Data Block (DB)
Data blocks (DB) is used to store data for the code blocks
The data stored in a DB is not deleted when the execution of the associated
code block comes to an end
Two types of DBs:
An instance DB: stores the data for a specific FB
A global DB: stores data for the code blocks. Any OB, FB, or FC can
access the data in a global DB
www.hcmute.edu.vn
www.hcmute.edu.vn
Instance Data Block
Instance DBs are always assigned to
a FB
Instance DBs are created
automatically when calling an FB
The structure of the instance DB is
specified in the appropriate FB and
can only be changed there
www.hcmute.edu.vn
www.hcmute.edu.vn
Global Data Block
All blocks in the user program can
access global DBs
The structure of the global DBs can
be arbitrarily made up of all data
types
Global DBs are either created via the
program editor or according to a
previously created “user-defined PLC
data type”
A maximum of 256 structured tags
(ARRAY, STRUCT) can be defined
www.hcmute.edu.vn
www.hcmute.edu.vn