IamJon Posted August 29, 2012 Report Posted August 29, 2012 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. Quote
Moggie Posted August 29, 2012 Report Posted August 29, 2012 Have you looked at SFC20 BLKMOV in S7 "Standard Libraries" ? Quote
IamJon Posted August 30, 2012 Author Report Posted August 30, 2012 (edited) 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 August 30, 2012 by IamJon Quote
Groo Posted August 30, 2012 Report Posted August 30, 2012 (edited) 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 August 30, 2012 by Groo Quote
IamJon Posted August 31, 2012 Author Report Posted August 31, 2012 (edited) 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 August 31, 2012 by IamJon Quote
IamJon Posted August 31, 2012 Author Report Posted August 31, 2012 A little embarassing... I guess I didn't realize the "byte X" part was the length. I'm good now. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.