Addresses
Caution
If you use pointers to addresses, then the contents of addresses can be moved during an online change. If you use absolute addresses, then the contents of addresses does not change during an online change.
Syntax:
%
<memory area number> <size prefix> <position number> .
<bit position number>
| Required Address in the memory area
|
<memory area prefix> | Required
|
<size prefix> | Optional
|
<memory position> | <position number> Example: |
<position number> | Required The numbering depends on the target system and starts at 0. |
| Optional 0..7 for one byte |
When defining an address, you use specific strings to express the memory position and size. An address comprises the percent sign (%
), followed by the memory area prefix, the optional size prefix, and the memory area position. The numbering which you use for addressing the memory position depends on the target system.
| Single bit address of the output bit 7.5 |
| Word address of the input word 215 |
| Byte address of the output byte 7 |
| Address of a double word at memory position 48 in flag memory |
| Word address of an input word; interpretation dependent on the current controller configuration |
VAR wVar AT %IW0 : WORD; END_VAR | Variable declaration with address information of an input word |
VAR xActuator AT %QW0 : BOOL; END_VAR | Boolean variable declaration Note: In the case of Boolean variables, one byte is allocated internally when a single bit address is not specified. A change in the value of |
VAR xSensor AT %IX7.5 : BOOL; END_VAR | Boolean variable declaration with explicit specification of a single bit address When accessed, only the input bit 7.5 is read. |
Memory position
Make sure that the address is valid as follows:
To map a valid address in an application, you first need to know the required position in the process image. This means the applicable memory area: input memory area (I
), output memory area (Q
), or flag memory area (M
) (see above). Furthermore, you need to specify the required size prefix: bit, BYTE
, WORD
, DWORD
(see above: X
, B
, W
, D
)
The currently used device configuration and device settings (hardware structure, device description, I/O settings) play a decisive part.
Pay special attention to the differences in the interpretation of bit addresses between devices with byte addressing and devices with word-oriented IEC addressing.
In the case of the bit address %IX5.5
, the number before the dot addresses byte 5 in a byte-addressed device and word 5 in a word-addressed device.
In contrast, addressing with a word or byte address is independent of the device type: with %IW5
, word 5 is always addressed, and with byte address %IB5
always byte 5. Depending on the size and addressing mode, you can therefore address different memory cells with the same address information.
The following table shows the comparison of byte addressing and word-oriented IEC addressing for bits, bytes, words, and double words. It also shows the overlapping memory areas for byte addressing. See the example at the end of the table.
Concerning syntax, note that the IEC addressing is always word-oriented. The word number is located before the dot, and the bit number after the dot.

n = byte number
D0
contains B0
- B3
. W0
contains B0
and B1
. W1
contains B2
and B3
. W2
contains B4
and B5
.
W1
, but also D1
, D2
, and D3
must not be used for addressing. This avoids overlapping.