STL to LAD - Is it possible?

Cryogen

Member
Join Date
Oct 2005
Location
NH
Posts
151
If OB1 is created in STL, can it be converted to LAD at a later time?

I know in S7-200's Step 7 Microwin it is possible..
 
Yes provided you write the STL just like the ladder editor does. To see the implications of this I suggest you write some code in ladder, including some block calls, and then view the STL produced.
 
If you have code in OB1 that you need to see in ladder, then its badly written code.

OB1 should really be restriced to distribution only, not good to fill it with logic.

I've heard of some 'uneducated' people writing (or attempting to) the entire code in OB1..o_O
 
PeterW said:
If you have code in OB1 that you need to see in ladder, then its badly written code.

OB1 should really be restriced to distribution only, not good to fill it with logic.

I've heard of some 'uneducated' people writing (or attempting to) the entire code in OB1..o_O

Harsh... and only your opinion.
 
rdrast said:
Harsh... and only your opinion.


Which part? :)


If you have code in OB1 that you need to see in ladder, then its badly written code. I would say not.

OB1 should really be restriced to distribution only, not good to fill it with logic. maybe a point to argue here, but I feel I'm right.

I've heard of some 'uneducated' people writing (or attempting to) the entire code in OB1.. Absolutely 100% correct here.


This could be a good discussion point along the lines of good programming techniques. Come on S7 guys a bit of support :D
 
I’m not an expert, but I agree with Peter (as always) what type of structure will the program have if you place all the code in OB1? If the project is so small that you can actually do all the coding in the OB, why use a 300 range plc?



I would hate to be the tech trouble shooting that mess.
 
An alternative opinion:

If you have code in OB1 that you cannot see in ladder, then its badly written code. As OB1 is the starting point, using ladder will give any prospective user a greater chance of understanding what is going on. If it's in ladder and your familiar with Step 7, then Ladder or STL will be ok. If you're not familiar (everyone has to start somewhere), Ladder will be better than STL. Of course as you drill down deeper and start looking at functions and the like, the dividing line will shift.

My OB1 is full of my machine mode control blocks, these blocks are fed with digital i/o. I could take it all out, put it in a function and call it from OB1 but it's been like that for ever (including previous Step 5 systems) and I'm sure my testing and commissioning colleagues would not appreciate the change (Hey where's the stuff usually done in OB1 gone ?) Note I work for an OEM and the machines we produce do pretty much the same thing all the time so I don't produce code that has to control lots of different types of equipment.

All the code in OB1 ? - unusual I would agree but it would be the fastest code. If it's working and you haven't got to touch it again who cares ?
 
SimonGoldsworthy said:
An alternative opinion:

If you have code in OB1 that you cannot see in ladder, then its badly written code. As OB1 is the starting point, using ladder will give any prospective user a greater chance of understanding what is going on. If it's in ladder and your familiar with Step 7, then Ladder or STL will be ok. If you're not familiar (everyone has to start somewhere), Ladder will be better than STL. Of course as you drill down deeper and start looking at functions and the like, the dividing line will shift.

When I write code OB1 it usually just calls to other blocks, this is in STL not ladder and it cannot be converted, due to the way it is written.

These blocks would be called something along the lines of 'input conditioning', communication handling', 'alarm handling', 'equipment control', etc.

Once these blocks are opened, these again would normally be just calls to other blocks, where the code actually starts. For example 'input conditioning' could have things like 'proximity conditioning', PEC conditioning', 'analog conditioning' (which again could be split down inside'.

The 'equipment control' would be split into sections of the machine/plant.

This way, someone who does not know the code can quickly manouvre themselves through the code to the section of code that they need, its not hidden in a mass of other code.

SimonGoldsworthy said:
My OB1 is full of my machine mode control blocks, these blocks are fed with digital i/o. I could take it all out, put it in a function and call it from OB1 but it's been like that for ever (including previous Step 5 systems) and I'm sure my testing and commissioning colleagues would not appreciate the change (Hey where's the stuff usually done in OB1 gone ?) Note I work for an OEM and the machines we produce do pretty much the same thing all the time so I don't produce code that has to control lots of different types of equipment.

As I said, the second point could be argued, depending on application. I prefer not to have specifics in OB1, just logical distribution to where the specifics are done.

SimonGoldsworthy said:
All the code in OB1 ? - unusual I would agree but it would be the fastest code. If it's working and you haven't got to touch it again who cares ?

Why would it be the fastest? The only time I've seen this (or close to, more than a 100 networks in OB1), it was written by a Siemens newby, used to there being one program file and programmed accordingly. (Can't blame someone doing as he knows).

One of the advantages of Siemens is the block structure, where you break your code down into smaller logical elements, which makes it easier to find the areas of the code you are looking for.
 
My suggestion would be to call one block per network (will display as ladder) rather than having one network with lots of calls in it (will not display in ladder). If there are no parameters involved then the overhead for ladder is one NOP per network. Using the one call per network gives the added benefit of seeing the network comment if you hover over the relevant entry in the "Go To Location" form.

OB1 fastest ? - the fewer calls there are, the quicker it will execute.
 
Again, it depends what you put into OB1, what I was saying is that there should not be much in the way of logic, therefore needing to see ladder is inconsequential.

The way I program, this OB1:

ladder_ob1.JPG


offers nothing extra in ladder to this OB1:

stl_ob1.JPG


except you have to scroll to see it all.


and:

OB1 fastest ? - the fewer calls there are, the quicker it will execute.

depends how much you have to repeat and code and how you write the code to avoid calling sub routines etc. As someone said if your writing your whole code in OB1, then a 300 or 400 PLC is the wrong PLC.

Not serious are you?
 
Excellent example in the previous post for ladder/stl comparison. I don't mind either way - some other opinions would be useful here (particularly anyone not familiar with Step 7).

OB1 - I wouldn't put all the code in there myself, but as you have said, it has been done.
 
Well I never....

As a long term Simatic programmer (17+ yrs), my immediate first reaction was to unreservedly agree with Peter, that OB1 is primarily used for 'distribution' and placing reams of code in there is a bit 'noob'.

However, this is a page from the current S7 'Programming 1' course notes and although 'linear programming' is not advocated in the course, it's definitely acknowleged....
 
I pretty much approach OB1 as Peter does in his second example. I rarely put any boolean logic in it anyway, so it will just be a single network with a bunch of function calls in a list. If someone can't figure that out, they shouldn't be fooling around with the PLC in the first place.


As for putting the entire program in OB1, sure, it's "legal", but not partiularly good practice. It's sort of like writing a C program in one large function.
 

Similar Topics

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
554
i hope you could help me to convert the network Stl to lad it's apart from program of machine and i try to find solution for the reason of error...
Replies
10
Views
1,917
Hi, Im about to edit a SCL program from a FB but this error appeared "The Maximum number of lines that can be processed was exceeded". I can't do...
Replies
4
Views
1,975
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)...
Replies
30
Views
12,073
We have an issue with the trigger of a scanner (M21.3). Problem is, I need to convert the code first into a LAD kidna thing because it is too...
Replies
5
Views
1,681
Back
Top Bottom