I Need to copy 16 bytes (chars) from PIW-area and store in a DB. The PIW area contains a string received from 3:rd party device over profinet. (ABC Communicator, Modbus -> ProfiNet).
I Think i know how to construct the pointer, But what i don't understand is how the PLC determines if it is the PI or PQ area. I can only assume that this is determined by if it's a BLKMOV from or BLKMOV to operation ?
Please describe.
Find below my code, and please comment, or if there is a more direct, perhaps much easier way of doing this, please show how.
Best regards
Pethoek.
( Yes, i know i need to add some more code, to make it a valid S7-String, but i left that part out so no need for commenting on that )
I Think i know how to construct the pointer, But what i don't understand is how the PLC determines if it is the PI or PQ area. I can only assume that this is determined by if it's a BLKMOV from or BLKMOV to operation ?
Please describe.
Find below my code, and please comment, or if there is a more direct, perhaps much easier way of doing this, please show how.
Best regards
Pethoek.
Code:
LAR1 P##srcptr // Pointer Address
L W#16#1002 // (10h always) + (02 for Byte)
T W [AR1,P#0.0] // Store as offset W0 in pointer
L 16 // 16 Bytes to be copied
T W [AR1,P#2.0] // Store as offset W2 in pointer
L 0 // Src is not a DB
T W [AR1,P#4.0] // Store as offset W4 in pointer
L 304 // PI address to start copy from
SLD 3 // Convert to byte.bit address format
L DW#16#80000000 // 80H for P Area
OD // Combine to memory area + address
T D [AR1,P#6.0] // Store as offset DW6 in pointer
CALL "BLKMOV"
SRCBLK :=#srcPtr
RET_VAL:=#retVal
DSTBLK :=P#DB77.DBX2.0 BYTE 16
( Yes, i know i need to add some more code, to make it a valid S7-String, but i left that part out so no need for commenting on that )
Last edited: