4/1/2013 6:56 PM | |
Joined: 1/28/2009 Last visit: 10/26/2024 Posts: 6852 Rating: (1365)
|
Hello, There are some points to clear before further discussion: 1-Why don't you use SFC20 for mass data transfer? 2-Why don't you load the loop counter at the end of codes in loop and before calling (LOOP S001 )? 3-Why don't you use method mentioned here to avoid opening DBs in loop? 4-If you use byte access and jump 2 bytes in each iteration, you may loose half of data width.I recommend WORD access as illustrated below. [code] LAR1 P#0.0 LAR2 P#0.0 OPN DB 1 OPN DI 2 L 9 lp: T #cyklus L DBW [AR1,P#0.0] T DIW [AR2,P#0.0] +AR1 P#2.0 +AR2 P#2.0 L #cyklus LOOP lp[/code] Best regards Hamid Hosseini |
Last edited by: hdhosseini at: 4/1/2013 7:29 PM// loop label is changed to be visible in code viewer Last edited by: hdhosseini at: 4/1/2013 7:09 PM |
|
4/1/2013 8:01 PM | |
Joined: 3/24/2009 Last visit: 7/9/2024 Posts: 535 Rating: (112) |
Absolut correct! Either L/T DBW [AR1/2,P#0.0] or +AR1 P#1.0 Find an example for the SFC20 here |
Last edited by: yy1 at: 4/1/2013 8:11 PMLast edited by: yy1 at: 4/1/2013 8:04 PM |
|
4/1/2013 8:05 PM | |
Posts: 4 Rating: (0) |
thanks |
4/1/2013 8:12 PM | |
Joined: 1/28/2009 Last visit: 10/26/2024 Posts: 6852 Rating: (1365)
|
See the following as a more simpler equivalent: [code] CALL "BLKMOV" SRCBLK :=P#DB1.DBX 0.0 WORD 9 RET_VAL:=MW100 DSTBLK :=P#DB2.DBX 0.0 WORD 9[/code] You have option of using STEP7 online help for each block with some samples.For that select the block and press F1. Check the following clustered topics for SFC20: HD_Cases on SFC20 Best regards Hamid Hosseini Attachmentsfc20.pdf (234 Downloads) |
Last edited by: hdhosseini at: 4/1/2013 8:16 PM// manual for SFC20 from STEP7 online help |
|
4/1/2013 11:31 PM | |
Posts: 197 Rating: (3) |
Hi hdhosseini/ yy1, I hope the following minor chages (in bold letters)would do the same function: LAR1 P#DBX.0 LAR2 P#DBX.0 L 9 S001: T #cyklus OPN DB 1 L B [AR1,P#0.0] OPN DB 2 T B [AR2,P#0.0] +AR1 P#1.0 +AR2 P#1.0 L #cyklus // used by the loop-statement LOOP S001 Regards |
4/2/2013 4:48 AM | |
Joined: 1/28/2009 Last visit: 10/26/2024 Posts: 6852 Rating: (1365)
|
Hello, if we do not care about the optimum and concise solution,there are some points to be corrected in your suggesting codes: 1-You are loading same value to AR1 and AR2, one seems to be enough and use AR1 instead of AR2 in your program. 2- "LAR1 P#DBX.0 " is a wrong notation for STL editor and you should try "LAR1 P#DBX0.0 " 3-Still there is a big problem with loop counter, accessing bytes and incrementing just one byte in pointer stored in AR1.9 WORDs consist of 18 bytes,so change the loop counter to 18.As your code suggests only half of the table in source area will be copied to the target area. LAR1 P#DBX 0.0 // LAR2 P#DBX 0.0 L 18 S001: T #cyklus OPN DB 1 L B [AR1,P#0.0] OPN DB 2 T B [AR1,P#0.0] +AR1 P#1.0 // +AR2 P#1.0 L #cyklus LOOP S001 Hope not to miss any major point! Best regards Hamid Hosseini |
Last edited by: hdhosseini at: 4/2/2013 4:52 AM// typo |
|
Follow us on