5/24/2012 9:34 PM | |
Joined: 10/7/2005 Last visit: 11/19/2024 Posts: 3027 Rating: (1057)
|
Hello TEBANCH here are a few suggestions from my side: 1.) You don't need to use AR2 (nor AR1), it is actually doing nothing in your code as your ANY Pointer is constructed in the TEMP area. 2.) The "L DW#16#FFFFFFF8" followed by"AD" is also superflous. It's aim would be to ensure that the bit address of the Pointer is zero, but it will be anyhow due to the SLD3. 3.) If this is indeed an FB and should you need to use ARx somewhere in it, prefferably stay away from AR2 (it is used as the Multi Instance offset in an FB, see also HERE for more on this). 4.) Onepossibly optimised version of your logic couldlook like below (Note: I have not tested it, pelase do so): [code]L W#16#1002 // S7 pointer constant 10hex; Data type 02hex (= Byte) T LW 0 // --> Byte 0 & 1 of ANY Pointer L #Length // Lengh of data to be transfered in BYTES (calculated elsewhere) T LW 2 // --> Byte2 &3 of ANY Pointer L 0// Set DB number to 0 (not applicable as Q are is used) T LW 4 // --> Byte4 &5 of ANY Pointer L #IOAddress// Q Base address L #Offset //Q Byte offset (dynamic part) +I // add together =Q start Byte number SLD 3 // convert to S7 Pointer L DW#16#82000000// Load Q Area ID (82hex) OD // add toQ address T LD 6 // --> Byte6 -9 of ANY Pointer CALL "BLKMOV" SRCBLK :=#StationID RET_VAL:=#dummy DSTBLK :=#INDEX // ANYPointer in LB 0-9[/code] That's all I can think of and I hope ithelps |
Cheers |
|
This contribution was helpful to8 thankful Users |
5/25/2012 5:50 PM | |
Joined: 3/25/2008 Last visit: 1/28/2022 Posts: 232 Rating: (20) |
Hello thanks a lot for your answers.
I have not look at them but my problem is not how to send data over profinet, my problem was how to build/assembly a pointer with variable length and variable byte addres (I'm sorry if i did not provided a good description of the problem), i'm attaching "FB_2",source file that's where i'm using the "variable pointer" technique,any way i also will take a look to those blocks (DPRD_DAT and DPWR_DAT), thank you. Dear fritz, the code you provided is excellent , now i have learnedalot thanks to you. Every one, havea really good weekend. AttachmentFB2_V0_2.zip (829 Downloads) |
Keep working! |
|
This contribution was helpful to1 thankful Users |
Follow us on