Addresses Permalink

CAUTION

CAUTION
CAUTION
CAUTION

CAUTION

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>

% <address>

Required

Address in the memory area

% <memory area prefix> <size prefix> <memory position>

<memory area prefix>

Required

  • I: Input memory area

    Memory area for input signals and inputs

    For physical inputs via input drivers and sensors

  • Q: Output memory area

    Memory area for output signals and outputs

    For physical outputs via output drivers and actuators

  • M: Flag memory area

<size prefix>

Optional

  • No size prefix: bit

    Single bit

  • X: Bit

    Single bit

  • B: Byte

    8-bit data width

  • W: Word

    16-bit data width

  • D: Dword

    32-bit data width

<memory position>

<position number> . <bit position number>

Example: %IB2.4 stands for the 5th bit of the 3rd byte

<position number>

Required

The numbering depends on the target system and starts at 0.

. <bit position number>

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.

Examples

%QX7.5

%Q7.5

Single bit address of the output bit 7.5

%IW215

Word address of the input word 215

%QB7

Byte address of the output byte 7

%MD48

Address of a double word at memory position 48 in flag memory

%IW2.5.7.1

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 xActuator affects the range from QX0.0 to QX0.7.

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.