You are on page 1of 8

TIA Portal Modular

Programming
In Urdu/Hindi/English
Instructor: Rana Muhammad Awais
TIA Portal Modular Programming

Cyclic Execution

OB1
FB1

FB2

FC1

Better Structure

Source: Siemens Rana Muhammad Awais | www.automationplay.com| automationplayonline@gmail.com | Facebook.com/automationplay | Youtube: Rana Muhammad Awais
TIA Portal Modular Programming

Source: Siemens Rana Muhammad Awais | www.automationplay.com| automationplayonline@gmail.com | Facebook.com/automationplay | Youtube: Rana Muhammad Awais
TIA Portal Modular Programming

OB1
FB1

FB2

Source: Siemens Rana Muhammad Awais | www.automationplay.com| automationplayonline@gmail.com | Facebook.com/automationplay | Youtube: Rana Muhammad Awais
TIA Portal Modular Programming

Function (FC) (Acts like subroutine):

Performs a specific operation on set of input values

• To perform standard or resuable operation such as mathematical


calculations
• To perform functional tasks such as for individual controls using bit logic
operations
• FC can be called several times at different points in the program. This
reuse simplifies the programming of frequently recurring tasks

Source: Siemens Rana Muhammad Awais | www.automationplay.com| automationplayonline@gmail.com | Facebook.com/automationplay | Youtube: Rana Muhammad Awais
TIA Portal Modular Programming

Function Block (FB) (Subroutine without a memory):

Performs a specific operation on set of input values

• An FB is a code block whose calls can be programmed with block parameters.


• The FB stores the input (IN), output (OUT), and in/out (IN_OUT) parameters in variable memory that is located in a
data block (DB), or "instance" DB.
• The instance DB provides a block of memory that is associated with that instance (or call) of the FB and stores data
after the FB finishes.
• You typically use an FB to control the operation for tasks or devices that do not finish their operation within one scan
cycle. To store the operating parameters so that they can be quickly accessed from one scan to the next, each FB in
your user program has one or more instance DBs.
• When you call an FB, you also open an instance DB that stores the values of the block parameters and the static local
data for that call or "instance" of the FB. These values are stored in the instance DB after the FB finishes.
• You can associate different instance DBs with different calls of the FB.

Source: Siemens Rana Muhammad Awais | www.automationplay.com| automationplayonline@gmail.com | Facebook.com/automationplay | Youtube: Rana Muhammad Awais
TIA Portal Modular Programming

Source: Siemens Rana Muhammad Awais | www.automationplay.com| automationplayonline@gmail.com | Facebook.com/automationplay | Youtube: Rana Muhammad Awais
TIA Portal Modular Programming

DATA BLOCKS
You create data blocks (DB) in your user program to store data for the code blocks. All of the
program blocks in the user program can access the data in a global DB, but an instance DB
stores data for a specific function block (FB).
Your user program can store data in the specialized memory areas of the CPU, such as for
the inputs (I), outputs (Q), and bit memory (M). In addition, you can use a data block (DB) for
fast access to data stored within the program itself.
The data stored in a DB is not deleted when the data block is closed or the execution of the
associated code block comes to an end. There are two types of DBs:

● A global DB stores data for the code blocks in your program. Any OB, FB, or FC can
access the data in a global DB.

● An instance DB stores the data for a specific FB. The structure of the data in an instance
DB reflects the parameters (Input, Output, and InOut) and the static data for the FB. The
Temp memory for the FB is not stored in the instance DB.
Although the instance DB reflects the data for a specific FB, any code block can access the
data in an instance DB.

Source: Siemens Rana Muhammad Awais | www.automationplay.com| automationplayonline@gmail.com | Facebook.com/automationplay | Youtube: Rana Muhammad Awais

You might also like