LAD SCL STL language restrictions

Gosten

Member
Join Date
Apr 2019
Location
Poland
Posts
5
Hello,

I'm working on my master thesis on university. Main goal of it is to compare PLC programming languages in Siemens (LAD, FBD, SCL, STL) under different conditions, like: program simplicity, speed, load of memory etc.

I wonder, are there any situations like: You can implement a solution to a problem in one language, but You cannot do it in another language?

Would be great if You would share with me some examples You know about :)

Thank You!
 
Yes, there are.


Indirect addressing would be the prime example.
 
Hello.


In Siemens for the CPU which work with the software STEP 7 (not TIA PORTAL), there were several limitations to ladder.


The base language was STL.By exemple, you could write all your code in ladder, and then convert it into STL. The contrary was not true.


You could use "indirect adressing" in STL, which was extremely useful, with the use of address pointer.


It was necessary because there was no way to address an array with a tag in ladder nor in STL. It was only possible in SCL, which came later and is a completely different system.


Also, in STL, you could compare Bytes, wich was not possible in ladder, it would end in a error type. You could also only operate and manipulate the CPU accumulators with STL and clear the registers. It was quite a low level language , closer to the CPU.
 
Last edited:
Not sure if this applies to Siemens but many PLC's have instructions that are not available in every language. So an instruction in Ladder may not have an equivalent in Function Block or vise versa. Not to say you cant find a work around but it is not an exact 1:1 conversion.
 
Back in the day... when I worked on S5's they were all wrote in STL and there were some parts of the program that could not be converted to LAD and there were also some S5 that was imbedded in the AMK drives that would not convert but most of the AMK logic was wrote in ladder

I think it was math but im not positive, glad they wrote the programs good and I did not need to get into them very often

You should also include Statement List
 
Thank You for Your answers!

So an instruction in Ladder may not have an equivalent in Function Block or vise versa. Not to say you cant find a work around but it is not an exact 1:1 conversion.
Do You have specific examples? I'm aware of this situation, but for now can't find anything.

You should also include Statement List
What do You mean?
 
In SCL you can use loops to run through arrays or structures and make changes or just analyze contents quite fast.


The other week there was actually a thread about someone trying to replicate this functionality in STL.
 
Do You have specific examples? I'm aware of this situation, but for now can't find anything.


An exemple of indirect adressing, you couldn't do it in ladder






AUF #NumDB

L #Position
L 4
*D
T #PosDB

L #PosDB
SLD 3
T #Pointeur

L #Pointeur
L P#0.0
+D
T #Pointeur

L #Effort
T DBD [#Pointeur]





The pointeur is a variable that contain an address.
 
Last edited:
Hello,

In TIA Portal and with S7-1200 and S7-1500 all languages are equivalent. You can achieve the same functionality with any language.
 
Hello,

In TIA Portal and with S7-1200 and S7-1500 all languages are equivalent. You can achieve the same functionality with any language.




STL doesn't exist in S7-1200 (nor S7-GRAPH). But it's true than in S7-1500, SCL and ladder are not translated to STL anymore (unlike S7-300/400). The improvement of these languages have been the main feature of TIA Portal, much better than the totally integrated joke.
 
Do You have specific examples? I'm aware of this situation, but for now can't find anything.


The one shot instruction (FP or FN in STL) doesn't exist in SCL. You have to write the equivalent SCL code for it.



Also, just because you can convert from Ladder to STL, doesn't mean you will understand what it is doing.



Each language has strenghts and weaknesses. You can solve plenty of problems in all, but in some languages it is simple to build or visualise the logic whilst in others it is dreadful. Case in point, boolean conditions are painful in STL, but a breeze in Ladder.
 
Indirect addressing can be done in LAD, for example here's part of a block that controls a Q bit whose byte and bit number are passed to a function. The address pointer is generated and used in SFC20 to read the Q byte to a temporary array of bits, some comparison logic will S/R the selected bit and then SFC20 is used to write the temp array of bits back to the Q byte. All done in LAD. Clearly this can be extended for I,M,DBX etc.

aq.jpg
 
I Siemens current PLC languages in the TIA Portal, you can do almost everything in any of the programming languages, STL, LAD, FBD and SCL.
There are a few esoteric differences, but they mostly dont matter.
Indirect addressing is as easy in LAD and FBD as it is in SCL.

The difference between LAD and FBD vs. SCL is mainly that certain looping and selection statements are more native and easier to code in SCL.
FOR-NEXT, and CASE OF for example. Still possible in LAD and FBD, but it is just easier and more readable in SCL.

The other way around, pure logic is easier to code and understand in LAD and FBD than it is in SCL. Particularly checking the logic status online when it is rapidly changing is much easier in LAD and FBD than in SCL.

As for STL, with the improvements to LAD and FBD in particular, I think this language should die. You can do everything in STL, but it is much harder to read. And it is much easier to make mistakes. Siemens has included STL in the latest software only for backwards compatibility with older software.

As for Siemens older programming software STEP7 V5 (aka "STEP7 Classic") you should ignore it, except for referring to it as legacy software which do not have the same features as the current software.
 
JesperMP I couldn't agree more.

From V14 onwards you can program a block with both LAD and SCL networks at the same time. I think it is very powerful as you can use LAD for logic and SCL for more complex coding.

I think that STL is in the S7-1500 only for compatibility with older controllers.
It should also be noted that STL in S7-1500 is a lot simpler than in the older PLCs.

When I get the question which programming language is the best, my reply is: The best is the one that will do the job in simplest way.

Screen Shot 2019-04-10 at 12.14.32 PM.png
 

Similar Topics

Hi, Is it possible to convert Graph program to STL or something like this which is modifiable by programmer.
Replies
7
Views
5,051
As soon as an FC block (written by me in an SCL source file, inserted in a LAD project) gets signal, the program stops. If it's in a network, but...
Replies
2
Views
1,348
Hi guys, I wonder if I can have some input on this query please. I am trying to translate code from LAD to SCL, ultimately to reduce the scan...
Replies
13
Views
5,739
Hi.Can I convert the block written in stl mode below to ladder mode? L #InOctet SLD 3 L #InBit OW T...
Replies
2
Views
552
Hi, does anyone have experience with the Off Delay Long Timer function in GX works 3, I need a PV greater than T#2147483ms If I use Long Timer...
Replies
7
Views
1,222
Back
Top Bottom