88 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 2 Bit Instructions (XIC, XIO, OTE, OTL, OTU, ONS, OSR, OSF, OSRI, OSFI)
Bit Addressing
Bits in a Logix controller exist in one of several forms:
• BOOL tag
• BOOL array
• Bits within an integer (SINT, INT, or DINT) tag
• Bits within an integer array
Any of the above constructs may also exist as members of a structure, whether it’s
a system defined data type (SDT) or user-defined data type (UDT).
Bits defined as BOOLs are referenced simply by name. For example, XIC
myBool.
Bits within BOOL arrays are referenced by a subscript appended to the array
name. Subscripts can be a literal value (for example, XIC boolArray[31]), a tag
(for example, XIC boolArray[index]), or an expression (for example, XIC
boolArray[index+1]).
Bits within an integer tag or integer array may be addressed similarly. This is what
Logix often refers to as bit addressing mode for integers. IEC 61131-3 might
refer to it as ‘partial access of ANY_BIT variables’. Bit addressing for integers is
programmed by adding a dot (or period) to the integer indicating subelement
processing followed by a subscript (for example, myInteger[3].11 addresses bit 11,
subelement [3]of the myInteger array). There is a shorthand form for literal
subscripts in this case, which is simply a dot followed by the literal value (for
example, myInteger.3, meaning bit 3 of myInteger). Similar to subscripts for
BOOL arrays above, one can specify a tag or expression for the subscript.
Integer arrays are dealt with similarly except that you must specify a member of
the array from which indexing begins. For example, XIC
myIntArray[4].[index+1] says to start at the 5th element of myIntArray and
access bit ‘index+1.’ Bounds checking is performed on all subscripts to make sure
the reference does not go beyond the boundary of the data object specified.
Literals are checked for conformance during verification.