打印本文 打印本文  关闭窗口 关闭窗口  
What alternatives are there to BLKMOV (Block move with STEP 7 V5.x) and the ANY pointer for copying memory areas in STEP 7 Basic V10.5?
作者:未知  文章来源:不详  点击数 1026  更新时间:2010/5/6 10:36:44  文章录入:ruoheng

Description
You must use the "MOVE_BLK" (copy block) instruction to copy memory areas in STEP 7 Basic V10.5. It is not possible to use ANY pointers as in STEP 7 V5.x. If you want to copy the contents of one data block (source area) to another data block (target area), you must create the data blocks with variables of the "ARRAY" data type. Using the ARRAY variables and the "MOVE_BLK" instruction, you can copy parts or the complete memory area from the data block. Unlike with the ANY pointer as in STEP 7 V5.x, you use the "COUNT" parameter to define the number of elements from which you wish to copy data from the source area into the target area.

Note
More information on the topic of "Pointer Addressing" is available in Entry ID: 42603286.


Fig. 01

Figures 01 and 02 show an example of data transfer from DB1 to DB2 between the two variables of data type "Array [1 ... 16] of Byte".

  • With the index specification [5] of the array variables ("Data_block_1".Array_DB1[5]) at the "IN" parameter, the 5th byte is marked in the source area of DB1.
  • With the index specification [10] of the array variables ("Data_block_2".Array_DB2[10]) at the "OUT" parameter, the 10th byte is marked in the source area of DB2.
  • If the "Count_01" variable at the "COUNT" parameter has the value "5",
    • The contents of the memory areas from Byte 5 to Byte 9 are copied from DB1
    • into the memory areas from Byte 10 to Byte 14 in DB2.


Fig. 02

The "MOVE_BLK" command is located in the block folder in the "Instructions" palette:

  • Either in the "Instructions > Move" folder or
  • You drag-and-drop the "Empty box" from the "Instructions > General" folder into your network. Move the cursor on the yellow triangle in the empty box until the symbol for opening the drop-down list appears and from the drop-down list you select the "MOVE_BLK" command.

More information is available in the STEP 7 Basic Online Help under "MOVE_BLK: Move block".

Creation environment
The pictures in this FAQ were created with STEP 7 Basic version V10.5.