***RE:Another Q for Move data to different address(Siemens S7-300)

HelloAll

Member
Join Date
Dec 2009
Location
bb
Posts
19
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------------

Item 1 is a DB200.DBD0
Item 2 is a DB200.DBD4
Item 3 is a DB200.DBD8
Item 4 is a DB200.DBD12
Item 5 is a DB200.DBD16
Item 6 is a DB200.DBW20
Item 7 is a DB200.DBW22
Item 8 is a DB200.DBW24
Item 9 is a DB200.DBW26
Item 10 is a DB200.DBW28
Item 11 is a DB200.DBW30
Item 12 is a DB200.DBW32

When I use the Function (which is below) , it's fine from Item 1 to Item 5
however, when I put the item 6 into the "item no"and enter a value (20) into the "rFillValue",

Item no = 6
rFillValue = 20
the DB200.DBW20 should become 20,

however the value ( 20 ) went into Item 7 (DB200.DBW22 become 20 )

So what can I need to fix the code below ??

Thank you~~~







----------------------------------------------------------------------
However I wanna to ask about:
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.DBD0,DB200.DBD32...DB200.DBD3200
Item 2 is in DB200.DBD4, DB200.DBD36..... 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 rFillValue into DB200.DBD4, DB200.DBD36....DB200.DBD324
if item no= 1;
move rFillValue into DBD200.DBD0, DB200.DBD32....DB200.320
....

how can I do the Above code


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
 
nice tim, i missed that! there is the proble, if code does not adpt from DoubleWord to Word, when item changes. It will not work as intended.
 
Last edited:
Item 1 is a DB200.DBD0
Item 2 is a DB200.DBD4
Item 3 is a DB200.DBD8
Item 4 is a DB200.DBD12
Item 5 is a DB200.DBD16
Item 6 is a DB200.DBW20
Item 7 is a DB200.DBW22
Item 8 is a DB200.DBW24
Item 9 is a DB200.DBW26
Item 10 is a DB200.DBW28
Item 11 is a DB200.DBW30
Item 12 is a DB200.DBW32

Between items 5 and 6 you switch from double word to word addresses. Did you mean to do that? If its putting 4 bytes into DB200.DBW20 you would see some fo the data in DB200.DBW22.
 
Sorry it's my Fault,
There is not a problem, when enter the 6 into Item no
The problem is when enter 7, the value will go to Item 8
 
Dear TurpoUrpo,
You are right ~~
Sorry it's my Fault,
There is not a problem, when enter the 6 into Item no
The problem is when enter 7, the value will go to Item 8
 
To quote 3
when I wanna use the function for item 6~12, I will change rFillValue to iFillValue : INT
L #rFillValue; change to iFillValue
T D [AR1,P#0.0]; change to T W [AR1,P#0.0]

Then I will use the Function for the item 6~12, however when I enter 7 into iItemNO
, 20 into iFillValue

The value 20 should put into the Item 7 (DB200.DBW22), but the value 20 went into
Item 8 (DB200.DBW24)
So how can I fix the code ???

I think I might need two function , one for D word one for word, do you reckon ??

Thanks,
 
Dear L D

Thank you for the reply, I will try to do the functions~~
Or you already have the solution, then please post on ~~
I will very appreciate ~~

Thanks~~
 

Similar Topics

Hello, I am trying to move a data DB2.DB Type String [10] to another DB1.DB Data Type String [10] in LAD or STL. Have anybody done this? Move/...
Replies
1
Views
1,817
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
Good Morning , I appreciate your help on a previous post.Your advice helped me understand more. My next question involves the same project...
Replies
8
Views
3,544
Good Morning , I am still trying to understand motion . I have a Kinetix 6000 system with about 14 Axis . This machine has a pusher that...
Replies
2
Views
2,374
Back
Top Bottom