A direct address specified in EcoStruxure Machine Expert contains the following information:
oInformation on the memory location.
oMemory format (size)
oOffset of the memory location. The offset is specified by an integer number, which in case of a bit address is followed by a dot and a number for the position of the bit.
%<memory area prefix><size prefix><number|.number|.number....>
The following memory area prefixes are supported:
I |
input (physical inputs via input driver, sensors) |
Q |
output (physical outputs via output driver, actors) |
M |
memory location |
The following size prefixes are supported:
X |
single bit |
None |
single bit |
B |
byte (8 bits) |
W |
word (16 bits) |
D |
double word (32 bits) |
Example address |
Description |
---|---|
%QX7.5 |
output bit 7.5 |
%Q7.5 |
|
%IW215 |
input word 215 |
%QB7 |
output byte 7 |
%MD48 |
double word in memory position 48 in the memory location |
ivar AT %IW0: WORD; |
example of a variable declaration including an address assignment For further information, refer to the AT Declaration chapter. |
NOTE: The memory size for input, output, and memory data (declarations with AT %I, %Q and %M) is predefined by the target device and can be overwritten in the properties of an application object for PacDrive controllers (PacDrive LMC Eco, PacDrive LMC Pro/Pro2).
Byte Addressing Mode and Word Addressing Mode
Devices either use byte addressing mode or word addressing mode.
Examples
Mode |
Example |
---|---|
Byte addressing |
ADR(%IW1) = ADR(%IB1) |
Word addressing |
ADR(%IW1) = ADR(%IB2) |
The range for the second element of the bit address that is the number following the dot, is as follows:
obyte addressing mode: 0...7
oword addressing mode: 0...15
Also for the handling of bit addresses, you can configure the devices differently. They are then interpreted correspondingly by the EcoStruxure Machine Expert compiler.
Example: In a byte-addressing device, the bit address %IX2.5 addresses byte 2 (IB2). In a word-addressing device, however, it addresses word 2, which refers to a different location within the memory.
NOTE: Boolean values are allocated bytewise if no explicit single-bit address is specified. Example: A change in the value of varbool1 AT %QB7 affects the range from QX0.0 to QX0.7.