S5 Stl

This is only a guess. :)

:O DB30 // OPEN DATABLOCK 30
:LW 0,44 // LOAD WORD FROM OPENED DB STARTING FROM BYTE44 TO ACCU1
:L KY 0,25 // LOAD CONSTANT 25 INTO ACCU 2 (0000_0000_0001_1001)
:><F // COMPARISON ACCU1 DIFFERENT THAN ACCU2


I think I've seen somewhere that KY x,x is used to access two bytes separately. For example KY 3,10 = 0000_0011_0000_1010

Maybe someone who has experience with S5 can say if this is correct or not. (n)


TS
 
Tesalmin,

you're right and you're wrong, as we all are from time to time.

Here you're right:
KY x,x is used to access two bytes separately
The KY format is indeed used to load two separate bytes as one word, it's like using two L KB instructions in one go.

But here you're wrong:
:LW 0,44 // LOAD WORD FROM OPENED DB STARTING FROM BYTE44 TO ACCU1
:L KY 0,25 // LOAD CONSTANT 25 INTO ACCU 2 (0000_0000_0001_1001)
Since these two instructions both start with L, how can you tell which one is loaded in accu 1 and which one is loaded into accu 2? Fact is that the L-instruction always copies the addressed data to accu 1. The old content of accu 1 is at the same time copied into accu 2. The comparison instructions always compare accu 2 (the first loaded value) to accu 1 (the last loaded value). It works exactly the same with math instructions.

Now for the question by cck: I don't recognise all S5 instructions if they're in English because I always work with a German version, but I've never seen an instruction LW 0,44. I do know the instruction LW, but that instruction has to be followed by an equalsign and a parameter inside a function block (eg. LW =val0). Mayby someone more familiar with an English version of S5 can help you out.

Kind regards,
 
I think you are looking at it wrong.


C DB 30 // OPEN Data Block 30 (must open a DB before getiing data)
L KF+44 // Number of DBW to get data from
T DBW 0 // indirect data call
L DBW 0 // Grab the data from DBW44 (indirectly) put in ACCUM 1
L KY 0,25 // move accum 1 data to accum 2, load this in accum 1
><F // If they are NOT equal
JC M001 // Jump to some other logic in the segment
 
Thanks you all for helping me out, and after checking again in the stl list a realise i have make some mistake.

LW 0,44 is actaully
LW =VIDW

best regards
 

Similar Topics

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
135
Hello everyone, can anyone help me with covert the STL code to ladder. Iam using plc s71200. A %DB1.DBX33.7 // angel of vaccum...
Replies
2
Views
208
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
318
First off thank you in advance. Second I am very new to STL. I am trying to build a counter that has one count up and 23 count down options. Am...
Replies
6
Views
378
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
677
Back
Top Bottom