In my project i use an Anybus-X gateway for exchanging data with 3rd party as a modbus slave.
Data is provided as means of PIW and PQW area and in order to used separate bits in a word i ned to somehow copy the word from PIW area to in my case a structure in a DB.
Totally i need to copy 20 bytes from PIW to my DB-Struct.
I have used any pointers before, but not so much that i can say i'm comfortable with the concept. So instead of just asking you guys of a solution, i tried to come up with one myself.
So please could anyone tell me if this will work or not.
Purpose: Copy X Bytes from PIW-area to DB-Area
Network 1
Network 2
Network 3
Best regards
Pethoek
Data is provided as means of PIW and PQW area and in order to used separate bits in a word i ned to somehow copy the word from PIW area to in my case a structure in a DB.
Totally i need to copy 20 bytes from PIW to my DB-Struct.
I have used any pointers before, but not so much that i can say i'm comfortable with the concept. So instead of just asking you guys of a solution, i tried to come up with one myself.
So please could anyone tell me if this will work or not.
Purpose: Copy X Bytes from PIW-area to DB-Area
Network 1
Code:
LAR1 P##anySrc
L W#16#1002
T W [AR1,P#0.0] // 10h for S7, 02 for BYTE
L #Bytes
T W [AR1,P#2.0] // Repetition fctr
L W#16#0
T W [AR1,P#4.0] // Not a DB
L W#16#8000
T W [AR1,P#6.0] // P-Area
L #Laddr // P-Adress to start copying from
SLD 3 // Byte.Bit convertion
T W [AR1,P#8.0] // Byte.Bit
Network 2
Code:
LAR1 P##anyDest
L W#16#1002
T W [AR1,P#0.0] // 10h for S7, 02 for BYTE
L #Bytes
T W [AR1,P#2.0] // Repetition fctr
L DBNO
T W [AR1,P#4.0] // DB number
L W#16#8400
T W [AR1,P#6.0] // DB-Area
L #DBB // Byte adress to start pasting
SLD 3 // Byte.Bit convertion
T W [AR1,P#8.0] // Byte.Bit
Network 3
Code:
CALL "BLKMOV"
SRCBLK :=#anySrc
RET_VAL:=#retVal
DSTBLK :=#anyDest
Best regards
Pethoek