Data Structure Data Type; Plc Data Type - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Example: array
declarations
Example: array
addresses
4.4.7

Data structure data type

You can use the data type "Struct" to define a structure of data consisting of other data
types. The struct data type can be used to handle a group of related process data as a single
data unit. A Struct data type is named and the internal data structure declared in the data
block editor or a block interface editor.
Arrays and structures can also be assembled into a larger structure. A structure can be
nested up to eight levels deep. For example, you can create a structure of structures that
contain arrays.
4.4.8

PLC data type

The PLC data type editor lets you define data structures that you can use multiple times in
your program. You create a PLC data type by opening the "PLC data types" branch of the
project tree and double-clicking the "Add new data type" item. On the newly created PLC
data type item, use two single-clicks to rename the default name and double-click to open
the PLC data type editor.
You create a custom PLC data type structure using the same editing methods that are used
in the data block editor. Add new rows for any data types that are necessary to create the
data structure that you want.
If a new PLC data type is created, then the new PLC type name will appear in the data type
selector drop drop-lists in the DB editor and code block interface editor.
Potential uses of PLC data types:
● PLC data types can be used directly as a data type in a code block interface or in data
● PLC data types can be used as a template for the creation of multiple global data blocks
For example, a PLC data type could be a recipe for mixing colors. You can then assign this
PLC data type to multiple data blocks. Each data block can then have the variables adjusted
to create a specific color.
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
ARRAY[1..20] of REAL
ARRAY[-5..5] of INT
ARRAY[1..2, 3..4] of CHAR
ARRAY1[0]
ARRAY2[1,2]
ARRAY3[i,j]
blocks.
that use the same data structure.
One dimension, 20 elements
One dimension, 11 elements
Two dimensions, 4 elements
ARRAY1 element 0
ARRAY2 element [1,2]
If i =3 and j=4, then ARRAY3 element
[3, 4] is addressed
PLC concepts
4.4 Data types
117

Advertisement

Table of Contents
loading

Table of Contents