Siemens vs Allen-Bradley: Function Blocks

Siemens vs Allen-Bradley: Function Blocks

Siemens and Rockwell Automation are two giants competing in industrial automation technology today. Rockwell (aka Allen-Bradley) seems to be more popular in the US market, but Siemens has a larger international customer base. A cursory Google search will reveal that there is no lack of debate among automation professionals over which one is preferred.

On the higher end of their PLC lines, the programming environments to use are:

As someone who uses both platforms regularly, I would like to compare one of the key differences between them - function blocks.

What's a function block?

Siemens uses the term Function Block (FB) for program routines that can have internal memory, as opposed to Function Calls (FC) that have only temporary internal memory. Function blocks are a fundamental concept in the Siemens platform, which give them a significant advantage for large, modular applications.

In AB’s RSLogix 5000 version 16 and higher, reusable function blocks are called Add-On Instructions (AOI) and can be defined with interface parameters and local tags. Since this feature was only added in 2007, it is often overlooked and doesn’t fit as seamlessly into the overall environment.

Why use function blocks, you ask? You must read the DMC blog: "IEC 61131-3 Function Blocks - Unleash the Power!"

It is worth mentioning that both platforms adhere to the IEC-61131-3 standard, which means that function blocks are available and can be written in any of the standard's languages.

Interfacing to an instance of a function block

The way you interface to a function block is critical for program efficiency, readability, and development time. The point of a reusable function block is to wrap up complex or repetitive code and make a simple and easy to use interface in order to use that code. For example, when I visit a fast food drive-thru, I don’t need to tell them how to make a burger. They have made billions before mine. I just want to give my order, watch my burger come out the window, and then be on my way.

In AB: Parameters in ladder have to be referenced independently from the function block call

If the function block instance is called in ladder, the input parameters can only be assigned with the block call if they are constants. Variable inputs must be assigned to input parameters in preceding ladder rungs. Outputs must be referenced in ladder rungs following the function block call. If calling the function block instance in FBD (function block diagram), then variables can be directly assigned to input and output parameters.

Disadvantage: More rungs of ladder to maintain. If called in FBD instead, then there are restrictions on instance declaration (see below) and simple Boolean logic is more complicated because you must use the FBD function boxes instead of contacts and coils.

In Siemens: Parameters are directly interfaced in both ladder and FBD

Function block instances that are called in ladder and FBD are essentially the same. Even in ladder, variables can be assigned directly to input parameters. Boolean input parameters can also be assigned to the result of ladder logic operations. Function block outputs can be assigned directly to variables in the same rung of ladder.

Note that function block input and output parameters can also be accessed symbolically from other rungs in ladder logic (just like the AB example above), but Siemens has the additional advantage of directly assigning input and output parameters in the same rung as the function block call.

Advantage: All input and output parameter assignment for a function block instance can be consolidated in one rung and not spread out on separate rungs or throughout the program.

Declaring an instance of a function block

In AB: Limited to program tag file. If using FBD, cannot reside in a UDT

Instances of AOIs are most commonly declared in the “Program Tags” file of a program folder. Even for very modular programs, all function blocks are listed in this one common location. Instances can be declared within UDTs (user-defined types), but not if you want to use them in the FBD environment.

Advantage: Simplicity. One location to look through for each program folder.

In Siemens: Memory resides in an instance data block, but is declared within parent function blocks.

Most program logic, not just reusable logic, is located within function blocks. “Parent” function blocks are assigned an instance data block. All reusable function block instances can be declared within the parent function block’s static memory.

Advantage: Modularity. Instances are declared within the function block that they are called.


In summary, Siemens seems to offer a little more flexibility in how function blocks are interfaced and instantiated. We have seen, however, that both Allen Bradley and Siemens offer solutions for reusable function blocks on their higher-end PLCs. Both Function Blocks in Siemens and Add-On Instructions in Allen Bradley will enhance the modularity and maintainability of your PLC program.

Learn more about DMC's Siemens PLC and Allen-Bradley PLC programming expertise.


# Wharton
I am also converting code from Rockwell to Siemens S7-1200, but I am finding it difficult to find a suitable translation for the control (R) addresses. Could you possibly elaborate on how the control (R) addresses work and what the best way to translate them might be?
Thank you,
Yusif Nurizade
# Yusif Nurizade
Hi #Mayhew,

I don't believe there is an equivalent block to SQO in Siemens but you should be able to write one in SCL. You would need positive edge detection and a position that you would increment if it hadn't reached the reset point. At the reset point, Q would be true and the position reinitialized. You would also push an output array indexed by the position. I can go into more detail if you need.

Yusif Nurizade
# Mayhew

I have some Rockwell code that I'm converting to a Siemens S-1200. The Rockwell code uses the SQO (sequencer) instruction. Siemens doesn't seem to have an equivalent FB. Do you know of an Siemens equivalent to Rockwell's SQO that I could use?

