Sign in to follow this  
Followers 0
IamJon

Moving data of specific length from one DB to another?

7 posts in this topic

I have an array of data, with each type being a UDT of let's say 120 bytes. What is the best way to transfer all this data? I'm trying to avoid moving one byte or double word at a time. So basically I have my offset within the array defined, but need to know how I can set the length and grab all the data at once. Has to be in STL since I'm doing indirect addressing. Although, if you don't know STL but can do it in Ladder, post in ladder and I'll translate myself. Thanks.

Share this post


Link to post
Share on other sites
Have you looked at SFC20 BLKMOV in S7 "Standard Libraries" ?

Share this post


Link to post
Share on other sites
Thanks, I'll check it out. ETA: Found this http://www.automation.siemens.com/WW/forum/guests/PostShow.aspx?PageIndex=1&PostID=46427&Language=en Can it be done with indirect addressing? Depending on the data, I will need to pull from different areas of the source DB and place in different areas of the destination DB. Edited by IamJon

Share this post


Link to post
Share on other sites
Here is an example

Share this post


Link to post
Share on other sites
Yes it can, you would have to create TEMP ANY tags and build the address into that tag. You would need to know the ANY data format. Its made up of 10 bytes Byte 0 = always 10h for S7 1 = Data Type (hex code, eg 2=byte, 4=word, 5=int, etc) 2/3 = Repetition factor (eg number of bytes, words, ints, etc) 4/5 = DB No (0 for no DB) 6 = Memory area (hex code, eg 83= M, 84 = DB, 85 = DI) 7/8/9 = word.bit address (byte 9 bits 0-2 = bit address) for example if you created a TEMP tag called SOURCE and made that an ANY, in the code you would have to point AR1 to the TEMP example LAR1 ##SOURCE and then write the address into area pointed to by AR1 (which is source) L W#16#1002 // Bye format T LW(AR1,P#0.0) L 10 // 10 Bytes T LW(AR1,P#2.0) L 5 // DB5 T LW(AR1,P#4.0) L 15 // DBB15 SLD 3 L W#16#84000000 // DB Memory Area OD T LD(AR1,P#6.0) So Source would now be pointing to DB5.DBB15 10 bytes long when calling SFC20, #Source can be used as the input parameter. Same can be done for the output. Edited by Groo

Share this post


Link to post
Share on other sites
Is there a way to indirectly open a DB? OPN "DB_Source" L DBD 0 OPN "indirect DB" T DBD 0 ETA: Found it OPN DB [DIW 4] //this is for STAT memory OPN DB [MW4] //for regular memory Edited by IamJon

Share this post


Link to post
Share on other sites
A little embarassing... I guess I didn't realize the "byte X" part was the length. I'm good now.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0