How to use the organization block in Siemens PLC programming?

Aug 10, 2026Leave a message

Hey there! As a Siemens PLC supplier, I've had my fair share of experiences with programming these bad boys. One key aspect that often trips up those new to Siemens PLC programming is the organization block. In this blog, I'll walk you through how to use the organization block in Siemens PLC programming.

_202501021637167_

What is an Organization Block?

First things first, let's talk about what an organization block is. In Siemens PLC programming, organization blocks (OBs) are the entry points for the execution of your program. They're like the gatekeepers that determine when and how your program runs. Different OBs are triggered by different events, such as the start - up of the PLC, a cyclic time interval, or an error condition.

Types of Organization Blocks

There are several types of organization blocks, each with its own specific function.

1. OB1 - Cyclic Execution

OB1 is the most commonly used organization block. It's responsible for the cyclic execution of your program. Think of it as the heart of your PLC program, beating at a regular interval. Every time the cycle time elapses, OB1 is executed, and all the code within it gets processed. For example, if you have a conveyor belt system, and you want to check the status of sensors and control the motors every second, you'd put that code in OB1.

2. OB100 - Warm Start

OB100 is executed when the PLC undergoes a warm start. A warm start occurs when the PLC is restarted, but the values of certain memory areas are retained. This is useful when you want to initialize your program or perform some setup tasks after a restart. For instance, if you have a process that requires some initial settings to be loaded, you can put that code in OB100.

3. OB32 - Cyclic Interrupt

OB32 is a cyclic interrupt organization block. It allows you to execute a specific part of your program at a different cyclic rate than OB1. This is handy when you have some tasks that need to be performed less frequently or more frequently than the main cycle. Say you have a temperature sensor that only needs to be read every 5 seconds, while the main control logic in OB1 runs every second. You can put the temperature - reading code in OB32.

How to Use Organization Blocks in Programming

Now that we know what organization blocks are and their types, let's dive into how to use them in programming.

Step 1: Create the Organization Blocks

In your Siemens programming software, like TIA Portal for Siemens PLC S7 1200 and Siemens PLC S7 1500, or STEP 7 for Siemens PLC S7 200, you can easily create organization blocks. Navigate to the appropriate section in the project tree and add a new OB. You can select the type of OB you want to create, such as OB1, OB100, or OB32.

Step 2: Write the Code

Once you've created the organization block, it's time to write the code. The code in each OB should be related to its specific function. For example, in OB1, you'll typically have the main control logic of your system. You can use ladder logic, structured text, or other programming languages supported by the Siemens PLC.

Let's say you're controlling a simple lighting system. In OB1, you might have code like this (using ladder logic concepts):

// Check if the light switch is on
IF I0.0 THEN
    // Turn on the light
    Q0.0 := 1;
ELSE
    // Turn off the light
    Q0.0 := 0;
END_IF;

In OB100, you might initialize some variables or reset certain parameters:

// Initialize a counter variable
MW0 := 0;

Step 3: Set the Execution Parameters

Some organization blocks, like OB32, require you to set the execution parameters. You need to define the cyclic time for which the OB will be executed. In the programming software, you can find the settings for the OB and specify the time interval. For example, if you want OB32 to run every 5 seconds, you'd set the cyclic time to 5000 milliseconds.

Tips for Using Organization Blocks Effectively

  • Keep It Organized: Use different OBs for different tasks. This makes your program more modular and easier to understand and maintain. For example, put all the safety - related code in a separate OB so that it can be easily modified or reviewed.
  • Error Handling: Use OBs for error handling. There are specific OBs for handling errors, such as OB82 for detecting module faults. By using these OBs, you can ensure that your system responds gracefully to errors.
  • Test Thoroughly: Before deploying your program, test each OB separately to make sure it's working as expected. You can simulate different events to trigger the OBs and check the output.

Conclusion

Using organization blocks in Siemens PLC programming is crucial for creating efficient and reliable programs. By understanding the different types of OBs and how to use them, you can take full advantage of the capabilities of Siemens PLCs. Whether you're working on a small - scale project or a large industrial automation system, proper use of organization blocks will make your programming life a whole lot easier.

If you're in the market for Siemens PLCs or need more information on programming, don't hesitate to reach out. We're here to help you with all your Siemens PLC needs and can assist you in getting the most out of your automation projects. Let's start a conversation about your requirements and see how we can work together to achieve your goals.

References

  • Siemens PLC Programming Manuals
  • Industrial Automation Textbooks on PLC Programming