STL_Interpret

mahashempour

Member
Join Date
Sep 2012
Location
fars
Posts
4
Hi, All.
Could you please explain what is gonna happen in following STL Programming?
A #FEHLER
R #FEHLER
L #Adresse
T #TEMP_PW_ADR
L 256
<I
JC FEHL
A L 1.0
JC FEHL
-I
SRW 1
L #Anzahl
+I
L 128
>I
JC FEHL
JU OK
FEHL: AN #FEHLER
S #FEHLER
BEU
OK: NOP 0

Picture_4-20MA.jpg
 
I can give a statement-by-statement description. Whenever you see a LOAD statement (L), the loaded value goes into ACCU1, and the existing contents of ACCU1 move to ACCU2.

A #FEHLER - AND parameter #FEHLER (normally open contact)
R #FEHLER - RESET parameter #FEHLER (if above bit is ON, reset #FEHLER)
L #Adresse - LOAD parameter #Adresse into ACCU1
T #TEMP_PW_ADR - TRANSFER ACCU1 to parameter #TEMP_PW_ADR
L 256 - LOAD +256 into ACCU1
<I - TRUE if ACCU2 > ACCU1 (#Adresse > 256)
JC FEHL - JUMP to FEHL label if above is true
A L 1.0 AND bit L 1.0 (local bit address - look in block interface TEMP variables for where the bit is located)
JC FEHL - JUMP to FEHL label if above is true
-I - Integer SUBTRACT (ACCU2 - ACCU1 - store result in ACCU1)
SRW 1 - shift ACCU1 to the right 1 bit
L #Anzahl - LOAD parameter #Anzahl
+I - Integer ADD (ACCU2 + ACCU1 - store result in ACCU1)
L 128 - LOAD +128
>I - TRUE if ACCU2 > ACCU1 ((#Adresse - 256)/2) + #Anzahal > 128)
JC FEHL - JUMP to FEHL label if above is true
JU OK - unconditionally jump to OK
FEHL: AN #FEHLER - Label here is FEHL, AND NOT #FEHLER
S #FEHLER - SET #FEHLER bit if above is true
BEU - END THE BLOCK UNCONDITIONALLY
OK: NOP 0 - Label here is OK, NO OPERATION
 
If Google Translate is to be believed...
"Fehl"(German) --> "Fail"(English)
"Fehler"(German) --> "Error"(English)
"Anzahl"(German) --> "Number"(English)

First glance looks like some error-checking logic, maybe an overflow/underflow check on an address?

Checking #Adresse>256 makes me think looking for a number that can't fit in an 8-bit variable, and tosses an error if it doesn't.

If it passes that, grabs some other variables and does some math/bit shifts to that #Adresse. The second check makes me think that it's looking for a set Bit 8 of that new 8-bit variable. Again, tosses an error if not.

If an error pops up anywhere, jump to the "Fail" label and set the "Error" bit if it's not set already.


I could be out in left field though...haven't had enough coffee this morning.


Pi
 
The block is for analog input handling, and it would be more helpful to post the whole block. It could be specialised for the analog handling of the machine it originally came from.

How did you aquire this program?
 
Great, you have put down the most details. Many, many thank.
Actually i'm getting into programming by reading programs and this was belong to an air Compressor.
 

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
144
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
219
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
350
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
390
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
702
Back
Top Bottom