neos said:
...I am trying to use a read message in an RSlogix 5000 processor to get an array of the N7 [10] Ints from a ML1400...
You are trying to read in an array of 10 elements, or words, from the N7 Integer data file, but you have "Number of Elements" in your MSG set to "4". This should be "10", as the Number of Elements refers to the source data type.
You have a destination tag "TW_To_Utilities_DINT" which, similar to Ken, I assume is a DINT tag? This is only good for 1 Integer.
If you were reading just 1x16bit source word into a 1xDINT destination, it will use 16 bits of the 32-bit DINT to store the word, and the other 16 bits are left unused.
If you were attempting to read 2x16-bit source words into a 1xDINT destination, it will not make the 32-bit DINT into 2x16-bit INTs and store the 2 words separately. The DINT is accessed and processed at the 32-bit level only. You would have to make the DINT an array of 2xDINT i.e. DINT[1].
For 10x16-bit words, you would need an array of 10xDINT. But each DINT uses 32 bits of memory, using 320 bits of memory to store 160 bits worth of data, wasting 160 bits of memory, which is half the memory used.
I know, the sin of it!
But it just shows how wasteful DINTs are while storing INT data, or SINT for that matter.
A better solution is to use the INT data type. An INT array packs its members contiguously. The first 2x16-bit words go into a 32-bit memory location, and so on. So a 10xINT array will use up 5x32 bits of memory, and not 10x32 bits, using only the required 160 bits of memory. Also, by using the INT data type, it makes it clearer as to what the tag, or array, is supposed to store.
Of course, this is efficient memory storage, not execution. It doesn't make execution any faster, but it can make it slower...
The Logix processors, being 32-bit native, when reading one of 2 packed INT values, have to read the 32 bits used by the 2 INTs, "parse" out whichever 16 bits it doesn't want, and then present the resultant 16-bit INT value. If an INT is used with an ADD instruction, it requires 260 bytes of memory just to access it, compared to just 28 bytes for a DINT. To execute in the ADD instruction, the INT takes 3.49us, compared to a DINT's 0.26us.
So while it saves you space, it slows you down. It's a trade-off I suppose?
Anyway, enough blathering...
So instead, you would have an array called "TW_To_Utilities_INT[9]". Enter the first element of the array into the "Destination Element" e.g. "TW_To_Utilities_INT[0]". Now your N7:0 - N7:9 Integers will each have a snug fitting home to go to.
Lesson for the day...
In Logix controllers, use SINT or INT data types when communicating with external devices that do not support DINT values.
Regards,
George