"Translate" Simens STL?

SST

Member
Join Date
Aug 2017
Location
Denmark
Posts
14
Hi folks,


I'm working on a glass jar packing machine and trying to figure out how this STL code works. Most of the code is in ladder or FBD. But of course some of the code I'll have to alter is in STL.

Having stared at it for a while, has not really helped my understanding of it.


What I surmise is

"MP_Freig_GR_Aus" OR NOT "Anlagen".Pa.Anz.Auto OR "Anlagen".Pa.Anz.Auto_stoppt OR (#L_Imp_Freig_Prod AND Freig_Prod") must evaluate true to load 1.0


But where does the loaded value go? Normally into a tag, right?
What about the code below that, is that run as a separate part or part of the same code?

Must admit I have very little experience with STL, and even tough I do a little C++ for microprocessors and did some PHP back in the day. STL does not make much sense to me.


Thanks in advance for any help you could provide.

DVacYWp.png
 
I'm guessing this is Possibly S7, I suggest you take a spare copy of the file, open up this block and insert BLD 255 after the = or S (Set) on each line and providing the bracketing is correct it will translate into ladder (This was common on S5) especially in FB's but in S5 FB's could not be translated into ladder I believe.
It's been some time since I used S5/S7.
BLD instructions are to do with how the code is displayed and has no impact on the Result of logical operation Even the S7 manual does not explain most of the BLD instructions I only know that BLD 255 is segment end. so inserting a BLD 255 after an = or S(SET) or R(Reset) will split them into segments that will display them in ladder.
You are right in a way, if the logic in that first part is true then it = the local variable L 1.0. so L 1.0 will be true. If that makes sense.
 
Please re-post the code (in absolute address form) as text rather than a bit map: e.g. as below. We can then copy paste the code rather than having to copy the text from your bit map.





Code:
      A(    
      O     M   2201.1
      ON    DB910.DBX    8.3
      O     DB910.DBX    8.5
      O     
      A     #L_Imp_Frieg_Prod
      A     M   2101.0
      )     
      A(    
      A     #L_Imp_Frieg_Prod
      A     M   2110.3
      AN    M   2101.0
      O     M   2201.0
      O     M   2200.0
      )     
      S     #L_Freig_Prod
 
Just realised that putting BLD 255 in S7 does not work as to convert into separate segments doh…
If your more comfortable in ladder then create a new project, new FB or what ever then copy just the code up to the = or S then paste it into the segment of new block, change it to LAD & it will show you the logic in ladder.

STL.png Lad.png
 
@parky: Yeah you are right. It's Siemens S7.
I haven't tried to convert it; because in my previous experience it almost never works.

Maybe because STL if often used for a bit more advanced code.

@L D[AR2,P#0.0]: Oh yeah, of course.

Code:
      O     "MP_Freig_Gr_Aus"
      ON    "Anlagen".Pa.Anz.Auto
      O     "Anlagen".Pa.Anz.Auto_Stoppt
      O     
      A     #L_Imp_Freig_Prod
      A     "Freig_Prod"
      =     L      1.0
      A(    
      A     #L_Imp_Freig_Prod
      A     "Freig_Pa"
      AN    "Freig_Prod"
      O     "MP_Freig_Gr_Ein"
      O     "MP_T_Auto"
      )     
      S     #L_Freig_Prod
      A     L      1.0
      R     #L_Freig_Prod
      A     #L_Freig_Prod
      =     L      1.1
      A     L      1.1
      BLD   102
      =     "Freig_Prod"
      A     L      1.1
      BLD   102
      R     "MP_Freig_Gr_Ein"
      AN    L      1.1
      R     "MP_Freig_Gr_Aus"
      A     L      1.1
      BLD   102
      =     "LM_Freig_Rueck"
      A     L      1.0
      BLD   102
      R     "MP_Freig_Gr_Ein"
 
Last edited:
Do the following:

1. Archive your project (In Simatic Manager, File -> Archive
2. Open your block with the above code in it
3. Change the view of your block to STL (View -> STL)
4. Divide your Network 27 according to the attached picture into new networks
5. Change the view to LAD (View -> LAD)
6. Your code should appear in LAD... if not, try removing the BLD 102 instructions.

STL_LAD.png
 
Last edited:
Interesting, In S5 (only in program blocks) if written in STL as one long segment just inserting BLD 255 (***) would split it into segments, it appears in S7 the instruction is still valid but will not translate it into the separate segments. I have never used BLD 1-254 and can find no reference apart from it is not a code operation only display. There were a few almost undocumented instructions in S5 for example loading a hex value (S5 MC5 code) into the accumulator & using that DO the instruction. Very dangerous but very powerful. For example, you could change the type of instruction depending on the hex code in the variable. In other words, self changing code. I have seen this done by an ex Siemens engineer, I did an experiment many years ago and it went well, but never used it in a real world situation to me it was a step to far.
 
Not quite sure why they have 256 of them, I know in S5 that 255 was segment end and displayed as *** I do not see why the programmer has used 102, seems no point. after all A xxx = yyy will work the same as Axxx BLD 102 = yyy. as it has no effect on the RLO. The only time I have seen NOP0 or equivalent is relative jumps rather than labels, this enables the programmer to add extra code without having to change the jump addresses.
I know relative jumps were used rather than labels to jump segments (the only way in S5).
 
"The address <number> specifies the BLD instruction and is generated by the programming device."

What ever STEP 7 version, or editor, created that BLD #, and I guess we'll never know what the original programmer precisely used to create this block.
 
Yeh, possibly, I know there were versions that were not Siemens, especially S5 One company I think in Birmingham supplied S5 for windows, It was actually better than the Siemens Step 5 which was a CPM program running in an emulator. so was actually running in CPM.
Maybe the code here was used to confuse people, came across a program in S5 where a timer was passed to a function, this was decimal values such as 257, This confused me a bit as there was only timers up to 255, but realised that when a timer was indirectly called, it only loaded the lower byte for timers so 257 actually pointed to timer 1.

DO = Timer process the value passed to function (257) 16 bit operation
L T0 Load the timer pointed to i.e. 257 that = 1 only 8 bit operation
 
Maybe the code here was used to confuse people, came across a program in S5 where a timer was passed to a function, this was decimal values such as 257, This confused me a bit as there was only timers up to 255, but realised that when a timer was indirectly called, it only loaded the lower byte for timers so 257 actually pointed to timer 1.

DO = Timer process the value passed to function (257) 16 bit operation
L T0 Load the timer pointed to i.e. 257 that = 1 only 8 bit operation




rofl
 
Create a new FC in FBD. Change the view to STL. Copy your network 27 into the new FC. Change the view to FBD where it will display correctly (see below). Change view to FBD in the original block and delete your problem network 27, copy/paste the network from the newly created FC back to where network 27 was.

sst1.jpg
 
That's interesting. I have done many conversions in S5 that was programmed using a hand held programmer where no segment ends have been populated i.e. put BLD 255 so when read from a PLC using a PG It translates into ladder, or if someone has just written long segments in STL but although I program mainly in FBD or STL I have never looked at FBD in STL. I knew that BLD was not code but did not realise it was graphical translation for FBD. So I wonder what the other 254 do.....
Oh well, I know Siemens have some instructions not generally published and indeed, their own S5 Function blocks you cannot open (unless you know the secret like me).
 

Similar Topics

I need to Translate a Siemens S7 project into Delta PLC. I am responsible for Electrical so I will not care about software. Delta does have PLCs...
Replies
0
Views
1,171
Can some one transfer this to ladder logic please L #InR T #PuntoX L #Punto2 L #Punto1 -R T...
Replies
3
Views
1,962
Helo guys, New to siemens and STL . Can some one translate this ladder logic. In simatic manager when I change language it doesnt work. A...
Replies
5
Views
2,254
Hello Everyone! I just became a member of this great site. I have a PLC program from an S5-100U PLC, and now I want to make a PDF report of all...
Replies
3
Views
1,563
I only have done LAD diagrams so far and now I got a task to convert these 4 LAD diagrams to FBD and STL. Can anyone help me with that? Thanks!
Replies
16
Views
8,276
Back
Top Bottom