7/31/2012 7:01 PM | |
Joined: 1/3/2006 Last visit: 2/19/2024 Posts: 726 Rating: (71) |
HI Try this A #from_1_2; JCN NW1A; LAR1 P##Data1; L W [AR1,P#0.0]; T #word1; L W [AR1,P#2.0]; T #word2; L W [AR1,P#4.0]; T #word3; L W [AR1,P#6.0]; T #word4; L W [AR1,P#8.0]; T #word5; JU NW1B; NW1A: LAR1 P##Data2; L W [AR1,P#0.0]; T #word1; L W [AR1,P#2.0]; T #word2; L W [AR1,P#4.0]; T #word3; L W [AR1,P#6.0]; T #word4; L W [AR1,P#8.0]; T #word5; For more clarity see the attached file.
AttachmentCOPY.pdf (109 Downloads) |
8/1/2012 10:01 AM | |
Joined: 1/3/2006 Last visit: 2/19/2024 Posts: 726 Rating: (71) |
Hi Run the attached program in PLCSIM and check. Regards Manmeet
AttachmentCopy.zip (81 Downloads) |
8/2/2012 1:30 PM | |
Joined: 10/7/2005 Last visit: 5/14/2024 Posts: 3005 Rating: (1048)
|
Hello nowire your orignal FB21 works in principle correctly and you are also doing the right thingby taking AR2 into account to get the Instance DB offset. You will also see the 10 Byte longANY pointer values inside the Instance DB of your "DATA" IN_OUT variable (display them in a VAT to check for yourself). The problem is though that these values will NOT be copied over to your 10 Byte ANY pointer TEMP variable that you assigned to FB21's "DATA" IN_OUT variable. Step 7 simple does not know what to do in this case (it can NOT handle this) and one fix is to simply change the FB21 to an FC (there seems to be no need to use an FB for this anyhow). Attached is an example of it and note too that I rationalised the logic a bit (use DWORD Temp variables) butmore importantly changed"DATA" from an IN_OUT variable to an OUT varaible. I hope this helps |
Cheers |
|
This contribution was helpful to1 thankful Users |
8/6/2012 1:38 PM | |
Joined: 1/26/2012 Last visit: 3/29/2024 Posts: 101 Rating: (0) |
Thanks fritz, I have write the FC and it work very well!
|
This contribution was helpful to1 thankful Users |
Follow us on