PLC applications normally (or always) interact with the external world
through one or more communication protocols. When designing your PLC
application, you decide which variables are available for use by communication
protocols by labeling the variable with a PLC address, for example
%QW5. PLC addressing schemes normally depend on the
runtime and manufacturer. This section describes PLC address support
PLC addresses are constructed as a union of 4 ordered parts:
- a leading
- a storage class (direction) indication
- a data size indication
- a hierarchical address
Formally, a PLC address can be expressed in Backus–Naur Form.
<plc-address> ::= "%" <storage-class> <data-size> <hierarchical-address> <storage-class> ::= "I" | "Q" | "M" <data-size> ::= "X" | "B" | "W" | "D" | "L" <hierarchical-address> ::= <number> | <number> "." <oct-digit> <number> ::= <digit> | <number> <digit> <digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" <oct-digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7"
PLC Addressing in OpenPLC
In OpenPLC, the storage class is a “hint” as to the usage. The precise meaning depends on implementation of a particular communication module. Generally, the storage class has the following interpretation:
Communications modules normally require data with a pre-defined number of bits. Different elementary data types have the same data size. The permitted data size depends on the particular communication module. The elementary data types have the following data sizes:
||Common Name||Number of Bits||Elementary Data Types|
The hierarchical address differentiates otherwise equivalent PLC addresses.
X) PLC addresses have a two-part hierarchical address. The least
significant part (right-most) can be interpreted as a position in a byte and
must be in the range 0 to 7. The most significant part (left-most) must be no
more than 1023. Parts are separated by a single period (
Data sizes other than
X have a one-part hierarchical address. They must not
contain a period (
.) and must be no more than 1023.
|The limitation for the maximum hierarchical address index will be relaxed in the future.|
The following are all valid examples of PLC addresses in OpenPLC.
%IX0.0 %IX0.7 %IB1 %QD100 %ML10
The following are invalid examples of PLC addresses in OpenPLC for the stated reason.
||The least significant index is greater than 7.|
||Three part hierarchy is not permitted address.|
||Two part hierarchy is only permitted for
||Maximum index must be less than 1024.|