Siemens PLC Programming OBs in Siemens TIA Portal

BlocksThe programmable logic controller provides various types of blocks in which the user program and the related data can be stored. Depending on the requirements of the process, the program can be structured in different blocks. You can use the entire operation set in all blocks (FB, FC and OB).

Organization blocks (OBs)
Organization blocks (OBs) form the interface between the operating system and the user program. The entire program can be stored in OB1 that is cyclically called by the operating system (linear program) or the program can be divided and stored in several blocks (structured program). There are many different OBs executing as per different conditions and its priority.

Function (FCs)
A function (FC) contains a partial functionality of the program. It is possible to program functions so that they can be assigned parameters. As a result, functions are also suited for programming recurring, complex partial functionalities such as calculations.

Function Block (FBs)
Basically, function blocks offer the same possibilities as functions. In addition, function blocks have their own memory area in the form of instance data blocks. As a result, function blocks are suited for programming frequently recurring, complex functionalities such as closed-loop control tasks.

Structured Programming
Linear Program
The entire program is found in one continuous program block. This model resembles a hard-wired relay control that was replaced by a programmable logic controller. The CPU processes the individual instructions one after the other.

Partitioned Program
The program is divided into blocks, whereby every block only contains the program for solving a partial task. Further partitioning through networks is possible within a block. You can generate network templates for networks of the same type. The OB 1 organization block contains instructions that call the other blocks in a defined sequence.

Structured Program
A structured program is divided into blocks. The code in OB1 is kept to a minimum with calls to other blocks containing code. The blocks are parameter assignable. These blocks can be written to pass parameters so they can be used universally. When a parameter assignable block is called, the programming editor lists the local variable names of the blocks. Parameter values are assigned in the calling block and passed to the function or function block.

Start Up OBs.
The startup program is executed once during the transition from "STOP" mode to "RUN" mode. Current values from the process image of the inputs are not available for startup program, nor can these values be set.After the complete execution of the startup OBs, the process image of the inputs is read in and the cyclic program is started.There is no time limit for executing the startup routine. Therefore the scan cycle monitoring time is not active. Time-driven or interrupt-driven organization blocks cannot be used.

OB 100- Warm Restart
OB 101- Hot Restart
OB 102-Cold Restart

Cyclic Program OB

OB1 is main Organization block which is executing the program cycle periodically or cyclically with lowest priority.

Periodic Program OBs

These OB will execute periodically once interrupt will come as per the condition like Time of day interrupt OB 10 to OB 17.

Time of Day OB

A time-of-day interrupt can only be processed if it is set and activated, and a corresponding organization block exists in the user program.

The start times of periodic time-of-day interrupts must correspond to a real date. For example, it is not possible to repeat an organization block monthly which first occurs on January 31st. In this case, on OB will only be started in the months that have 31 days.

A time-of-day interrupt activated during startup by extended instruction call ACT_TINT will not be executed until the startup is complete. After each CPU startup, you must reactivate previously set time-of-day interrupts

Cyclic Interrupt OB

Cyclic interrupt OBs serve to start program in periodic time intervals independently of the cyclic program execution. The start times of a cyclic interrupt OB are specified using the time base and the phase offset.

The time base defines the intervals at which the cyclic interrupt OB is started and is an integer multiple of the basic clock cycle of 1 ms. The phase offset is the time by which the start time is offset compared with the basic clock cycle. If several cyclic interrupt OBs are being used, you can use this offset to prevent a simultaneous start time if the time bases of the cyclic interrupt OBs have common multiples.

You can specify a time period between 1 ms and 60000 ms as the time base.

Event Driven Program OBs

There are 4 types of event driven interrupt.

1.     Time Delay interrupt (OB 20 to 23)

A "Time delay interrupt" OB will interrupt cyclic program execution when a specified delay time has expired. The delay time is specified in the input parameter of the extended instruction "SRT_DINT".

2.     Hardware Interrupt (OB 40 to 47)

A "Hardware interrupt" OB will interrupt cyclic program execution in reaction to a signal from a hardware event. The events must be defined in the properties of the configured hardware.

3.      Synchronous Error (OB 80 to 87)

When there is any hardware, rack, power or communication type of fault or failure is there then it will be synchronous error and we can use below OBs as per examples.

4.      Asynchronous Error (OB 121 to 122)

When there is programming type of error or access error is coming in terms of addressing that would be Asynchronous error and  in that case we can use these OBs as per below.

Just Check Video for More Details

Don't Forget to Like & Share

Post a Comment