JimZ82

STL

8 posts in this topic

Hi everyone.

Where can I learn how to write STL programs? My experience is not too extensive. Any help would be highly appreciated.

Share this post


Link to post
Share on other sites

Hi JimZ82,

for a list of STL commands you can have a look at the SIMATIC Statementlist (STL) function manual,
but this is rather a command reference and does not contain any further general descriptions

https://cache.industry.siemens.com/dl/files/814/109751814/att_933093/v1/STEP_7_-_Statement_List_for_S7-300_and_S7-400.pdf
 

i also can recommend the book 'Automating STEP7 in STL and SCL' from Hans Berger,
on amazon you can have a little preview of this book ('llok inside' link)

https://www.amazon.com/-/de/Automating-STEP-STL-SCL-Programmable/dp/3895784125/ref=sr_1_1?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=1RG6CYYFKJUS3&dchild=1&keywords=automating+with+step+7+in+stl+and+scl&qid=1595354421&sprefix=automating+with+%2Caps%2C236&sr=8-1

 

 

 

Share this post


Link to post
Share on other sites

Hi AndreasW

thank you for your help! I will check out the book. Take care!

Edited by JimZ82

Share this post


Link to post
Share on other sites
On 7/21/2020 at 0:28 PM, JimZ82 said:

Hi everyone.

Where can I learn how to write STL programs? My experience is not too extensive. Any help would be highly appreciated.

In Simatic Manager - write a small LAD program then click View and you can select STL to convert your LAD Program.

You can switch between LAD and STL to compare the formats.

Share this post


Link to post
Share on other sites

So, I wrote, and then deleted a little mini-rant about STL programming. This probably isn't the place for it...

I will say that not all code can be converted back and forth between LAD and STL. If you write code in LAD and convert it, you will end up with a number of NOP instructions scattered around. Sometimes, you can eliminate them and have it still convert back, other times not. Also, in my experience, code written in STL wasn't divided into networks correctly to be able to convert to LAD. To convert it, I would almost always have to divide each STL network into multiple networks before it would convert. I usually could get it to convert after that, but every now and then I'd encounter one that wouldn't go from STL to LAD. In my experience, LAD would always convert to STL, but not always the other way around.

2 people like this

Share this post


Link to post
Share on other sites

Joe, I've also run into these situations. In most of them the logic aggregated into a single rung is usually intentional. This is a poor man's way of keeping logic proprietary. As you have discovered, it can be read and sorted into individual networks which can then be much easier to read and troubleshoot. The NOPs are used as placeholders, which explains why sometimes deleting them works and sometimes not. And you are correct in your final assessment that converting LAD to STL always works but not always the other way around. The rule of thumb is that output instructions used within the same statement will usually convert readily to LAD. The logic below  will convert to LAD without any re-writing:

A     I0.0
A     I0.1
=     O5.0
=     O6.1

However, the logic below will not readily convert. to LAD The reason for this is that the two output instructions are not part of the same logic evaluation.

A     I0.0
=     O5.0

A     I0.1
=     O6.1

Why write aggregated logic in a single network? Most of the time it is because the programmer A.) has a European programming perspective/background/training or B.) they might be computer programmers rather than PLC programmers. Just my observations. I'm sure there could be other reasons as well. I've worked with both sides of the Atlantic and have come to appreciate the contribution of each side. Another major difference I've noticed is that US programmers writing in STL tend to favor the JP (jump positive) instruction whereas the Europeans tend to like the the JN (jump negative) instruction. It took me a long time to understand the difference. Now that I do, I also tend to favor the JN instruction. But that's a discussion for another day . . . .

Share this post


Link to post
Share on other sites
On 8/4/2020 at 7:44 AM, Joe E. said:

So, I wrote, and then deleted a little mini-rant about STL programming. This probably isn't the place for it...

I will say that not all code can be converted back and forth between LAD and STL. If you write code in LAD and convert it, you will end up with a number of NOP instructions scattered around. Sometimes, you can eliminate them and have it still convert back, other times not. Also, in my experience, code written in STL wasn't divided into networks correctly to be able to convert to LAD. To convert it, I would almost always have to divide each STL network into multiple networks before it would convert. I usually could get it to convert after that, but every now and then I'd encounter one that wouldn't go from STL to LAD. In my experience, LAD would always convert to STL, but not always the other way around.

Joe E., I would be ok with you starting a new topic to rant about STL programming.  Lol

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now