PLC concepts
4.4 Data types
Table 4- 34
Valid ASCII control characters
Control characters
$L or $l
$N or $n
$P or $p
$R or $r
$T or $t
$$
$'
4.4.6
Array data type
Arrays
You can create an array that contains multiple elements of the same data type. Arrays can
be created in the block interface editors for OB, FC, FB, and DB. You cannot create an array
in the PLC tags editor.
To create an array from the block interface editor, name the array and choose data type
"Array [lo .. hi] of type", then edit "lo", "hi", and "type" as follows:
● lo - the starting (lowest) index for your array
● hi - the ending (highest) index for your array
● type - one of the data types, such as BOOL, SINT, UDINT
Table 4- 35
ARRAY data type rules
Data Type
Array syntax
ARRAY
Name [index1_min..index1_max, index2_min..index2_max] of <data type>
All array elements must be the same data type.
•
The index can be negative, but the lower limit must be less than or equal to the upper limit.
•
Arrays can have one to six dimensions.
•
Multi-dimensional index min..max declarations are separated by comma characters.
•
Nested arrays, or arrays of arrays, are not allowed.
•
The memory size of an array = (size of one element * total number of elements in array)
•
Array index
Constant or
variable
116
ASCII Hex value
0A
0A and 0D
The new line shows two characters in the
0C
0D
09
24
27
Valid index data types
USInt, SInt, UInt, Int, UDInt,
DInt
Control function
Line feed
Line break
string.
Form feed
Carriage return (CR)
Tab
Dollar sign
Single quote
Array index rules
Value limits: -32768 to +32767
•
Valid: Mixed constants and variables
•
Valid: Constant expressions
•
Not valid: Variable expressions
•
Examples
'$LText', '$0AText'
'$NText', '$0A$0DText'
'$PText', '$0CText'
'$RText','$0DText'
'$TText', '$09Text'
'100$$', '100$24'
'$'Text$'','$27Text$27'
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG