Make sure that the address is valid as follows:
To map a valid address in an application, you have to know the required position (applicable
memory range) in the process image: input memory range (I), output memory range (Q),
and flag memory range (M) — see above. Furthermore, you have to specify the required
size prefix: bit, BYTE
, WORD
, DWord
(see above: X
, B
, W
, D
)
The current device configuration and device settings (hardware structure, device description,
I/O settings) play a decisive part. Note specifically the differences in the interpretation
of bit addresses for devices with "byte addressing mode" and devices with "word-oriented
IEC addressing mode". For example, in a byte addressing device, the number before
the point of bit address %IX5.5
addresses byte 5. On the other hand, in a word-addressed device, it addresses word
5. In contrast, addressing with a word or byte address is independent of the device
type: with %IW5
always word 5 is addressed and with byte address %IB5
always byte 5. Regardless of size and addressing mode, you can address different
memory cells therefore 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 ranges that are present in the case of byte addressing (see also the example below the table).
Regarding syntax, note that the IEC addressing mode is always word-oriented. In this case, the word number is located before the point and the bit number ofter the point.

n = byte number
Example of memory range overlapping in the case of the byte addressing mode
D0 contains B0 - B3, W0 contains B0 and B1, W1 contains B1 and B2, and W2 contains B2 and B3. Consequently, in order to avoid overlap, you must not use W1 (also D1, D2, and D3) for addressing.