Hello all.... I'm still coming to terms with Siemens PLC programming after many years of only knowing AB, so be gentle -
I've got an FB with some tags and a few 'scratchpad' type arrays (type 'char') set up in the 'STAT' area. What I'm trying to do is take a few puzzle pieces and move them into certain bytes within those static arrays without specifically addressing the DB that I have assigned to my FB (e.g. P#DB500.DBX5.0 BYTE 5)
For one example, I have a BLKMOV where I'm moving a string value which is 5 characters/bytes into one of these arrays. I can directly use my 'STAT' string tag name, and the array tag name in the BLKMOV instruction, but cant define a length. Wil it actually copy all 5 bytes to the array?
The other example, is now taking the 5 bytes from the 'STAT' array above (or another), and moving them into another 'STAT' array at a particular byte. So basically copy byte#0-4 of ARRAY_01 into byte #10-14 of ARRAY_02. Again, I know I can reference the absolute DB and byte range, but is there a way to keep it generic and only reference the 'STAT' tags for the FB? I don't really want to have to go back and change stuff if my DB number has to be updated, and so I can use the base code in the FB with no (or very little) mods elsewhere in my program.
The majority of my code is LADDER (ala AB programming for years), since I'm still fumbling through STL (which I can see is pretty powerful).
Thanks in advance for any help or slaps on the wrist!
I've got an FB with some tags and a few 'scratchpad' type arrays (type 'char') set up in the 'STAT' area. What I'm trying to do is take a few puzzle pieces and move them into certain bytes within those static arrays without specifically addressing the DB that I have assigned to my FB (e.g. P#DB500.DBX5.0 BYTE 5)
For one example, I have a BLKMOV where I'm moving a string value which is 5 characters/bytes into one of these arrays. I can directly use my 'STAT' string tag name, and the array tag name in the BLKMOV instruction, but cant define a length. Wil it actually copy all 5 bytes to the array?
The other example, is now taking the 5 bytes from the 'STAT' array above (or another), and moving them into another 'STAT' array at a particular byte. So basically copy byte#0-4 of ARRAY_01 into byte #10-14 of ARRAY_02. Again, I know I can reference the absolute DB and byte range, but is there a way to keep it generic and only reference the 'STAT' tags for the FB? I don't really want to have to go back and change stuff if my DB number has to be updated, and so I can use the base code in the FB with no (or very little) mods elsewhere in my program.
The majority of my code is LADDER (ala AB programming for years), since I'm still fumbling through STL (which I can see is pretty powerful).
Thanks in advance for any help or slaps on the wrist!