STL S7-400 (Text to STL)

Daynada

Member
Join Date
Nov 2005
Location
Wisconsin
Posts
28
Can someone write this code consisely for me in STL?

If ("x amount of time" after rising edge M1.0) and (M1.1 = 0) then (output M1.2)

If ("y amount of time" after falling edge M1.0) and (M1.1 = 1) then (output M1.3)

Thanks for the time saver,
 
Hmm, looking at your post history it does not entirely look like homework.
So, this should do it (untested).

Code:
function_block fb100

var
    OnDelay1, OnDelay2 : SFB 4;
    EdgeMem1, EdgeMem2 : BOOL;
end_var

BEGIN

l t#5s; //load x time
t OnDelay1.PT;

l t#4s; //load y time
t OnDelay2.PT;

a m1.0:
fp EdgeMem1;
s OnDelay1.IN;

call #OnDelay1;

a OnDelay1.Q;
an m1.1;
s m1.2;

a OnDelay1.Q;
r OnDelay1.IN;

a m1.0;
fn EdgeMem2;
s OnDelay2.IN;

call #OnDelay2;

a OnDelay2.Q;
a m1.1;
s m1.3;

a OnDelay2.Q;
r OnDelay2.IN;

end_function_block
 
Last edited:
Thanks for your help. Definitely not homework. I could do it in not-too-long. I would normally write it in ladder no problem, which I can do. But it was two fold... I'm not an expert in STL and I'm curious about different methods to the same problem. The way I would have wrote this would likely be different then you or whomever so I'm trying to feed off and learn from you folks. Thanks for your help and anyone else who may post.
 
Here's an alternative implementation:

Code:
FUNCTION_BLOCK FB 1
TITLE =
VERSION : 0.1
VAR
  Delay1 : SFB 3;    
  Edge1 : BOOL ;    
  Delay2 : SFB 3;    
  Edge2 : BOOL ;    
END_VAR
BEGIN
NETWORK
TITLE =
      CALL #Delay1 (
           IN                       := M      1.0,
           PT                       := T#5S);
      A     #Delay1.Q; 
      FN    #Edge1; 
      AN    M      1.1; 
      S     M      1.2; 

      AN    M      1.0; 
      =     #Delay2.IN; 
      CALL #Delay2 (
           PT                       := T#4S);

      A     #Delay2.Q; 
      FN    #Edge2; 
      A     M      1.1; 
      S     M      1.3; 
END_FUNCTION_BLOCK
 

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,108
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...
Replies
5
Views
2,717
Hello everbody out there. I have 2 topics actually I wanted to share and get your opinions about but since they are related I sum up in one...
Replies
14
Views
9,814
I want to convert program written in stl to ladder.Sometimes it is failing as the programmer do not write nop statement in code.İs there a...
Replies
3
Views
4,714
i am new to simatic manager and i am trying to figure what this part do in the code : A I 5.6 = DB50.DBX 4.6...
Replies
3
Views
128
Back
Top Bottom