Professional Documents
Culture Documents
Array An arrayconsists of several elements of the same data type. In the slide above,
you cansee the "Measuring_point" array with 10 elements of the REAL data
type.
Later, various measured values are to be stored in this array.
Define Array in DB The keyword for an array is "ARRAY[n..m]". The first element (n) and the last
element (m) are specified in the square brackets. In the example, [1..10] means
10 elements, whereby the first element is addressedwith the index[1] and the
last with the index [10]. Insteadof [1..10] you could, for example, define [0..9].
The first element would index [0] and the last element [9].
Data View To see the actual values stored in the individual elements, you select the menu
option View Data View to switch to another display. In "Data View", you will
find the values currently stored in the column "Actual Value".
SITRAIN Training for
Automation and Industrial Solutions
ST-SERV2
Storing Process Data Page 9
Structure The slide shows an example of a structure named "Motor_data". The structure
consists of several elements of different data types. The individual elements of a
structure canbe elementary or complex data types.
The access to the individual elements of a structure contains the structure
name. This makes the programeasier to read.
In order to be able to access the elements symbolically, the data block must be
given a symbol name, for example, "Drive_1".
Example: accessingelements of a structure using the load command "L"
L "Drive_1".Motor_data.rated_current
L "Drive_1".Motor_data. speed
The format is: block symbolic name, dot, structure name, dot, element name.
Note that the symbolic block name ("Drive_1") is enclosed in quotations,
indicating the name is fromthe global symbol editor. The structure name and
element names are not enclosed in quotations, because theyare symbols
defined in the data block and are not listed in the global symbol editor.
Define Structure The keyword for a structure is "STRUCT". The end of a structure is indicated
in DB by"END_STRUCT". A name is definedfor the structure (in the example:
"Motor_data").
Date: 18.11.2005
File: SERV2_03E.9
SIMATIC S7
Siemens AG 2005. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Example of a STRUCTURE
Display in the Program Editor (Data block DB 1):
Speed, data type Integer
Rated_current, data type Real
Starting_current, data type Real
Direction, data type Bool
Structure with the name "Motor_data"
(several elements
with different data types)
Motor_data
SITRAIN Training for
Automation and Industrial Solutions
ST-SERV2
Storing Process Data Page 10
Address Priority The address priority helps you to update the programcode when you make
changes in the symbol table, changes in the parameter names of data blocks or
functionblocks, or when you make changes to component names of referenced
UDTs or multi-instances.
What to Do You select the Blocks folderin the SIMATIC Manager and choose the menu
options Edit Object Properties to define the address priority. In the tab
"Address Priority" you canmake the desired settings.
Note Symbol priority means that symbols have priorityover absolute addresses.
Symbolic programming is recommended.
When you openblocks or generate sources, everyaddress is displayed with the
symbolic address that it had the last time it was saved.
When the block consistency is checked, if no user intervention is necessary, the
blocks are compiled such that the symbol of their address remains as it was the
last time it was saved.
Date: 18.11.2005
File: SERV2_03E.10
SIMATIC S7
Siemens AG 2005. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Defining the Address Priority (Symbolic/Absolute)
SITRAIN Training for
Automation and Industrial Solutions
ST-SERV2
Storing Process Data Page 11
Creating a DB You can insert a newdata block - as shown in the slide - in the SIMATIC