Today is...
Sunday, May 20, 2018
Welcome to, the global online
community of automation professionals.
Featured Video...
Featured Video
A demonstration of EtherCAT control of linear motors using the CTC EtherCAT master.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Siemens S7 ANY pointer
How do you use the S7 ANY pointer with the BLKMOV to move a UDT to a peripheral Output Address area?
By Jim Thorpe on 3 July, 2004 - 1:03 am

Maybe you could help me here.

How do you use the S7 ANY pointer with the BLKMOV to move a UDT to a peripheral Output Address area?

Any pointers dont seem to like addresses in this area so I cant use the FC even though I would love to. I dont have a problem using UDTs, just trying to get the ANY pointer to point to the correct address area.

ANY help would be appreciated (forgive the pun :))

BLKMOV is SFC20. I did not used it too much (and only for ordinary transfers). So, I checked the help and found that:
- SFC20 can not be used to access peripheral area.
- ANY pointer suports elementary data types (and UDT it is NOT an elementary one).
No wonder you had a hard time trying to solve your problem.

That's what the help says. But, maybe somebody knows a way to do it. I will recheck the anwers posted to this problem. Maybe I will learn something new.


By Chris Heinrichs on 7 July, 2004 - 11:46 am

Jim Thorpe - which version of S7 are you using? In a later version (5.2 SP1) if you highlight the SFC20 BLKMOV instruction then it gives a list of things you CAN'T copy, one of which is the peripheral area. It does not say you cannot write to these areas using the instruction, but I think you are learning that the hard way. The brute force method is to use a series of MOVEs from your source to the PQ area.

This essentially how SFC20 realizes itself at the machine level anyway, a series of moves. Keep in mind the time requirement of writing to the peripheral area. Look in the S7 300 instruction document to find how much time it takes for your processor. Also be sure that you are not writing to peripheral outputs that will be updated by the output image table at the end of the OB1 cycle. If you do, you need make sure the Q's are updated too. For example, with:

L MD 1000
T PQD 20

if QW 20 doesn't match MD1000, you will see unexpected results at your output after the end of the OB1 cycle.


I think you have to use SFC14/15 if you are using 3 byte or more then 4 byte at once. SFC14 and SFC15 are to read/write consistent data to I/O.

Best regards,

By soren holm on 7 July, 2004 - 1:59 pm

Not sure if I understand your question, but I think the answer is, u can not

Using SFC 20 "BLKMOV" you can copy all memory areas except:

The following block types: FB, SFB, FC, SFC, OB, SDB,



Memory areas of the peripheral I/O areas.


By Dennis Patterson on 7 July, 2004 - 5:01 pm

here's an example:

DSTBLK :=P#Q 8.0 BYTE 32

here i am moving 32 bytes to the output image starting at q8.0.

Hope this helps<br>

STEP 7 stores the parameter type ANY in 10 bytes. When constructing a parameter of the type ANY, you must ensure that all 10 bytes are occupied because the called block evaluates the whole contents of the parameter. If, for example, you specify a DB number in byte 4, you must also explicitly specify the memory area in byte 6.

STEP 7 manages the data of elementary and complex data types differently from the data for parameter types.

ANY Format for Data Types

For elementary and complex data types STEP 7 stores the following data:

Data types

Repetition factor

DB number

Memory area in which the information is stored

Start address of the data

The repetition factor identifies a quantity of the indicated data type to be transferred by the parameter type ANY. This means you can specify a data area and also use arrays and structures in conjunction with the parameter type ANY. STEP 7 identifies arrays and structures as a number (with the help of the repetition factor) of data types. If, for example, 10 words are to be transferred, the value 10 must be entered for the repetition factor and the value 04 must be entered for the data type.

The address is stored in the format Byte.Bit where the byte address is stored in bits 0 to 2 of byte 7, in bits 0 to 7 of byte 8, and in bits 3 to 7 of byte 9. The bit address is stored in bits 0 to 2 of byte 9.

With a null pointer of the type NIL all bytes from byte 1 are assigned 0.

More information could be found in Step7 online help.


By Luc Willems on 8 July, 2004 - 1:37 pm

search in the html help for anypointer there is a very usefull example. other wise mail me.

By Fontardion on 8 July, 2004 - 1:38 pm

Dear Sir,
You can't move an UDT because UDT is a description of a data formar inside STEP7, but you can't transfer it to the PLC.

If you want to copy the data in the UDT, you must pointer then with the type of P#DB1.DBX10.0 BYTE 10.


-use write perefery [preferably?] SFC15 : you need to put physical address, length of Source and Source itself. its were you have your UDT for example.
good luck