EasyManua.ls Logo

Siemens SIMATIC S7-1200 - 8.6.9.3 CountOfElements (Get number of ARRAY elements)

Siemens SIMATIC S7-1200
1614 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Basic instructions
8.6 Move operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
287
8.6.9.3
CountOfElements (Get number of ARRAY elements)
You can use the "Get number of ARRAY elements" instruction to query how many Array
elements are in a tag pointed to by a Variant.
If it is a one-dimensional ARRAY, the instruction returns the difference between the high and
low limit +1 is output. If it is a multi-dimensional ARRAY, the instruction returns the product of
all dimensions.
Table 8- 97 CountOfElements instruction
LAD / FBD
SCL
Description
Result := CountOfElements(
_variant_in_);
Counts the number of array elements at
the array pointed to by the IN parameter.
Note
If the Variant points to an Array of Bool, the instruction counts the fill elements to the nearest
byte boundary. For example, the instruction returns 8 as the count for an Array[0..1] of Bool.
Table 8- 98 Parameters for the CountOfElements instruction
Parameter
Data type
Description
IN Variant Tag with array elements to be
counted
RET_VAL
UDint
Instruction result
Table 8- 99 ENO status
ENO
Condition
Result
1 No error Instruction returns the number of array ele-
ments.
0 Enable input EN has the signal state "0" or the Variant
does not point to an array.
Instruction returns 0.

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals