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

Eric.shen

Member
Join Date
Dec 2009
Location
asa
Posts
4
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 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

Code
___________________________________________
FUNCTION FC 2 : VOID
TITLE =
VERSION : 0.1

VAR_INPUT
rFillValue : REAL ;
pStartPoint : POINTER ;
iBytesBetweenEntries : INT ;
iNoOfEntries : INT ;
END_VAR
VAR_TEMP
iDBNumber : INT ;
iLoopCount : INT ;
dwOffset : DWORD ;
END_VAR
BEGIN
NETWORK
TITLE =
L #iBytesBetweenEntries;
SLD 3;
T #dwOffset;
L P##pStartPoint;
LAR1 ;
L W [AR1,P#0.0];
T #iDBNumber;
OPN DB [#iDBNumber];
L D [AR1,P#2.0];
LAR1 ;
L #iNoOfEntries;
L: T #iLoopCount;
L #rFillValue;
T D [AR1,P#0.0];
L #dwOffset;
+AR1 ;
L #iLoopCount;
LOOP L;
SET ;
SAVE ;
END_FUNCTION

BEST REGARDS,
ERIC
 
..
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
 

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,822
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,420
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,847
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,551
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,379
Back
Top Bottom