One other thing to be mindful of...
Back in the day, a COP instruction would blindly copy bits to the length specified, right or wrong. The thing that often catches people out (never
me of course
) was that the length was in terms of
destination elements, not
source elements. That is, if you have twelve 16-bit integers coming in from a Modbus device, and you need to assemble them into six 32-bit REALs, you would copy Source[0] to Destination[0] with a length of six. Six 32-bit REAL's, and it would grab twelve 16-bit integers to do it. Intuitively, it's easy to set the length to twelve, because you're mentally thinking "take these twelve integers and copy them over there".
Anyway, this mistake could cause a lot of problems because it would overwrite data arbitrarily without a care in the world. The PLC would, as PLC's always do, do exactly what you tell it to do and assume you know what you're doing.
Where this runs into
real trouble is when you run off the end of an array. In the example above, if your destination array was only six REALs long, your PLC is going to write some meaningless data into the next 6*32 bits of memory in the PLC, which could be just about anything. And then you wind up with completely unrelated, unpredictable data changing in untraceable ways until you track down your mistake.
Anyway, in newer versions of hardware, they finally put a sanity check into the COP instruction which prevented it from copying past the end of an array or structure. So in the example above, you could put your length as 6 (correct), 12 (incorrect) or 65536 (wildly incorrect) and it would work as (presumably) intended, copying data from the source into the 6 REALs and then reaching the end of the array and stopping.
But of course, that only applies to newer hardware. Throw that code into a 5370 Compact Logix and You're Gonna Have A Bad Time.
All of that waffle goes to say - I don't know if MSG instructions have a similar sanity check involved, but if there is one, it may be hardware dependent. So if this is important, make sure you check it across a couple of different processor types!