Blkmov - Indirect

leflek

Member
Join Date
Jul 2008
Location
Thessaloniki
Posts
3
Hello,

I have created the following code in step7

OPN "L1_Stage"
L P#810.0
T #Temp1
L 405
Stag: T #Count1
L #Temp1
L P#2.0
-D
T #Temp2
L DBW [#Temp2]
T DBW [#Temp1]
L #Temp2
T #Temp1
L #Count1
LOOP Stag

With this code i transfer all values in datablock "L1_Stage"
one position down and later in my program i put a new value in
the first position of this datablock. The datablock "L1_Stage"
contains int values.

I want to do the same thing with the following data block

Address Name Type
+0.0 C1 STRING[20]
+22.0 C2 STRING[20]
+44.0 C3 STRING[20]
+66.0 C4 STRING[20]
+88.0 C5 STRING[20]
+110.0 C6 STRING[20]
+132.0 C7 STRING[20]
+154.0 C8 STRING[20]
+176.0 C9 STRING[20]
+198.0 C10 STRING[20]

I have used the BLKMOV function because i can not use load
transfer instruction with data type string and it works

CALL "BLKMOV"
SRCBLK :="L1_ProfilCode".C1
RET_VAL:=#ret
DSTBLK :="L1_ProfilCode".C2

My question is how can i can use indirect addressing with the
funtion BLKMOV, so that i can use a loop to transfer all values of my datablock one position down.

Thanks

Lefteris
 
Hi
Well you can use the format of parameter type ANY, I think.
Just type ANY in help of S7 and the appropriate link will come up.
Code is also there under the heading "Using the Parameter Type ANY".
Something like this
Code:
   L     P#DBX 198.0
      T     #temp1
      L     10
stag: T     #count1
      L     #temp1
      L     P#22.0
      -D    
      T     #temp2


      LAR1  P##Source

      L     B#16#10
      T     LB [AR1,P#0.0]

      L     B#16#13
      T     LB [AR1,P#1.0]

      L     1
      T     LW [AR1,P#2.0]

      L     14     //your DB No.
      T     LW [AR1,P#4.0]

      L     #temp2
      T     LD [AR1,P#6.0]

      LAR1  P##Target

      L     B#16#10
      T     LB [AR1,P#0.0]

      L     B#16#13
      T     LB [AR1,P#1.0]

      L     1
      T     LW [AR1,P#2.0]

      L     14        //your DB No.
      T     LW [AR1,P#4.0]

      L     #temp1
      T     LD [AR1,P#6.0]

      CALL  "BLKMOV"
       SRCBLK :=#source
       RET_VAL:=#temp3
       DSTBLK :=#target

      L     #temp2
      T     #temp1
      L     #count1
      LOOP  stag
Its untested, will come back after testing.
 
Last edited:
Ok w.r.t post#2
Code:
Instead of 
 
 L     B#16#13     //data type string
 T     LB [AR1,P#1.0]

use

  L     B#16#2      // data type byte
  T     LB [AR1,P#1.0]

And instead of 
    L     1          //repetetion factor=1
    T     LW [AR1,P#2.0]

use 

  L     22           // repetetion factor 22 (22 bytes)
  T     LW [AR1,P#2.0]
This seems to work !!
 
Thank you very much. I used the code you send me in your first post

and it works perfectly !!!

Thanks again - you really helped me a lot
 

Similar Topics

Hi, I am trying to copy a set of strings from an array in to a different DB CALL "BLKMOV" SRCBLK :=SMP#DB50.DBX ["SMS_ALM_2_POINTER"] Byte160...
Replies
2
Views
3,818
Hello experts. Anyone has any idea how to make BLKMOV execute only once? I have tried with R_TRIG and (P) but it wont write to my location.
Replies
3
Views
198
Hi everyone, I have a short question about BLKMOV instruction, illustrated in the image below. I have the same piece of code in STEP 7 (ET200S)...
Replies
2
Views
2,701
Hi All, It has been a long, long time. But in times of crisis this is somewhere I hold in the highest regard for accurate and swift responses...
Replies
3
Views
4,399
Hello Folks! I have an application where I need to copy a string into various locations within a DB. So, I've set up a Function Block to accept...
Replies
3
Views
4,959
Back
Top Bottom