Partial Access to ANY_BIT Variables
According to IEC 61131-3, 3rd edition, the partial access to a specific bit, byte, word or double word of variables of the data type ANY_BIT is possible. The partial access to a variable is programmed by adding a dot (.) to the variable name followed by the optional '%' sign, the size prefix and an integer number (from 0 to max) for the address within the variable.
Syntax
The following table shows the syntax how to access a specific part of an ANY_BIT variable.
Bit-wise access to:
BYTE variable | <variable_name>%X0 to <variable_name>%X7 |
WORD variable | <variable_name>%X0 to <variable_name>%X15 |
DWORD variable | <variable_name>%X0 to <variable_name>%X31 |
LWORD variable | <variable_name>%X0 to <variable_name>%X63 |
Byte-wise access to:
WORD variable | <variable_name>%B0 to <variable_name>%B1 |
DWORD variable | <variable_name>%B0 to <variable_name>%B3 |
LWORD variable | <variable_name>%B0 to <variable_name>%B7 |
Word-wise access to:
DWORD variable | <variable_name>%W0 to <variable_name>%W1 |
LWORD variable | <variable_name>%W0 to <variable_name>%W3 |
DWord-wise access to:
LWORD variable | <variable_name>%D0 to <variable_name>%D1 |
Intellisense for partial access to ANY_BIT variable
The Intellisense function in the text and graphic editors supports the specification of a specific part of an ANY_BIT variable.
Entering the variable name of the ANY_BIT variable followed by a dot opens the selection box with all size prefixes allowed for the entered variable.
Text editor example
Graphic editor example