Vai al contenuto

Location

Variables can be represented symbolically, i.e. accessed through their identifier, or alternatively in a manner which directly represents the association of the data element with physical or logical locations in the programmable controller’s input, output, or memory structure.Direct representation of a single-element variable is provided by a special symbol formed by the concatenation of the percent sign “%”, a location prefix and a size prefix, and one or two unsigned integers, separated by periods (.).%location.size.index.index
  • location:
The location prefix may be one of the following:
Location prefixDescription
IInput location
QOutput location
MMemory location
  • size:
The size prefix may be one of the following:
Size prefixDescription
XSingle bit size
BByte (8 bits) size
WWord (16 bits) size
DDouble word (32 bits) size
LLong word (64 bits) size
RReal (32 bits) size
QLong real (64 bits) size
  • index.index:
This sequence of unsigned integers, separated by dots, specifies the actual position of the variable in the area specified by the location prefix.Example
Direct representationDescription
%MW4.6Word starting from the first byte of the 7th element of memory data block 4.
%IX0.4First bit of the first byte of the 5th element of input set 0.
Note that the absolute position depends on the size of the data block elements, not on the size prefix. As a matter of fact, %MW4.6 and %MD4.6 begin from the same byte in memory, but the former points to an area which is 16 bits shorter than the latter.For advanced users only: if the index consists of one integer only (no dots), then it loses any reference to data blocks, and it points directly to the byte in memory having the index value as its absolute address.
Direct representationDescription
%MW4.6Word starting from the first byte of the 7th element of data block 4 in memory.
%MW4Word starting from byte 4 of memory
ExampleVAR [RETAIN] [CONSTANT]XQuote : DINT;Enabling : BOOL := FALSE;TorqueCurrent AT %MW4.32 : INT;Counters : ARRAY [ 0 .. 9 ] OF UINT;Limits: ARRAY [0..3, 0..9]END_VAR
  • Variable XQuote is 32 bits long, and it is automatically allocated by the GF_ProjectVX codecompiler.
  • Variable Enabling is initialized to FALSE after target reset.
  • Variable TorqueCurrent is allocated in the memory area of the target device, and it takes 16 bits starting from the first byte of the 33rd element of datablock 4.
  • Variable Counters is an array of 10 independent variables of type unsigned integer.