# irfan

Can I ask copy from your file about this topic, because I'm still fails try to make file like yours

Dan Aukes
# Dan Aukes
Pedro -

As a user of both Allen Bradley and Siemens products(and a former employee of DMC, for full disclosure), I would also say that your plant's familiarity with these different systems will play almost a larger role than any other factor.

If you are already running with one type of product, or your maintenance team is comfortable with one particular product line, it can sometimes be difficult to encourage changing boats, even if the other solution is cheaper or in some way better.

If your company is not performing maintenance on the line itself, talk to your distributor or service partner to make sure they are comfortable with the platform and have the experience and equipment to update / maintain the line should you need it.
Nick Shea
# Nick Shea

Thanks for reading my article.

Both of these controllers will certainly do the job for your application. Things to evaluate are cost, maintainability (what platform you prefer and have on other systems in your facility), and special functionality like communication with other devices.

First of all, I recommend that you talk to your local Siemens and Allen Bradley distributers to make an accurate price comparison. Next, it helps to evaluate which devices the PLC is communicating with. Is there an HMI? Are there VFDs or motor controllers that would be networked with the PLC? Will the PLC be communicating to a computer or database?

With all other factors being equal, I would personally lean toward the S7-315 PLC. Like I mentioned in my article, I think the Siemens platform will give you more flexibility to write organized, function block-based code. It also gives you flexible data blocks to store and log performance data from your system.

Let me know if you have any other questions.

Best Wishes,
Nick Shea
# Nick Shea

Thanks for your comments! The "disadvantage" that I listed was meant only to temper the larger advantage that Siemens provides in giving you the option to directly interface with the function block instance. I realize that I never explicitly stated that larger advantage. Siemens definitely has the advantage in allowing you to directly interface with the function block like you can in FBD.

And you are correct, if you prefer to symbolically reference the function block input and output parameters in other rungs (like in AB), then you certainly have the flexibility to do so in Siemens - although I recommend taking advantage of the direct access option where possible for the sake of simplifying your code.

I have updated my blog text above in an effort to clarify my original intent. Sorry for the misunderstanding! :)

Best wishes,
Jukka-Pekka Muotio
# Jukka-Pekka Muotio
My point was this: "Disadvantage: Potentially large and complex rungs of ladder that include both the function block instance call in addition to related input parameter logic." is not an issue as it is not true as you can do it the same way as with aoi. It cant be disadvantage compared to other when you can do it also same way as with the target of comparison.In contratory, its only advantage in that case as you can do it the way that fits to the current situation better.
Matt Puskala
# Matt Puskala
Hi Jukka-Pekka - a fellow Finn (I'm quarter Finnish ;-) ).

You bring up a good point! I think that all that Nick was trying to say is that if you want to call a function block from ladder, you do at some point in time have to actually have the function block in a rung, which can be large and ugly if it has a lot of IO. However you bring up a great point about an elegant way to put the inputs and outputs on different rungs so that all of the logic for each function block IO does not have to be on one large, ugly rung.
Pedro Esquivel
# Pedro Esquivel

I have to decide PLC brand... among Siemens S7 315 2DP vs. AB controllogix 5561.
This PLC will be monitoring and controlling the performance of belt conveyor with 3 x 750 kw motors, checking the starting and all the operating and maintenance parameters, ando we are replacing a old 5550 PLC
Our company is very close to the border with. U.S.A.
could you make me a recomendation with this data ?
thanks in advance
Jukka-Pekka Muotio
# Jukka-Pekka Muotio
You should also take into account that siemens fb can be interfaced like ab aio.
Nick Shea
Here are a couple suggestions for the issues you mentioned... assuming you are using a recent version of Simatic Manager and 300 or 400 level PLCs.

1. Set up your addressing priority to be symbolic: Open the "Object Properties" for the "Blocks" folder in the project tree where your program resides. Under the "Address Priority" tab, select the lower right option. This will allow you to modify data blocks and static memory without worrying about shifting addresses.

2. "Check block consistency" by right-clicking the same Blocks folder whenever you make changes to a function block's inputs, outputs, or static memory. Recompile your project and the instance data blocks will automatically incorporate your changes to the function block memory.

You should never have to manually re-generate instance data blocks (aside from compiling from the Check Block Consistency interface). If you make a change to a function block interface, you can also right-click the block where it is being called and you will often get the option to "Update Block Call".

Thanks for your comments,
Patrick Beckett
# Patrick Beckett
Within Siemens the monitoring of all FC and FBs has to be setup very carefully or you get inconsistent data.
If you change the external design or the static variables of a function block in S7 then it is handled very poorly. You must re-declare the instances and re-generate the parent FB's DB. Very easy to make a mistake.
Have a look at the Mitsubishi Solution in IEC Developer for the Q-series. FB instances are treated as variables which may be defined either globally or locally.

Post a comment

Name (required)

Email (required)

Enter the code shown above: