Inst ToolsInst ToolsInst Tools
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Search
  • Books
  • Software
  • Projects
  • Process
  • Tools
  • Basics
  • Formula
  • Power Plant
  • Root Cause Analysis
  • Electrical Basics
  • Animation
  • Standards
  • 4-20 mA Course
  • Siemens PLC Course
Reading: OB1 – Main Cyclic Organization Block in TIA Portal
Share
Notification Show More
Font ResizerAa
Inst ToolsInst Tools
Font ResizerAa
  • Courses
  • Design
  • PLC
  • Interview
  • Control System
Search
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Inst Tools > Blog > PLC Tutorials > OB1 – Main Cyclic Organization Block in TIA Portal

OB1 – Main Cyclic Organization Block in TIA Portal

The OB1 main cyclic organization block in TIA Portal is responsible for cyclically executing your logic by the PLC.

Last updated: March 28, 2023 11:47 am
Mahmoud Salama
PLC Tutorials
1 Comment
Share
10 Min Read
SHARE

In previous articles we discussed different types of Blocks in SIEMENS TIA Portal, we talked about function blocks FBs, functions FCs, and data blocks DBs.

Contents
What is an Organization Block (OB)?Different Types of Organization BlocksMain Cyclic Interrupt OB1Cycle Time MonitoringSimple Program Example in PLCConclusion

In this article we will take about another type of block in SIEMENS PLCs, these are the organization blocks, and in this article, we will discuss the most important organization block of them all, which is the Main Organization Block or OB1.

Contents:

  • What are organization blocks?
  • Different types of OBs.
  • What is OB1?
  • Cycle time monitoring.
  • Simple program example.
  • Conclusion.

What is an Organization Block (OB)?

Organization blocks, you can think of them as functions FCs or function blocks FBs. But the difference is, you don’t call them, the operating system of the PLC calls these organization blocks, whether the operating system calls the OB cyclically as OB1 or whether it gets called when a certain event occurs, either way, the operating system takes care of it. You only need to create the block and add whatever logic you want inside the block. Sometimes you don’t even need to add any code inside the OB, just creating the OB itself can provide many benefits, which we will see when discussing some of those OBs.

Organization blocks are the interface between the PLC operating system and the user program. Any PLC will have two different programs, the runtime program which is the operating system of the PLC, and the user program which is the logic or code that the PLC programmer will write to control a certain process. This two different software need to talk with each other, and the organization blocks OBs are how that is done.

Organization blocks OBs are used to perform a lot of tasks, some of which are listed below:

  • Startup characteristics of the automation system
  • Cyclic program processing
  • Interrupt-driven program execution
  • Error handling.

Different Types of Organization Blocks

As organization blocks are basically the tools of the operating system to perform a lot of tasks.

Different tasks require different OB, and that is why you have many different OBs inside a PLC, how many different OBs will depend on the type of PLC you are using, but here are some of the most common OBs you can find in almost all of SIEMENS PLC:

  • Main Cyclic OB1.
  • Time interrupts OBs.
  • Time of day OBs.
  • Software errors OBs.
  • Hardware errors OBs

Many more Organization blocks are available for use with your logic. See picture 1.

Different Types of Organization Blocks in Siemens PLC
Picture 1 – Different Organization Blocks available in TIA Portal

In this article, we will discuss the most important organization block of them all, which is the Main Cyclic Interrupt OB1.

Main Cyclic Interrupt OB1

The main cyclic OB1 is the organization block which is responsible for cyclically executing your logic by the PLC. Whenever you create a new project and add a PLC, the Main OB1 will be automatically created by the software. These are the minimum needed blocks for a PLC code. See picture 2.

Main Cyclic Interrupt OB1
Picture 2 – Main OB1 is created automatically

Inside this Main OB1, you can either write your whole PLC program if it is a small project. If your project is quite large, then you probably have some functions FCs of function blocks FBs that you need to execute. In that case, you will use the Main OB1 to call them.

Off course, you don’t have to call every FC or FB by the OB1, but if your OB1 is not the first block of your nesting calls, then it will not be executed. See picture 3.

OB1 - Main Cyclic Organization Block in TIA Portal
Picture 3 – Calling your blocks by OB1

The essential basis of your PLC code is the cyclic behavior, meaning you need your code to be executed continuously. When the processing of your logic has been completed, the operating system starts processing it again. That is done through the use of the main OB1, you put and call all of your logic and code inside this OB1 and the operating system will make sure to continuously execute it.

You should know that, even if you can’t create an OB1 block as it is automatically created when adding a new PLC, you can create more than one cyclic interrupt block.

OB1 is a cyclic interrupt, that the operating system will automatically and continuously call and executed whatever logic is inside. However, for large PLC projects where you have so many functions and function blocks in your PLC logic, you can use more than one cyclic interrupt OB to better structure your code to make it easy to read and follow.

In that case, you would create another cyclic interrupt, see picture 4.

OB1 is a cyclic execution organization block
Picture 4 – Creating more than one cyclic OB

When you have created several program cycle OBs, these are called one after the other in the order of their OB numbers.

The program cycle OB with the lowest OB number is called first. See picture 5.

