Specify Bits Within Arrays
You can address bits within elements of arrays. For example:
Definition | Example | Description |
array1
defined as DINT[5] | array1[1].2 | This example references the bit 2 in element 1 of the array. |
array2
defined as INT[17,36]
1 st dimension has 17 elements
2 nd dimension has 36 elements | array2[3,4].15 | This example references the bit 15 of the element array2[3,4]. |
array3
defined as SINT[2,4,6]
1 st dimension holds 2 elements
2 nd dimension holds 4 elements
3 rd dimension holds 6 elements | array3[1,3,2].4 | This example references bit 4 of the element array3[1,3,2]. |
MyArray defined as SINT[100]
MyIndex defined as SINT | MyArray[(MyIndex AND NOT 7) / 8].[MyIndex AND 7] | This example references a bit within a SINT array. |
MyArray defined as INT[100]
MyIndex defined as INT | MyArray[(MyIndex AND NOT 15) / 16].[MyIndex AND 15] | This example references a bit within an INT array. |
MyArray defined as DINT[100]
MyIndex defined as DINT | MyArray[(MyIndex AND NOT 31) / 32].[MyIndex AND 31] | This example references a bit within a DINT array. |
Provide Feedback