Siemens STL question

RickardEM

Member
Join Date
Feb 2018
Location
Gyttorp
Posts
2
I'm having trouble trying to convert this code to ladder, anyone able to help me?

A M4.0
A M4.1
A M117.0
AN M17.7
A (
A I38.6
AN I3.7
O (
A M4.5
FP M231.6
)
)
JNB M001
= M100.0
M001: NOP 0

\Rickard
 
FB is edge positive. NOP 0 is no operation.


If you delete FP and JNB command then step7 classic editor can convert it to ladder view without trigger.
 
I'm a little rusty, & hope I have the brackets shown right then the attached is what I think it is in ladder
The JNB is jump if RLO is 0 in other words jump if not true
as the RLO will be true on the rising pulse M100.0 will become true, however, as this is a pulse the next scan it will be false but as the JNB will jump over the M100.0 it will still be true.
So in effect it does appear that M100.0 once set will be true until something else resets it. I would check all instances of M100.0 as it could be reset elsewhere
So in reality putting M100.0 in place of the pulse function would not work perhaps "IF" M100.0 is reset elsewhere then you would use that pulse to SET M100.0
Note: as this is not Siemens I had to use a jump with a not M231.6

STL_LAD.png
 
Not that I have ever done this before, but as far as I can tell, the following STL and LAD logic execute identically from TIA and a PLCSIM S7-300.

Note that, in the STL,

  • the line 9 A B14_5 RLO is 1, and
  • the line 10 FP Edge_Memory_stl memory bit %M231.6 is 1
even though all of the RLOs up to that point are 0.
Untitled.png
 
Ooh, nice catch; in TIA it's the -|P|- instruction.
Untitled.png
Interesting that the input RLO to the -|P|- does not affect the one-shot calculation based on the operand; that could be quite the gotcha if it was not known that it worked that way. I am pretty sure that means this will also work:
Untitled2.png
although it is not as clean.
 
Thank you for all your answers. It makes a lot more sense now.
I was modifying the code a bit, didn't think it would matter but I realize now that it will. Sorry.

The code calls an FC instead of setting a coil.
A M4.0
A M4.1
A M117.0
AN M17.7
A (
A I38.6
AN I3.7
O (
A M4.5
FP M231.6
)
)
JNB M001
CALL FC30
POS:=111
DEST:=112
ID:=1
ID_TYPE:=1
SYSTEM:=100
M001: NOP 0

\Rickard
 

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
I have an FB that had about 30 rungs of LAD code. I switched views (ctrl+2) to add some additional networks and create some STL code. Now, when...
Replies
6
Views
3,523
program : L #measurement + -1 SLD 4 LAR1 AUF "DB72" L DBW [ar1,P#4.0] question1 : measurment =5 5-1=4 0000 0000 0000 1000 SLD 4 gives 0000 0000...
Replies
3
Views
14,371
Hi Siemens Experts, I am hoping someone can shed some light on my issue. I have uploaded the code from a S7-300 (317-2PN/DP) using Step 7...
Replies
9
Views
680
Hello, I am still new to STL. But from what I understand is the JC mnemonic should jump if RLO = 1. If we review both pictures the M0bf RLO = 1...
Replies
5
Views
1,055
Back
Top Bottom