Transfer array to DB in step7

Join Date
May 2009
Location
Halmstad
Posts
41
Hey! I'm trying to transfer an array of Int to a DB I created using SFC22. The code I am using for the transfer is this:

datasize is the array of Int's I want to transfer
creat_db1 is the DB number SFC22 returned when creating the DB

Network 38:
LAR1 P##source_ptr
L W#16#1005
T W [AR1,P#0.0]
L 128
T W [AR1,P#2.0]
L 0
T W [AR1,P#4.0]
L DW#16#85000000
L P##datasize
SLD 4
+D
T D [AR1,P#6.0]

Network 39:
LAR1 P##dest_ptr
L W#16#1005
T W [AR1,P#0.0]
L 128
T W [AR1,P#2.0]
L #creat_db1
T W [AR1,P#4.0]
L DW#16#84000000
T D [AR1,P#6.0]

Network 40:
CALL "BLKMOV"
SRCBLK :=#source_ptr
RET_VAL:=#blkmove_ret
DSTBLK :=#dest_ptr

in the blkmove_ret I get error code 8124, which means (if I understand everything correctly), it means "Range error when reading a parameter", where could this range error occur?
 
Can you send a picture with online(simulator) values?
And what is P#DataSize?
How many integers are you transfering 128?
 
@LD: datasize is an array of 128 Int's that I want to transfer, when trying to write L #datasize the step7 says "Variable of a higher type cannot be used in this statement"

@Thim: How do I simulate this? #datasize is an array with 128 Int's that I want to transfer to the DB. Yes, 128 Integers.
 
Is the array loacted in a db?
Why not just give the startpoint of the array in the anypointer and the length ?
Or do i misunderstand this?
 
Ok if i understand it well you want to move a array that is located in a db to another db you create.
If so i think in the source anypointer you can define in
Code:
L X // write here the source db number
T w[AR1,P#4.0]
 
L Y // write here the start position of where the array starts 
T D[AR1,P#6.0]
 
If datasize is the name of the array, then

Code:
SLD 4

is one of your errors and is not required. As your source is from the instance DB, you are setting the source DB number to zero whereas it should be set to the instance DB number.

Code:
L dino

gets the number of the instance db into the accu.

More errors to be reported soon.
 
Last edited:
@Thim: Is it possible to determine the DB number of the instance DB? Because the source DB is the instance DB of the FB that is conducting the transfer.
Isn't P##datasize the start position of the array?

@LD Okay, I will try this.
 
I tried to exchange L P##datasize for L 32 and it seems it did the trick with that specific error, but isn't there any way to load it automatically? If the DB structure should change, it would be convenient not having to change this variable too every time?

Also, I changed to L DINO, seems to work fine with that too.

Also, now when I ran it, I got error code 8122, meaning "Range error when reading a parameter". Why does it say that? Isn't the point of an ANY pointer to point any size?
 
Next error:

When you load a pointer, the area is already included (in this case the instance DB). By adding DW#16#85000000 you are generating a non-valid area.

Code:
L DW#16#85000000
L P##datasize
SLD 4
+D 
T D [AR1,P#6.0]

Code should be (only for single instance FB - will not work in multiple instance FB):

Code:
L P##datasize
T D [AR1,P#6.0]
 

Similar Topics

Okay folks, this is (hopefully) the last question from me for a while :-P I've got this 32 byte array of bytes I wish to write to the I/O area...
Replies
6
Views
3,531
Another one for Simon! This is related to the BLOCK_DB question in as much as it's the same program. I need to pass over the Cell address in the...
Replies
4
Views
3,897
Hi' I am writing some software where I calculate a number of encoder stop points, from a teached start and stop point with a pre defined...
Replies
11
Views
2,542
I am having a problem with moving data from a 32 point input card. I have three two digit thumbwheels (1 Byte per digit) and the last word is...
Replies
4
Views
1,769
I'm trying to verify a project with a PLC. The Transfer Setup menu item is grayed out and every time I click Verify with PLC, I get an error...
Replies
1
Views
55
Back
Top Bottom