Copying DINT to INT so that they can be used by antique FIX32 SCADA (FIX32 cannot read DINT)
Yes I want the DINT range to be copied to a larger INT but want data in first location...on this copy.
No negative numbers...all 0-32000 range
Presently using FAL to copy 50 DINT B63[0] (B63 is DINT[400]) to first 100 INT of N67[100] (N67 is INT[800]) and it looks like the DINT numbers are showing up in the first 50 INTs of N67[100], which is okay and expected as I did not want them to show up in every other location.
There are more B63 tags being copied to N67 range but position is higher.
I assume the position of where the B63 tags get written to in the N67 range is why the FAL is needed for positioning.
The FAL is just a multiple MOV. And MOV will convert the 32-bit DINT source data into the 16-bit INT destination data.
So there are 50 DINT source values starting at B63[0], and the FAL will sequentially convert and store those 50 values into the INT array. This means there are only 50 destination addresses populated, not 100. Since the FAL does perform data conversion, you
will get overflow errors if any of the DINT values > 32,767.
Contrast that to the COP instruction, which cares not about the data-types of the source or destination when doing the copy, no data conversion takes place. It simply takes the length you specify, multiplies that by the number of bytes of the destination data-type, and then copies that number of bytes from the source to the destination.
So if you COP your 50 32-bit DINTs to a 16-bit INT array, you will need 100 INTs to receive the bytes.
50 DINTs = 200 bytes
100 INTs = 200 bytes
I would suggest that FAL, as you are using, is the best instruction for the job you described....