Siemens S7/400 STL to LAD

DaveH1966

Member
Join Date
Mar 2013
Location
Pa
Posts
4
I am having trouble converting the following STL to ladder. It seems basic enough, but I have not used STL very long. I have seen other conversions where people just change some Ands to Ors and add )'s here and there. With a conversion, could someone also explain how and when this is necessary?

O(
A "M 0334.0"
A "DB330.DBX14.4"
AN "DB329.DBX0.2"
AN "DB329.DBX4.3"
)
O "M 0334.1"
A "DB366.DBX4.3"
AN(
A "DB27.DBX3.6"
A "DB330.DBX0.1
)
= "Q53.6"
 
Code:
      A(    
      A     "M  0334.0"
      A     "DB330.DBX14.4"
      AN    "DB329.DBX0.2"
      AN    "DB329.DBX4.3"
      O     "M  0334.1"
      )     
      A     "DB366.DBX4.3"
      A(    
      A     "DB27.DBX3.6"
      A     "DB330.DBX0.1
      NOT   
      )     
      =     "Q53.6"
This allows you to convert to FBD



Code:
      A(    
      A     "M  0334.0"
      A     "DB330.DBX14.4"
      AN    "DB329.DBX0.2"
      AN    "DB329.DBX4.3"
      O     "M  0334.1"
      )     
      A     "DB366.DBX4.3"
      A(    
      ON    "DB27.DBX3.6"
      ON     "DB330.DBX0.1
      )     
      =     "Q53.6"
This is the equivalent LAD code.


AN( can't be translated into FBD or LAD.
You can add a NOT in FBD, but you need to rewrite it in LAD to fit the limitations.

Starting with O( is just bad practice and won't be translated.
I would strongly recommend you replace any and all networks starting O( with A(.
If the entire logic in that statement was contained in the O( ) bracket, the output would be set any time the previous network's RLO was true.
Very dangerous situation could ensue.

As for the conversion, I often just rewrite it in the needed language and then convert to STL to see the differences.
 
Last edited:
Jeebs - Thank you so much. I just could not get my head around how everything in that code plays out. STL is still very new to me, so I usually have to translate and think in terms of ladder logic. Thanks for the advise. All of our code was written by engineers in Switzerland, and they have their own way of doing things. Again, much appreciate the help.
 
Are sure that last part is OR ed?

AN(
A "DB27.DBX3.6"
A "DB330.DBX0.1
)
= "Q53.6"

A(
An "DB27.DBX3.6"
An "DB330.DBX0.1
)
= "Q53.6"


And the whole network:







A(
A M 334.0
A DB330.DBX 14.4
AN DB329.DBX 0.2
AN DB329.DBX 4.3
O
A DB366.DBX 4.3
A M 334.1
)
AN DB27.DBX 3.6
AN DB330.DBX 0.1
= Q 53.6
 
In the original example, when both are True, the RLO turns to 0.
If either one is false, the AN( will turn the RLO to 1.

In your example, both need to be false for the RLO to be 1.
If either one is false, while the other is true, the RLO will still be 0.
 
AN(
A "DB27.DBX3.6"
A "DB330.DBX0.1
)
= "Q53.6"

I suppose this is my question.
The above looks the same to me as


A "DB27.DBX3.6"
A "DB330.DBX0.1
NOT
= "Q53.6"

ah ok, nevermind. Both should be true for RLO=0

I read the original wrong in my first example.
 

Similar Topics

Hallo Can you help me with understanding of the code below: M001: NOP 0 L #PUNTATORE L 16 *D LAR1...
Replies
3
Views
2,111
Hi, Yesterday, I was at a customer site. I made one little change. Changed a dummy bool output to an actual output. I didn't add any tags, or...
Replies
15
Views
330
Hi everyone, I'm working on a project where I need to exchange data between a Siemens S7-1200 PLC and an Allen-Bradley MicroLogix 1400 PLC. The...
Replies
8
Views
653
Good Afternoon. I am having a problem going online with S7-400. Attached is the error that I am getting. I have looked at the help file but the...
Replies
7
Views
1,780
I can't replace cpu S400 416-3XR05-0AB0 BY 416-3ER05-0AB0 in PCS7 Project when using replace object to keep the original configuration in the...
Replies
4
Views
1,506
Back
Top Bottom