Efficient SCL Development in TIA Portal V14

Efficient SCL Development in TIA Portal V14

With the recent release of TIA Portal V14 and V14 SP1, several new additions have been added to increase the efficiency and organization of code written in SCL (structured control language).

Recently, I have been using many of these new features while writing code in SCL and wanted to share them with you. We will start by defining SCL and its uses in programming, then we will compare ladder to SCL, next we will discuss inline SCL networks, Regions and Region Synchronization, and will finish by reviewing the streamlined Surround With...

What is SCL and When Should I Program Using it?

SCL stands for Structured Control Language and is a text-based form of programming Siemens PLCs.

SCL opens up several new constructs that are unavailable while programming in conventional ladder logic, including the FOR and WHILE loops as well as the CASE statement. These are particularly useful when dealing with large amounts of data in an array form. Using SCL also increases the readability of any sort of arithmetic calculation.

What Does SCL Look Like?

Below is an example of code written in both ladder and SCL to accomplish the same result.

Ladder Logic

I have created an array of five integers and I would like to check and see if any indexes of my array are equal to three. In order to get this information in a single scan of my logic, in Ladder, I would need to check each index individually to determine if any of them are equal to 3.

Screenshot of Network 2 - checking the array.

For a small array, writing this code in ladder logic doesn’t seem so bad. However, imagine I had an array of a hundred or even a thousand integers and I needed to check all them.


Examining SCL logic, suddenly, the ladder logic solution seems inefficient in comparison. Using a combination of a FOR loop, IF statement and an EXIT, I can easily check an array of any size in a single scan.

Network 4 - checking the array.

If my application required, I could even nest FOR loops within each other in order to check or set values of a UDT which contains an array of variables.

Inline SCL Networks

In TIA Portal V14, there is now the ability to create function blocks and function calls that contain code written in both LAD and SCL. An SCL network can easily be inserted into a function without the need to create a separate SCL function.

For example, it was previously necessary to use LAD math operations or a separate SCL function to string together a complex calculation that can now easily be written in an SCL network.


  • Regions are a new SCL organizational tool that provides a similar level of organization as a network does in a LAD function.

  • Regions are collapsible and easy to navigate through the sidebar.

  • Regions can be nested, if needed, to provide an even greater level of organization.

  • Keep in mind that regions cannot cross logical boundaries. For example, if a region begins inside one case of a case statement, it must also end in the same case. Failure to do so will result in a compiler error.

  • Regions make lines of comments that serve only as a separator for a new section of code unnecessary.



Synchronizing Regions

  • The sidebar navigation that shows the regions in an SCL function can also be set to be synchronized with the code. This means that when expanding or contracting a region in the sidebar, the body of code will reflect the change.

  • With synchronization turned on, large bodies of SCL code can easily be minimized or maximized without heavy use of the scroll wheel to find where a region starts.

  • Keep in mind that logical statements like IF...THEN... can also be expanded or contracted but are not synchronized with the region they are within.



Surround With

As of V14 SP1, the ability to add logical statements, regions, and comments to existing code has been greatly streamlined with the addition of the “Surround with…” option.

Simply highlight a body of code, right-click it and choose what you would like to surround it with. This is especially helpful for quickly adding regions to code written previously to V14 or to quickly comment out chunks of code while debugging.

Hopefully, some of these tips will allow you to create more efficient PLC code and increase your development speed at the same time. 

If you are in need of DMC's expertise, check out our Siemens PLC Programming Services.


# MaKu
The else part in the SCL code is missing. bAnElementIs3 will become FALSE in Ladder if all array elements are FALSE.
In SCL bAnElementIs3 will stay TRUE if all array elements are FALSE again.
# Sipho
Mr David,

Sir please help me out, I need a Direct On Line (DOL) program in SCL, and Forward Reverse SCL program.
I will be very happy sir if can help out.

Thanks in advance
John Sullivan
# John Sullivan

There is no way to convert an compiled STL program into SCL. For a conversion I was able to reverse engineer some STL files into SCL, but it is a very difficult and intensive process.

If the OEM will not provide the original SCL, and it wasn't loaded onto the controller (which is rare) then you are unfortunately out of luck.
David Berno
# David Berno
Hi Luciano,

What version of TIA Portal are you using and what type of controller?
Luciano Vasconcelos
# Luciano Vasconcelos
Dear David, Do you know a way to revert a program made using SCL language back to it original form ? I have a source program, some file used SCL but the supplier delivered just the STL converted form. Now, I want to study the program, but a compiled SCL into STL is very difficult to understand.

Do you know a way to revert back to it SCL form ?

Post a comment

Name (required)

Email (required)

Enter the code shown above:


Related Blog Posts