Move data to a DB in different Int address??

HelloAll

Member
Join Date
Dec 2009
Location
bb
Posts
19
How can I do this??

If I receive a initial step figure 10 and end step figure 20 from a HMI,
how can I point these step into my DB200's step (100 steps in DB200)
I got 12 different items in each step, step one is from DB200.DBD0 TO DB200.DBW30

I also will get the Item No (1~12) from HMI, when operator enter 1 that means the first Item which will be at DB200.DBW0,DB200.DBW32...DB200.DBW3200
Item 2 is in DB200.DBW4, DB200.DBW36..... and so on
then the operator will enter the Initial step and end step, if the item is 1, from initial step 10 to end step 20, then the fillvalue will automatic put the value into DB address
Because the HMI input is a decimal value ( like 1~100), this won't automaticlly put the value into the DB address,
So Do I need to define the initial step and end step to point to the DB address
also the Item no (1~12)
it's something like this :
when item no = 2;
initial step =1
end step=10
move iFillValue into DB200.DBW4, DB200.DBW36....DB200.DBW324
if item no= 1;
move IrFillValue into DB200.DBW0, DB200.DBW32....DB200.DBW320
 
the below is the code from LD, but it for move real data to each DB200.DBD4, DB200.DBD36 and so on

now I wanna to move a value to DB200.DBW4, DB200.DBW36... how do I change the code below??

FUNCTION FC 3 : VOID
TITLE =
VERSION : 0.1


VAR_INPUT
rFillValue : REAL ;
iStartStep : INT ;
iEndStep : INT ;
iItemNo : INT ;
iBytesBetweenEntries : INT ;
dbDB : BLOCK_DB ;
END_VAR
VAR_TEMP
iDBNumber : INT ;
iLoopCount : INT ;
dwOffset : DWORD ;
END_VAR
BEGIN
NETWORK
TITLE =

L #iBytesBetweenEntries;
SLD 3;
T #dwOffset;

OPN #dbDB;
LAR1 P#DBX 0.0;
L #iStartStep;
+ -1;
L #dwOffset;
*D ;
+AR1 ;

L #iItemNo; //make item zero based
+ -1;
SLD 5;
+AR1 ;
L #iEndStep;
L #iStartStep;
-I ;
+ 1;
L: T #iLoopCount;
L #rFillValue;
T D [AR1,P#0.0];
L #dwOffset;
+AR1 ;
L #iLoopCount;
LOOP L;
SET ;
SAVE ;
END_FUNCTION
 
You say you want to become legend in stl programming, still, you dont even try to understant what those instructions do. Just find what instruction does from help, then comment what you think it does. I bet you will get lot more help. (oh and use code tags to wrap up the code)

example:

Code:
L   #iBytesBetweenEntries; //load integer passed by input variable iBy.. to accu1
SLD 3;                     //shift bits stored on accu1 left by three.
T   #dwOffset;             //transfer contents of accu1 to variable dwO..

and atleast i did not fully understant how you want the data moved?

now I wanna to move a value to DB200.DBW4, DB200.DBW36... how do I change the code below??

does this mean you want data in db200.dbw to be moved to db200.dbw36 ?
 
Last edited:

Similar Topics

there is another problem when I use the Function below: there are 100 step in the DB200 there are 12 items for each step: Step 1------------...
Replies
10
Views
4,419
RE:Another Q for Move data to different address(Siemens S7-300) Thank you again for this, However I wanna to ask about: If I receive a initial...
Replies
1
Views
2,581
Thank you About L D[AR2,P#0.0] I found it very useful, and how can I make the 100 step automatic put the input value into DB200 , if I choose 1 ~...
Replies
1
Views
1,846
Hello all, If I wanna move a value (20) to DB200.DBW10, DB200.DBW20.....DB200.DBW200 how can I make it happen by using a ladder or STL ...
Replies
2
Views
1,679
Afternoon, I have a DB in TIA Portal V16 that is optimised. I cannot change this. There is an array inside that block which consists of 3000...
Replies
9
Views
1,114
Back
Top Bottom