Declaration of STRING variables (incl. access)
Syntax |
---|
|
Meaning |
---|
Declaration of one or more variables of →data type The length and the initial value may be a →constant expression. |
|
The declaration of STRING
variables is possible within these sections:
(Consult the respective description of the section about possibly additional possibilities for the variable.)
Section |
The declaration of the STRING variable is done as: |
---|---|
|
internal variable (see "Declaration of internal variables in ST") |
|
input variable (see "Declaration of input variables in ST") |
|
output variable (see "Declaration of output variables in ST") |
|
in-out variable (see ""Declaration of in-out variables in ST) |
|
global variable (see "Declaration of external variables in ST") |
|
external variable (see "Declaration of external variables in ST") |
|
temporary variable (see "Declaration of temporary variables in ST") |
|
a→user-defined data type or as an element of it (see "Declaration of a data type in ST") |
Example |
---|
|
Accessing the STRING variables
If you want to access single characters of a STRING
variable within →assignments, enter the name of the variable (e.g. var4
) and the corresponding position of the character (e.g. 2
) enclosed in brackets (e.g. var4[2]
). The positions are starting with "1".
Assignments of a STRING
variable to another STRING
variable with different maximum length is possible. If the STRING
variable to which the assignment is executed has a smaller length than the STRING
variable from which the assignment is executed, Neuron Power Engineer executes the assignment only until the maximum length of the STRING
variable to which the assignment is executed. Moreover, the output ENO
of the embracing →POU is additionally set to value FALSE
(or an equivalent).
If the character combination |
In case of a smaller length of the assigned STRING
variable and a character combination '$00'
in it, Neuron Power Engineer executes the assignment only until the maximum length of the STRING
variable to which the assignment is excecuted. In this case the output ENO
of the embracing POU is not set to value FALSE
(or an equivalent).
Examples |
---|
|
Declaring and accessing STRING variables of ARRAY data type
If you want to declare a STRING
variable that is based on an ARRAY data type, enter the STRING
data type with the maximum length as data type when declaring the ARRAY data type.
Example for declaring |
---|
|
You may access single characters of such variables by means of the following construction:
Example for accessing |
---|
|