Bit Addressing
Bit addressing is used access a particular bit within a larger container. Larger containers include any integer, structure or BOOL array. For example:
Definition | Example | Description |
---|---|---|
Variable0
defined as LINT has 64 bits | variable0.42 | This example references the bit 42 of variable0. |
variable1
defined as DINT has 32 bits | variable1.2 | This example references the bit 2 of variable1. |
variable2
defined as INT
has 16 bits | variable2.15 | This example references the bit 15 of variable2. |
variable3
defined as SINT
holds 8 bits | variable3.[4] | This example references bit 4 of variable3. |
variable4
defined as COUNTER structure has 5 status bits | variable4.DN | This example references the DN bit of variable4. |
MyVariable defined as BOOL[100]
MyIndex defined as SINT | MyVariable[(MyIndex AND NOT 7) / 8].[MyIndex AND 7] | This example references a bit within a BOOL array. |
MyArray defined as BOOL[20] | MyArray[3] | This example references the bit 3 of MyArray. |
variable5 defined as ULINT holds 64 bits | variable5.53 | This example references the bit 53 of variable5. |
Use Bit Addressing anywhere a BOOL typed tag is allowed.
Provide Feedback