At declaration, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 971

Advertising
background image

L-force | PLC Designer

Programming Reference

DMS 4.1 EN 03/2011 TD29

969

16.1.8

AT Declaration
In order to link a project variable directly with a definite address you can enter this
address in the declaration of the variable. Regard that the assignment of a variable to
an address also can be done in the mapping dialog of a device in the PLC configuration
(device tree).

Syntax:
<identifier> AT <address> : <data type>;
Keyword AT must be followed by an valid address. See the Address help page for
further information and consider possible overlaps in case of byte addressing mode.
This declaration allows to assign a meaningful name to an address. Any changes
concerning an incoming or outgoing signal may only be done in a single place (for
example in the declaration).

Notice the following when choosing a variable to be assigned to an address:
• Variables requiring an input cannot be accessed by writing. The compiler intercepts

this with error.

• AT declarations only can be used with local or global variables, not however with

input and output variables of POUs.

• AT declarations must not be used in combination with VAR RETAIN or VAR

PERSISTENT !

• If AT declarations are used with structure or function block members, all instances

will access the same memory location, which corresponds to "static variables" in
classic programming languages like e.g. C.

• The memory layout of structures is determined by the target too.
Examples:

counter_heat7 AT %QX0.0: BOOL;
lightcabinetimpulse AT %IX7.2: BOOL;
download AT %MX2.2: BOOL;

Note: If boolean variables are assigned to a Byte, Word or DWORD address, they
occupy one byte with TRUE or FALSE, not just the first bit after the offset!

Advertising