Sfc20 blk move indirect addressing

dconn

Member
Join Date
Jul 2015
Location
Northern Ireland
Posts
6
Hello all,

IN S7-300 Does anyone know if its possible to address sfc20 source and destination with variable addresses? ie Indirect addresses.

Rather than having to use lots of blkmove functions, use a loop which will alter the addresses for sfc20, to move various strings around in a datablock.

Thankyou in advance.
 
Yes it is possible, you have to contruct the anypointers passed to SFC20 programmatically. By declaring an any pointer in the temp area, you can fill in the anypointer data and pass this to SFC20

If you are considering a loop, the your source/destination data must be declared in repetitive length structures. Post the data areas you are intending to move by copying them to a Step 7 library, archive the library and then post here.
 
Hello,

Thankyou for your response.

Please see the attached image of my db. I am wanting to shuffle the data in each variable down before filling in new data in position 1.

eg. the loop should move BATCH_CODE_9 into BATCH_CODE_10, then BATCH_CODE_8 into BATCH_CODE_9 and so on
Finally BATCH_CODE_1 data moves into BATCH_CODE_2 ---- and now the new data can be added to the top of the db into BATCH_CODE_1

So instead of lots of labour-some blkmove commands, I am trying to workout a loop to change the 'starting' point of the address each time and move this new address into the blkmove parameter.

I know that my BATCH_CODE variables are the same length each time, so I can just alter the starting position of the data move each time.

BATCH_CODE_9 into BATCH_CODE_10, then BATCH_CODE_8 into BATCH_CODE_9 - P#DB199.DBX1408.0 BYTE 22 into P#DB199.DBX1584.0 BYTE 22

So the 'DBX1408.0' part needs altered for the next execution to 'DBX1232.0'
etc...


DB MOVE.png
 
Example implementation. Note that only the batch codes are moved, the product code and batch names do not.
 
Hello,

Thankyou very much for your reply. Sorry I'm late responding, I was on holiday.....

I have read through your example and understand whats going on.
However what is the reason for the P#DBX0.0 and then the 'OD' command?

I can see how you are working out the starting byte address with the 'SLD 3' command

Why are you 'or-ing' the P#DBX0.0 with the starting byte address? I dont quite understand this part. Could you perhaps explain this. Is it to get the correct structure for the any pointer ie 'DBXxxx.x'

L 9
loop: T #iLoopCount
L #iSizeOfSructInBytes
*D
SLD 3
L P#DBX 0.0
OD
LAR1 P##pDEST
T D [AR1,P#6.0]

Thankyou in advance
 
I take it you wil be modifying it so that the product code and batch names are moved as well? I started out moving all of them but changed it thinking you only wanted to move the batch codes.
 
Thats a great idea,

I see - So everything else stays the same. This will copy the batch code, product code, and batch name as one unit into the next unit....

Also were we work out the byte start address - that also stays the same.

Thankyou....good to get some idea of this coding.
 

Similar Topics

I have a very strange issue and I cannot figure out why it is not working. I read input of type pointer and store it to local temp type any. I...
Replies
4
Views
1,932
Hello everyone! I'm moving string value from DB to Q area for displaying it at WinCC. I see some value is presented in DB in Variable Table...
Replies
16
Views
5,653
In one network SFC20(BLkMOV) is used to transfer 8 byte data from P#DB500.DBX8.0(SRC BLK) to P#DB20.DBX4.0(DST BLK). I would like to change...
Replies
2
Views
4,272
Hi all, i have learned siemens sample code by using sfc 20 for data move. but i don't know how i can adapt this sample code if i would like to...
Replies
0
Views
2,005
I Can't see why the first block move returns 8325 but second works. (well i can see why the second works).. What is wrong with my pointers...
Replies
2
Views
6,404
Back
Top Bottom