Siemens PLC Programming Blocks
Picture 5 – Program cycle with more than one cyclic OB

After the cyclic program is complete, the operating system updates the process images as follows:

  1. It writes the values from the process image output to the output modules.
  2. It reads the inputs at the input modules and transfers these to the process image input.

The previous two steps plus the execution of the PLC program are called a scan cycle. See picture 6.

Scan cycle of a Siemens PLC
Picture 6 – Scan cycle of a Siemens PLC

Cycle Time Monitoring

Cycle time refers to the runtime of the cyclic program, including the runtime of all nested program parts like FCs, FBs, and higher-priority OBs. If you have created several program cycle OBs, each program cycle OB contributes to the cycle time.

The operating system monitors whether the cycle time remains smaller than the configured maximum cycle time. If it exceeds the maximum cycle time, PLC will either go to STOP mode or call OB80 depending on your programming.

Apart from monitoring the maximum cycle time, it is also possible to guarantee a minimum cycle time. To do this, the operating system delays the start of a new cycle until the minimum cycle time has been reached.

You can configure the minimum and maximum cycle time in the configuration properties of your PLC. See picture 7.

Cycle Time Monitoring in PLC
Picture 7 – Configure the minimum and maximum cycle time

Simple Program Example in PLC

Simple Program Example in PLC
Picture 8 – PLC Program Example

To better understand the PLC program cycle and OB1 execution, let’s create a simple program. This program will use an add instruction that will accumulate a value of 1 into a memory area each 1 scan cycle. See the following simulation.

PLC program cycle and OB1 execution

As you see from the animation, the add instruction is being executed very fast; this is how fast the scan cycle is. It will depend on how powerful your PLC is. But mainly the scan cycle is in the range of milliseconds.

Downloads:

  • Main OB1
  • PLC Logic

Conclusion

  • Organization blocks are the interface between the PLC operating system and your control program.
  • Main Cyclic OB1 is cyclically executed by the operating system.
  • You will execute your logic by including it inside one or more Cyclic OBs.
  •  The scan cycle time is the time used to execute your logic 1 time.

If you liked this article, then please subscribe to our YouTube Channel for Instrumentation, Electrical, PLC, and SCADA video tutorials.

You can also follow us on Facebook and Twitter to receive daily updates.

Read Next:

  • System and Local Time in PLC
  • PLC Programming Tips & Tricks
  • Timers in Siemens Tia Portal
  • SCADA System Architecture
  • Static and Temp Variables in PLC
Don't Miss Our Updates
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
You've successfully subscribed !

Continue Reading

PLC Example with Switches
How to Configure Analog Inputs and Outputs in Delta PLC?
How to Select the Right Encoder for Your Machine?
Control Two Motors in Sequence after Time Delay – Circuit, Operation
Shutdown Motors in Timed Operation PLC Program
4–20 mA Process Control Loops
Share This Article
Facebook Whatsapp Whatsapp LinkedIn Copy Link
Share
1 Comment
  • Tidjani Mohammed says:
    November 5, 2023 at 2:44 pm

    That is very interesting article just keep on

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

128.3kFollowersLike
69.1kFollowersFollow
210kSubscribersSubscribe
38kFollowersFollow

Categories

Explore More

PLC Timer Programming Examples – TON, TOF, TP and TONR
Advanced PLC Conveyor Control: Forward and Reverse Rotation
PLC Instruction List Example for Level Control of Tank
Safety Considerations in PLC System Design
Latching and Unlatching in PLC Programming Example
Industrial Automation Engineers Interview Questions
PLC Programming Videos
What is a Control Panel and its types?

Keep Learning

Difference Between PLC and CNC Machine

Difference Between PLC and CNC Machine

PLC Program Paint Spraying

PLC Program for Paint Spraying

Code Block Comparison

Compare Online and Offline PLC Programs

Open PLC Software

Open Source PLC and SCADA Software

FIFO in STL Language in Siemens PLC

How to Code a FIFO Queue in STL Language in Siemens PLC?

Electrical Ladder Diagram Control using Timers Example

Electrical Ladder Diagram Control using Timers Example

how-a-plc-do-the-scaling-for-a-sensor

How a PLC do the Scaling for a Sensor ?

Intrinsic Safety Barriers

Intrinsically Safe Barriers Questions and Answers

Learn More

How a Δp flow meters works

What is Differential Pressure Flow Meter?

Best PLC for Your Project

Finding the Best PLC for Your Project – Tips and Tricks

Industrial Automation Mobile Apps

Industrial Automation Mobile Apps

De-energized Electrical Circuits

De-energized Electrical Circuits, Networks, and Equipment

electric valve actuator

Electrical Actuators

PLC Count values higher than 999

PLC Count values higher than 999

Measuring Instruments Questions and Answers

150+ Measuring Instruments Questions and Answers

Difference Between Cyclic and Acyclic Communication

Difference Between Cyclic and Acyclic Communication

Menu

  • About
  • Privacy Policy
  • Copyright

Quick Links

  • Learn PLC
  • Helping Hand
  • Part Time Job

YouTube Subscribe

Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?