siemens stl code cleaner way?

Tommycai

Member
Join Date
Aug 2011
Location
KY
Posts
120
Hello I am incrementing db8.dbw0 by one in another fb and comparing it to acc1 whenever m199.7 is set would there be cleaner way to do this. I'm incrementing acc1 and comparing it and then jumping if RL0 = 1 to assign it something else.


A "M 199.7"

// loads db value into acc1
L db8.dbw0

//loads 0 into acc1 shifts acc1 to acc2
L 0

// the the two are equal rlo =1
==I

// if rlo = 1 jump to one
JC one

//increment acc1 by one and do comparison of db again
INC 1
==I
JC two

INC 1
==I
JC thre

INC 1
==I
JC for

INC 1
==I
JC fiv

INC 1
==I
JC six

INC 1
==I
JC sevn

INC 1
==I
JC eght

INC 1
==I
JC nine
 
so the code being like this should do the same?

JL db8.dbw0
JU one
JU two
JU thre
etc.
 
Last edited:
the assign something else is also an hmi input. Once one input is complete then it triggers m199.7 that loads the next db.dbw#
 

Similar Topics

IS it possible to write this on a better way: L #db_Num2 L 121 ==I JNB _02 CALL "CONT_C" , "DB_reg_igla1"...
Replies
3
Views
2,628
so the code I am trying to do loads two different values and then I try and tell if the value subtracted from the other value is less than 15 and...
Replies
11
Views
4,298
I have just started out coding in STL and i have been given this piece of code to decipher L DIW [AR2,P#8.0] //LOAD DEST DB#...
Replies
9
Views
15,600
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
674
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...
Replies
8
Views
1,207
Back
Top Bottom