Copy blocks of data with Siemens S7-300

Werner

Member
Join Date
Apr 2005
Location
IJsselstein
Posts
336
Hi!

For my application (in an S7-317 plc) I want to create two DB's. These DB's are filled with an array of a certain UDT. (Array[1..100] of UDT1). So far no problems. Now I need to move data around. I hope there is some kind of clever copy instruction? Maybe one of the SFC functions?

I don't want to copy the record byte by byte. I need some instruction like copy DB1 record 1 to DB 2 record 10. Does anybode know a solution? I also need to shift the records. So shift record 1 to 99 -> 2 to 100 and copy new data in record 1.

Kind regards,


Werner
 
There are several 'contenders' that you may look into:

In the Standard Library under S5-S7 Converting Blocks:
FC94 Copy Data Block 1
FC95 Copy Data Block 2

In the Standard Library under TI-S7 Converting Blocks:
FC81 IBLKMOV

edit:
PP's suggestion is probably best.
The SFC20 doesnt take up code memory, and is probably more optimised than the FC's I suggested.
 
Last edited:
Is there also a way to create a any pointer with references to the udt being copied? I want to avoid giving up data lengths.

Another problem can you make the data length variable.

For example a pointer like: P#DB1.DBX 0.0 BYTE 200

Can I make the number 200 variable? (I think things would be easier in SCL?)
 
Variable Lengths of data any pointer

You can build and modify an "any pointer" using and word, or word etc, moves, and turning particular bits on in the pointer data area. That is the only way I know of to make the any pointer variable at runtime. It also has to reside in a data block. You cannot create an any pointer in other types of memory besides local data.
 
SCL provides array handling so I would recommend it for handling arrays of UDT's. You could create two arrays of static data instead of using two DB's (unless the size of your UDT's precludes this).
Instead of shifting your records, you could use a linked list and move the pointers around when you add a new record.
 

Similar Topics

I have 2 7cp476 plcs. How can I copy one of them and install it somewhere else?
Replies
0
Views
73
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
128
Hi everyone I'm in a bit of a conundrum, I've been trying to get this HMI on our machine and I am unable to retrieve it. Device Delta Model...
Replies
10
Views
877
Hi I have a Melsec FX1S-20MR, which has been programmed. I would like to copy the program to a new FX1S-20MR? What are the possible ways to do...
Replies
4
Views
619
Project involves updating a ~23 year old controller (C200HX CPU64). The HMI is a windows NT machine with the gui done with Delphi 5 (Pascal)...
Replies
1
Views
1,096
Back
Top Bottom