Errors and warnings in ST
This section quotes all errors and warnings that might occur when entering the ST-code or when entering the FBD-logic in the FBD-editor.
However, it is possible that errors/warnings occur for the ST-editor as when validating the application. See "Errors and warnings when validating the application" for these messages and their appropriate solution.
Missing IEC-keyword or IEC-identifier
Solution: Complete the syntax so that it is a valid object. See "Supported ST-syntax"
Examples:
Faulty code |
Correct code |
Details on solution |
PROGRAM test VAR var1 : BOOL END_VAR END_PROGRAM |
PROGRAM test VAR var1 : BOOL; END_VAR END_PROGRAM |
In the declaration of the →variables, enter the missing character ";". |
PROGRAM test VAR
var1 INT;
END_VAR END_PROGRAM |
PROGRAM test VAR
var1 : INT;
END_VAR END_PROGRAM |
In the declaration of the variables, enter the missing character ":" to assign the →data type. |
PROGRAM test VAR var1 : BOOL; END_PROGRAM |
PROGRAM test VAR var1 : BOOL; END_VAR END_PROGRAM |
In the declaration of the variables, enter END_VAR to conclude the declaration. |
PROGRAM test VAR var1 : BOOL; END_VAR var1 := 1 END_PROGRAM |
PROGRAM test VAR var1 : BOOL; END_VAR var1 := 1; END_PROGRAM |
In the →assignment, enter the missing character ";" to conclude the statement. |
PROGRAM test VAR var1 : BOOL; END_VAR var1 1; END_PROGRAM |
PROGRAM test VAR var1 : BOOL; END_VAR var1 := 1; END_PROGRAM |
In the assignment, enter the missing assignment operator ":=". |
Unexpected character 'name'
Solution: Delete the faulty character or replace it by the correct syntax. See troubleshooting article "Message 'Unexpected character' is displayed for initial value within the ST-editor", if the message is displayed for an initial value.
Examples:
Faulty code |
Correct code |
Details on solution |
#test prog__ |
PROGRAM Test END_PROGRAM |
|
testprog END_PROGRAM |
PROGRAM testprog END_PROGRAM |
|
Test END_PROGRAM |
PROGRAM Test END_PROGRAM |
|
PROGRAM test END_PROGRAM; |
PROGRAM test END_PROGRAM |
At the end of the declaration, delete the invalid character. |
FUNCTION END_FUNCTION |
FUNCTION Simple1 END_FUNCTION |
In the declaration of a function, enter a name that must be an IEC-identifier. |
PROGRAM __Motor END_PROGRAM |
PROGRAM _Motor END_PROGRAM |
In the declaration of a →program, enter an →IEC-identifier as name. |
FUNCTION_BLOCK __Control END_FUNCTION_BLOCK |
FUNCTION_BLOCK _Control END_FUNCTION_BLOCK |
In the declaration of a →function block, enter an IEC-identifier as name. |
FUNCTION __Simple END_FUNCTION |
FUNCTION _Simple END_FUNCTION |
In the declaration of a →function, enter an IEC-identifier as name. |
FUNCTION Fun3 ;: END_FUNCTION |
FUNCTION Fun3 END_FUNCTION |
|
PROGRAM test VAR __var1 : INT; END_VAR END_PROGRAM |
PROGRAM test VAR _var1 : INT; END_VAR END_PROGRAM |
In the declaration of the →variables, enter an IEC-identifier as name. |
PROGRAM test VAR var1 var2 : INT; END_VAR END_PROGRAM |
PROGRAM test VAR var1, var2 : INT; END_VAR END_PROGRAM |
In the declaration of more variables, enter the missing character "," to separate the variables from each other. |
PROGRAM test VAR var1, __var2 : INT; END_VAR END_PROGRAM |
PROGRAM test VAR var1, var2 : INT; END_VAR END_PROGRAM |
In the declaration of the variables, delete the faulty character or replace it by characters so that an IEC-identifier is entered as name. |
PROGRAM test VAR var1, var2__ : BOOL; END_VAR END_PROGRAM |
PROGRAM test VAR var1, var2 : BOOL; END_VAR END_PROGRAM |
In the declaration of the variables, delete the unexpected character inserted before the character ":". You might have to delete several characters so that the syntax becomes valid. |
PROGRAM test VAR : BOOL; END_VAR END_PROGRAM |
PROGRAM test VAR var1 : BOOL; END_VAR END_PROGRAM |
Correct the declaration of the variables so that it is a valid declaration. |
PROGRAM test VAR x , y : INT__ ; END_VAR END_PROGRAM |
PROGRAM test VAR x , y : INT; END_VAR END_PROGRAM |
Correct the assigned data type so that its spelling matches the supported data types. |
PROGRAM test VAR var1 : BOOL; END_VAR var1 := ; END_PROGRAM |
PROGRAM test VAR var1 : BOOL; END_VAR var1 := 1; END_PROGRAM |
In the →assignment, enter the expression on the right side of the assignment operator ":=". |
PROGRAM test VAR var1 : BOOL; END_VAR var1 : 1; END_PROGRAM |
PROGRAM test VAR var1 : BOOL; END_VAR var1 := 1; END_PROGRAM |
In the assignment, replace the faulty character by the assignment operator ":=". |
PROGRAM test VAR var1 : BOOL; END_VAR var1 := 1, END_PROGRAM |
PROGRAM test VAR var1 : BOOL; END_VAR var1 := 1; END_PROGRAM |
In the assignment, replace the faulty character by character ";" to conclude the statement. |
PROGRAM test VAR a, b : BOOL; END_VAR a := b,; END_PROGRAM |
PROGRAM test VAR a, b : BOOL; END_VAR a := b; END_PROGRAM |
In the assignment, delete the invalid character before the character ";". |
PROGRAM prog1 VAR x , y : BOOL ; END_VAR x := TRUE__; END_PROGRAM |
PROGRAM prog1 VAR x , y : BOOL ; END_VAR x := TRUE; END_PROGRAM |
In the assignment, enter one of the possible constructs. See "Supported ST-syntax" for those constructs. |
PROGRAM Prog1 Fun1( END_PROGRAM FUNCTION Fun1 END_FUNCTION |
PROGRAM Prog1 Fun1(); END_PROGRAM FUNCTION Fun1 END_FUNCTION |
|
PROGRAM Prog1 VAR x : BOOL; END_VAR Fun2() := x; END_PROGRAM FUNCTION Fun2 : BOOL END_FUNCTION |
PROGRAM Prog1 VAR x : BOOL; END_VAR Fun2(); END_PROGRAM FUNCTION Fun2 : BOOL END_FUNCTION |
For the function call, enter an identifier existing for functions (as shown in the example). Alternative: Enter the missing declaration for the function. |
PROGRAM Prog1 Fun__1(); END_PROGRAM FUNCTION Fun1 END_FUNCTION |
PROGRAM Prog1 Fun1(); END_PROGRAM FUNCTION Fun1 END_FUNCTION |
For the function call, enter an identifier existing for functions (as shown in the example). Alternative: Enter the missing declaration for the function. |
PROGRAM Prog1 VAR x : BOOL; END_VAR Fun2() := x; END_PROGRAM FUNCTION Fun2 : BOOL END_FUNCTION |
PROGRAM Prog1 VAR x : BOOL; END_VAR Fun2(); END_PROGRAM FUNCTION Fun2 : BOOL END_FUNCTION |
|
FUNCTION Fun1 : BO__OL END_FUNCTION |
FUNCTION Fun1 : BOOL END_FUNCTION |
|
PROGRAM Test VAR var1 : ANY_INT; END_VAR END_PROGRAM |
PROGRAM Test VAR var1 : INT; END_VAR END_PROGRAM |
Instead of the →generic data type, enter an elementary data type (see "Supported data types (in ST)"). |
PROGRAM END_PROGRAM |
PROGRAM Motor1 END_PROGRAM |
In the declaration of a →program, enter a name that must be an →IEC-identifier. |
FUNCTION_BLOCK END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control1 END_FUNCTION_BLOCK |
In the declaration of a →function block, enter a name that must be an IEC-identifier. |
FUNCTION Fun1 FUNCTION |
FUNCTION Fun1 END_FUNCTION |
In the declaration of the →function, enter the keyword END_FUNCTION to conclude the declaration. |
PROGRAM test VAR var1, : BOOL; END_VAR END_PROGRAM |
PROGRAM test VAR var1, var2 : BOOL; END_VAR END_PROGRAM |
In the declaration of the variables, insert a variable or delete the character "," after the variable already declared. |
Could not resolve reference to 'name'. A variable with this name does not exist. or
Could not resolve reference to "name". A method with this name does not exist.
Solution: Complete the syntax so that it is a valid object. See "Supported ST-syntax"
Example:
Faulty code |
Correct code |
Details on solution |
PROGRAM prog1 VAR x : BOOL; END_VAR x := y; END_PROGRAM |
PROGRAM prog1 VAR x , y : BOOL; END_VAR x := y; END_PROGRAM |
In the declaration of the →variables, enter the mentioned expression so that the expression is a declared variable (as shown in the example). |
Could not resolve reference to 'name'. A function or function block instance with this name does not exist.
Solution: Complete the syntax so that it is a valid object. See "Supported ST-syntax"
Example:
Faulty code |
Correct code |
Details on solution |
PROGRAM prog1 MyFun(); END_PROGRAM |
PROGRAM prog1 MyFun(); END_PROGRAM FUNCTION MyFun END_FUNCTION |
Declare the required →POU. |
Could not resolve reference to 'name'. The function with this name has no return value. or
Could not resolve reference to 'name'. The method with this name has no return value.
Solution: Complete the syntax so that it is a valid object. See "Supported ST-syntax"
Example:
Faulty code |
Correct code |
Details on solution |
FUNCTION Simple Simple := 1; END_Function |
FUNCTION Simple : INT Simple := 1; END_Function |
In the declaration of the →function, enter the data type of the return value because a return value is assigned within the function
(as shown in the example). The same is valid for a →method. |
Missing POU or data type: 'name'
Solution: Declare the missing →POU (see example) or the missing →data type. Alternative, if the POU or the data type is not needed: Delete the element that is highlighted as faulty.
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR fb : MyFB; END_VAR END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control VAR fb : MyFB; END_VAR END_FUNCTION_BLOCK FUNCTION_BLOCK MyFB END_FUNCTION_BLOCK |
Unexpected end of file
Solution: Complete the syntax so that it is a valid object. See "Supported ST-syntax"
Examples:
Faulty code |
Correct code |
PROGRAM test VAR Var1 : BOOL; END_VAR |
PROGRAM test VAR Var1 : BOOL; END_VAR END_PROGRAM |
FUNCTION_BLOCK Control |
FUNCTION_BLOCK Control END_FUNCTION_BLOCK |
Identifier "name" already declared
Solution: In the declaration, enter an →IEC-identifier as name that has not been used yet.
Examples:
Faulty code |
Correct code |
PROGRAM test1 VAR var1, var1 : INT; END_VAR END_PROGRAM |
PROGRAM test1 VAR var1, var2 : INT; END_VAR END_PROGRAM |
PROGRAM test2 END_PROGRAM PROGRAM test2 END_PROGRAM |
PROGRAM test2a END_PROGRAM PROGRAM test2b END_PROGRAM |
Value out of range
Solution: Enter a smaller value so that the value is within the valid range.
Example:
Faulty code |
Correct code |
Details on solution |
PROGRAM Test VAR Var1 : STRING[32768]; END_VAR END_PROGRAM |
PROGRAM Test VAR Var1 : STRING[200]; END_VAR END_PROGRAM |
Enter a length < 32.768 for the STRING variable – see "Declaration of STRING variables (incl. access)". |
Type mismatch: An error occurred while resolving an expression
Solution: Correct the faulty →expression so that it matches the required →data type. Alternative: Adjust the data type accordingly.
Examples:
Faulty code |
Correct code |
Details on solution |
PROGRAM Test VAR Var1 : SINT; END_VAR Var1 := 200; END_PROGRAM |
PROGRAM Test VAR Var1 : SINT; END_VAR Var1 := 100; END_PROGRAM |
In the →assignment, enter →literals possible according to the declared data type and not outside of the lower and upper limit. See "Supported data types (in ST)" for lower and upper limits of the data types. |
PROGRAM Test VAR Var1 : SINT; END_VAR Var1 := DINT#100; END_PROGRAM |
PROGRAM Test VAR Var1 : SINT; END_VAR Var1 := SINT#100; END_PROGRAM |
|
PROGRAM Test VAR Var1 : SINT; END_VAR Var1 := DINT#100; END_PROGRAM |
PROGRAM Test VAR Var1 : DINT; END_VAR Var1 := SINT#100; END_PROGRAM |
Alternative: Enter a typed literal according to a data type for which the →IEC-standard allows an implicit conversion. |
PROGRAM Test VAR Var1 : SINT; Var2 : DINT; END_VAR Var1:= Var2; END_PROGRAM |
PROGRAM Test VAR Var1 : SINT; Var2 : DINT; END_VAR Var2:= Var1; END_PROGRAM |
|
PROGRAM Test VAR Var1 : BOOL; END_VAR Var1 := 2; END_PROGRAM |
PROGRAM Test VAR Var1 : BOOL; END_VAR Var1 := 0; END_PROGRAM |
|
PROGRAM Test VAR Var1 : BOOL := 7; END_VAR END_PROGRAM |
PROGRAM Test VAR Var1 : BOOL := 1; END_VAR END_PROGRAM |
|
PROGRAM Test VAR RVAR1 : REF_TO INT; RVAR2 : REF_TO DINT; VAR1 : INT; VAR2 : DINT; END_VAR RVAR1 := 0; RVAR1 := REF(VAR2); END_PROGRAM |
PROGRAM Test VAR RVAR1 : REF_TO INT; RVAR2 : REF_TO DINT; VAR1 : INT; VAR2 : DINT; END_VAR RVAR1 := NULL; RVAR1 := REF(VAR1); END_PROGRAM |
Details on using reference variables are given under "Declaration of reference variables (incl. assignments to them)". |
Parameter has already been assigned
Solution: In the formal →call, enter each →input variable and →output variable just once. If you want for brush up your knowledge about formal and non-formal call, see FAQ-article "When to use a formal call? When to use a non-formal call?".
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; IN2 : INT; T1 : TIME; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Inst1 : Control; END_VAR Inst1 (IN1:=10,IN1 := 20,T1 := T#3ms); END_PROGRAM |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; IN2 : INT; T1 : TIME; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Inst1 : Control; END_VAR Inst1 (IN1:=10,IN2 := 20,T1 := T#3ms); END_PROGRAM |
Too many parameters
Solution: In the non-formal →call, enter
the same number of input variables as given in the declaration
. If you want for brush up your knowledge about formal and non-formal call, see FAQ-article "When to use a formal call? When to use a non-formal call?".
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; IN2 : INT; T1 : TIME; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Inst1 : Control; END_VAR Inst1 (10,20,30,T#3ms); END_PROGRAM |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; IN2 : INT; T1 : TIME; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Inst1 : Control; END_VAR Inst1 (10,20,T#3ms); END_PROGRAM |
Too few parameters
Solution. if it is a user block: In the non-formal →call, enter
the same number of input variables as given in the declaration
. If you want for brush up your knowledge about formal and non-formal call, see FAQ-article "When to use a formal call? When to use a non-formal call?".
Solution, if it is an extensible system block: Enter values for the input variables that are required for the correct functionality of the system block. Usually, values for the first 2 inputs are required.
Example:
Faulty code |
Correct code |
Details on solution |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; IN2 : INT; T1 : TIME; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Inst1 : Control; END_VAR Inst1(10,T#3ms); END_PROGRAM |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; IN2 : INT; T1 : TIME; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Inst1 : Control; END_VAR Inst1(10,20,T#3ms); END_PROGRAM |
Alternative: Replace the non-formal call by a formal call.
You can omit inputs/outputs within the
parameter
list, if it is a formal call.
See e.g. "Call of function in ST" about the behavior of omitted input variables. |
AND(FALSE); |
AND(FALSE,TRUE); |
Alternative: Replace the non-formal call by a formal call.
You can omit inputs/outputs within the
parameter
list, if it is a formal call.
See e.g. "Call of function in ST" about the behavior of omitted input variables. |
Unable to find library ''name''.
or
"name" is not a valid property for a library block.
or
Property "name" must be of data type STRING.
or
Element "name" of property "name" is invalid
Solution: Contact the manufacturer of the used library or block. Include your contact information, information on what you were doing in logi.CAD 3 and all messages listed in the Error Log view and/or Problems view.
This message indicates that the system functions or system function blocks of logi.CAD 3(e.g. the IEC-blocks) contain an incorrect reference to the system library or an incorrect property. Usually, this message does not occur when handling the blocks as described in the user documentation.
Library ''name'' does not exist
Solution: Delete the statement with the faulty library within the code or replace it by the correct syntax.
Example:
Faulty code |
Correct code |
Details on solution |
{Library:=MyLib} FUNCTION Simple END_FUNCTION |
FUNCTION Simple END_FUNCTION |
This message indicates that the code in your ST-objects or PLC-objects contain an incorrect reference to the system library. Usually, you do not need any reference to the system library in your code. |
Name of variable is identical to the one of the function
Solution: In the declaration, enter an →IEC-identifier as name that has not been used yet.
Example:
Faulty code |
Correct code |
FUNCTION MyFun VAR MyFun : INT; END_VAR END_FUNCTION |
FUNCTION MyFun VAR MyVar : INT; END_VAR END_FUNCTION |
Expression has no return value
Solution: Enter a →data type at declaration of the →function and/or assign a return value to the function.
Examples:
Faulty code |
Correct code |
Details on solution |
PROGRAM Test VAR RC:INT; END_VAR RC:=call(); END_PROGRAM FUNCTION call END_FUNCTION |
PROGRAM Test VAR RC:INT; END_VAR RC:=call(); END_PROGRAM FUNCTION call:INT END_FUNCTION |
Enter a data type at the declaration of the function. |
PROGRAM Test if FunTest() = 1 then A := 5; end_if; END_PROGRAM FUNCTION FunTest END_FUNCTION |
PROGRAM Test if FunTest() = 1 then A := 5; end_if; END_PROGRAM FUNCTION FunTest : INT FunTest := 1; END_FUNCTION |
Enter a data type at the declaration of the function and assign a return value to the function. |
Variable "name" is defined as constant
Solution: Within the declaration of the →variables, delete the keyword CONSTANT (see example). Alternative: Delete the →assignment.
Example:
Faulty code |
Correct code |
PROGRAM Timer VAR CONSTANT var1 : INT; END_VAR var1 := 3; END_PROGRAM |
PROGRAM Timer VAR var1 : INT; END_VAR var1 := 3; END_PROGRAM |
Solution 2, if the message is displayed for the assignment to a step marker or a step timer: Correct the assignment so that logi.CAD 3 does not write to these properties anymore.
Cannot resolve type of language element.
Solution 1: Check whether there are other messages hinting at the error.
Solution 2, if you do not have sufficient hints to eliminate the error: Contact the support team of logi.cals. Include your contact information, information on what you were doing in logi.CAD 3 and all messages listed in
the Error Log view, Problems view and/or PLC Logging view.
Include the entered code as well.
Variables with generic data types cannot be initialized.
This message applies only to system blocks.
Solution: Instead of the →generic data type, enter an elementary data type (see "Supported data types (in ST)").
Array index "number" is out of bounds ["number", "number"].
Solution: Enter an →array →subscript in the →assignment so that it is within the index subrange (see example). Alternative: Correct the index subrange, defined within the declaration of the →array data type.
Example:
Faulty code |
Correct code |
TYPE MyType: ARRAY [1..8] OF INT; END_TYPE PROGRAM Test VAR a1 : MyType; END_VAR a1[-6] := 1; END_PROGRAM |
TYPE MyType: ARRAY [1..8] OF INT; END_TYPE PROGRAM Test VAR a1 : MyType; END_VAR a1[6] := 1; END_PROGRAM |
Invalid
array range
Solution: Correct the index subrange. See "Declaration of an ARRAY data type in ST" for the specifications on an index subrange.
Example:
Faulty code |
Correct code |
TYPE MyType: ARRAY [3..0] OF INT; END_TYPE |
TYPE MyType: ARRAY [0..3] OF INT; END_TYPE |
Index access for variable "name" is not allowed in this form.
Solution: Correct the →assignment so that it fits the declaration (see example). Alternative: Correct the declaration so that there is an appropriate array or a string variable. See "Declaration of an ARRAY data type in ST" and/or "Declaration of STRING variables (incl. access)" for information on those variables.
Example:
Faulty code |
Correct code |
PROGRAM Text VAR a1 : REAL; END_VAR a1[0] := 1.5; END_PROGRAM |
PROGRAM Text VAR a1 : REAL; END_VAR a1 := 1.5; END_PROGRAM |
Functions
may
not
return
function
blocks or interfaces
.
Solution: In the declaration of the →function, enter a supported data type (instead of the function block or →interface),
if a return value is assigned within a function
.
Example:
Faulty code |
Correct code |
FUNCTION test : TON END_FUNCTION |
FUNCTION test : INT END_FUNCTION |
"name" must not be used because it is a reserved keyword.
Solution: Correct the faulty term in the code so that it is not a keyword anymore. See "Reserved keywords in ST" for a list of the keywords that must not be used.
Assignment to input variable "name" is not allowed.
Solution: Correct the code so that it is not an →input variable any longer (see example) or the code does not write to the input variable any longer.
Example:
Faulty code |
Correct code |
FUNCTION Test VAR_INPUT R1 : INT; END_VAR R1 := 20; END_FUNCTION |
FUNCTION Test VAR_OUTPUT R1 : INT; END_VAR R1 := 20; END_FUNCTION |
Only numeric data types are allowed when using the mathematical operator symbol.
Solution: Correct the code so that the →variables/→literals within the faulty expression are using a →numeric data type (see example). Alternative: Do not use a mathematical operator or convert the variable/literal explicitly by using a Convert function into a numeric value.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR X, B : BYTE; END_VAR X := X ** B; END_PROGRAM |
PROGRAM Test VAR X, B : INT; END_VAR X := X ** B; END_PROGRAM |
Only numeric or time data types are allowed when using the mathematical operator symbol.
Solution: Correct the code so that the variables/literals within the faulty expression are using a numeric data type or the data type TIME (see example). Alternative: Do not use a mathematical operator or convert the variable/literal explicitly by using a Convert function into a numeric or time value.
Example:
Faulty code |
Correct code |
Details on solution |
PROGRAM Test VAR X, B : BYTE; END_VAR X := X + B; END_PROGRAM |
PROGRAM Test VAR X, B : TIME; END_VAR X := X + B; END_PROGRAM |
Mind the correct combination of the →literals/→variables for multiplication, division, addition and subtraction, if the operation is done for literals/variables of data type TIME. More information can be found under "Operators in ST". |
Only integer data types are allowed when using the mathematical operator symbol.
Solution: Correct the code so that the variables/literals within the faulty expression are using a data type belonging to the →generic data type ANY_INT (see example). Alternative: Do not use a mathematical operator or convert the variable/literal explicitly by using a Convert function into an integer value.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR X, B : BYTE; END_VAR X := X MOD B; END_PROGRAM |
PROGRAM Test VAR X, B : INT; END_VAR X := X MOD B; END_PROGRAM |
Only bitstring data types are allowed when using Boolean operators.
Solution: Correct the code so that the →variables/→literals within the faulty expression are using a →bit string data type (see example). Alternative: Do not use a Boolean operator or convert the variable/literal explicitly by using a Convert function into a bit string value.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR X, A, B : INT; END_VAR IF A & B THEN X := 0; END_IF; END_PROGRAM |
PROGRAM Test VAR A, B : BOOL; X : INT; END_VAR IF A & B THEN X := 0; END_IF; END_PROGRAM |
When using comparison operators, the data type must match or must be implicitly convertible.
Solution: Correct the code so that the →variables/→literals within the faulty expression are using the same →data type (see example) or data types that may be converted implicitly. Alternative: Do not use an operator for comparison/equality/inequality or convert the variable/literal explicitly by using a Convert function into the required data type format.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR X, A : INT; B : SINT; END_VAR IF A > B THEN X := 0; END_IF; END_PROGRAM |
PROGRAM Test VAR X, A, B : INT; END_VAR IF A > B THEN X := 0; END_IF; END_PROGRAM |
String index "number" is out of bounds ["number", "number"].
Solution: In the →assignment, enter a position for the STRING variable that resides within the maximum length (see example). Alternative: In the declaration, correct the maximum length of the STRING variable. See "Declaration of STRING variables (incl. access)" for more information.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR var1 : STRING[4]; END_VAR var1[7] := 'A'; END_PROGRAM |
PROGRAM Test VAR var1 : STRING[4]; END_VAR var1[4] := 'A'; END_PROGRAM |
Strings with undefined length are not allowed.
Solution: Enter a maximum length for the STRING variable. See "Declaration of STRING variables (incl. access)" for more information.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR var1 : STRING; END_VAR END_PROGRAM |
PROGRAM Test VAR var1 : STRING[4]; END_VAR END_PROGRAM |
Initial value "name" of length "number" does not fit into STRING["number"].
Solution: Correct the initial value so that it fits the maximum length (see example). Alternative: Correct the maximum length for the STRING variable so that the initial value is not faulty any longer. See "Declaration of STRING variables (incl. access)" for more information.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR var1 : STRING[2] := 'abc'; END_VAR END_PROGRAM |
PROGRAM Test VAR var1 : STRING[2] := 'ab'; END_VAR END_PROGRAM |
References to function block types or interfaces are not allowed.
Solution: Do not use references for →function block types or →interfaces but e.g. declare a function block instance. See "Declaration of reference variables (incl. assignments to them)" about possible reference declarations.
Platform "BuiltInPlc" is not allowed here.
Solution: Best practice is to use the content assist in order to enter the requested platforms for →C-blocks.
See section "Integrating C-code and/or C++-code into the application (deprecated)" for points to observe when creating C-blocks.
EN/ENO in REF() is not allowed.
Solution
: Delete the parameters for
the
execution control parameters EN and ENO within REF(...). See "Declaration of reference variables (incl. assignments to them)" about possible assignments to references.
The assignment of the variable "name" to VAR_IN_OUT "name" of the block is not allowed. Reason: It is either a temporary variable within a function block or a variable within a function that is not an external variable.
Solution
: Correct the assignment so that a variable of a different type is assigned. See "→Variable" for a list of the possible variable types (incl. links for details).
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK MyFB VAR_TEMP Var1 : int; END_VAR VAR myvar : int; END_VAR GET_BYTE_REF(IN:=Var1); END_FUNCTION_BLOCK |
FUNCTION_BLOCK MyFB VAR Var1 : int; END_VAR VAR myvar : int; END_VAR GET_BYTE_REF(IN:=Var1); END_FUNCTION_BLOCK |
FUNCTION test1 VAR inString : STRING[10]; resultRefToByte : REF_TO BYTE; END_VAR resultRefToByte := GET_BYTE_REF(IN := inString); END_FUNCTION |
FUNCTION test1 VAR_EXTERNAL inString : STRING[10]; END_VAR VAR resultRefToByte : REF_TO BYTE; END_VAR resultRefToByte := GET_BYTE_REF(IN := inString); END_FUNCTION |
The assignment to VAR_IN_OUT "name" of the block must be a non-temporary variable.
Solution
: Correct the assignment so that an appropriate variable is assigned.
Example:
Faulty code |
Correct code |
FUNCTION MyFun : REF_TO BYTE MyFun := GET_BYTE_REF(IN := 3+4); END_FUNCTION |
FUNCTION MyFun : REF_TO BYTE VAR_EXTERNAL Var1 : INT; END_VAR MyFun := GET_BYTE_REF(IN := Var1); END_FUNCTION |
FUNCTION_BLOCK Control_A VAR_TEMP Var1 : INT; END_VAR VAR iControl : Control; END_VAR iControl(InOut1 := Var1); END_FUNCTION_BLOCK FUNCTION_BLOCK Control VAR_IN_OUT InOut1 : INT; END_VAR END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control_A VAR Var1 : INT; iControl : Control; END_VAR iControl(InOut1 := Var1); END_FUNCTION_BLOCK FUNCTION_BLOCK Control VAR_IN_OUT InOut1 : INT; END_VAR END_FUNCTION_BLOCK |
"name" is not a constant variable.
Solution
: Correct the label in the CASE statement to an integer →literal or a →variable which is evaluated as →constant value during the runtime.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR count: INT; var1 : INT; END_VAR CASE count OF var1 : count := count + 1; END_CASE; END_PROGRAM |
PROGRAM Test VAR count: INT; var1 : INT; END_VAR CASE count OF 1 : count := count + 1; END_CASE; END_PROGRAM |
Invalid range for label in CASE statement
Solution
: Correct the label in the CASE statement so that the range is entered correctly.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR count: INT; END_VAR CASE count OF 4..1 : count := count + 1; END_CASE; END_PROGRAM |
PROGRAM Test VAR count: INT; END_VAR CASE count OF 1..4 : count := count + 1; END_CASE; END_PROGRAM |
RETAIN and NON_RETAIN is not allowed for the same variable declaration.
Solution
: Correct the variable declaration (e.g. the section VAR) so that only the keyword RETAIN or NON_RETAIN is entered. The declaration of more sections of a kind is allowed.
Example:
Faulty code |
Correct code |
VAR RETAIN NON_RETAIN var1: INT; var2: INT; END_VAR |
VAR RETAIN var1: INT; END_VAR VAR NON_RETAIN var2: INT; END_VAR |
RETAIN is not allowed for the variable declaration in a function.
Solution
: Delete the keyword RETAIN in the variable declaration (e.g. the section VAR) within the function.
Example:
Faulty code |
Correct code |
FUNCTION VAR RETAIN var1: INT; END_VAR END_FUNCTION |
FUNCTION VAR var1: INT; END_VAR END_FUNCTION |
NON_RETAIN is not allowed for the variable declaration in a function.
Solution
: Delete the keyword NON_RETAIN in the variable declaration (e.g. the section VAR) within the function.
Example:
Faulty code |
Correct code |
FUNCTION VAR NON_RETAIN var1: INT; END_VAR END_FUNCTION |
FUNCTION VAR var1: INT; END_VAR END_FUNCTION |
Arrays of REF_TO are not allowed.
Solution
: Adjust the ARRAY declaration so that only allowed constructs are entered.
Recursion detected: "construct"
Solution
: Adjust the ST-code so that there is no recursion any longer.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR fb1 : MyFB; END_VAR END_PROGRAM FUNCTION_BLOCK MyFB VAR fb1 : MyFB; END_VAR END_FUNCTION_BLOCK |
PROGRAM Test VAR fb1 : MyFB; END_VAR END_PROGRAM FUNCTION_BLOCK MyFB VAR fb1 : MyFB1; END_VAR END_FUNCTION_BLOCK FUNCTION_BLOCK MyFB1 END_FUNCTION_BLOCK |
TYPE Range : STRUCT min : RangeS; max : RangeS; END_STRUCT; RangeS : STRUCT scaleMin : Range; scaleMax : Range; END_STRUCT; END_TYPE |
TYPE Range : STRUCT min : INT; max : INT; END_STRUCT; RangeS : STRUCT scaleMin : Range; scaleMax : Range; END_STRUCT; END_TYPE |
EXIT or CONTINUE are only allowed within the iteration statements FOR, WHILE and REPEAT.
Solution
: Use the EXIT and CONTINUE statements only in the iteration statements FOR, WHILE or REPEAT.
Fewer values in initializing list than array elements. The remaining elements are initialized with the default value.
Solution
: Adjust the initializing list or the array elements so that the number matches (details on array elements: see "Declaration of an ARRAY data type in ST"). Alternative: You are allowed to ignore this message because it is a warning.
More values in initializing list than array elements.
Solution
: Adjust the initializing list or the array elements so that the number matches (details on array elements: see "Declaration of an ARRAY data type in ST").
Declaration of a function block instance or of an interface is not allowed at this location. or
Declaration of a function block instance or of an interface is not allowed at this location. Path: path
Solution
: Declare e.g. a function block instance within of VAR ... END_VAR. Details: see "Declaration of function block instances in ST" or "Declaration of an interface incl. method prototypes"
Declaration of a function block instance or interface is not allowed in a variable declaration with CONSTANT.
Solution
:
Declare e.g. a function block instance within of
VAR ... END_VAR that does not contain the keyword CONSTANT. Several sections of VAR ... END_VAR are allowed. Details: see "Declaration of function block instances in ST" or or "Declaration of an interface incl. method prototypes"
Assignment to output variable "name" of function block "name" is not allowed here.
Solution
: Delete the highlighted →assignment to the →output variable of the →function block instance. Alternative: Change the assignment so that the assignment is no longer done to an output variable of a function block instance.
Assignments to output variables of function blocks outside of this function block might become possible, if you deactivate the rule that is not allowing such assignments.
Example:
Faulty code |
Correct code |
PROGRAM test VAR MyInst : MyType; B : REAL; END_VAR MyInst.Out := B; END_PROGRAM FUNCTION_BLOCK MyType VAR_OUTPUT Out : REAL; END_VAR END_FUNCTION_BLOCK |
PROGRAM test VAR MyInst : MyType; B : REAL; END_VAR END_PROGRAM FUNCTION_BLOCK MyType VAR_OUTPUT Out : REAL; END_VAR END_FUNCTION_BLOCK |
Invalid data type literal.
Solution
: Change →literal
so that it is allowed for the →data type.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR test : WORD; END_VAR test := WORD#-1; END_PROGRAM |
PROGRAM Test VAR test : WORD; END_VAR test := WORD#1; END_PROGRAM |
Illegal function block call because the function block instance is declared as input.
Solution
: Delete the →call. Alternative: Declare the →function block instance as local variable (see example).
Example:
Faulty code |
Correct code |
PROGRAM Test VAR_INPUT myFB: FB; END_VAR myFB(); END_PROGRAM FUNCTION_BLOCK FB END_FUNCTION_BLOCK |
PROGRAM Test VAR myFB: FB; END_VAR myFB(); END_PROGRAM FUNCTION_BLOCK FB END_FUNCTION_BLOCK |
Illegal call of interface. It is allowed to call only methods of the interface.
Solution: Correct the →call so that a →method of the interface is called.
Invalid expression for the string length.
Solution: Correct the expression to a valid one for the length of the STRING variable. Example: STRING[10+2] is valid while STRING[10+2 > 6] is invalid.
Strings with length "number" are not allowed.
Solution
: Enter a length higher than the specified number for the STRING variable. See "Declaration of STRING variables (incl. access)" for more information.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR var1 : STRING[0]; END_VAR END_PROGRAM |
PROGRAM Test VAR var1 : STRING[1]; END_VAR END_PROGRAM |
VAR_IN_OUTs are declared in "name". Informal call is not allowed.
Solution
: Use a formal →call with assignments to all →in-out variable (see
FAQ article "
When to use a formal call? When to use a non-formal call?"
and "Declaration of in-out variables in ST" for more information).
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; END_VAR VAR_IN_OUT InOut1 : INT; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Var1 : INT; Inst1 : Control; END_VAR Inst1(5); END_PROGRAM |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; END_VAR VAR_IN_OUT InOut1 : INT; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Var1 : INT; Inst1 : Control; END_VAR Inst1(IN1 := 5, InOut1 := Var1); END_PROGRAM |
VAR_IN_OUTs are declared in "name". The call must contain assignments with ':=' to all VAR_IN_OUTs.
Solution 1
: Use a formal →call with assignments to all →in-out variable (see "
Declaration of in-out variables in ST" for more information).
Solution 2
: If a formal call is already used, use the assignment operator
:= for the assignment to in-out variables.
Examples:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; END_VAR VAR_IN_OUT InOut1 : INT; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Var1 : INT; Inst1 : Control; END_VAR Inst1(IN1 := 5); END_PROGRAM |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; END_VAR VAR_IN_OUT InOut1 : INT; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Var1 : INT; Inst1 : Control; END_VAR Inst1(IN1 := 5, InOut1 := Var1); END_PROGRAM |
FUNCTION_BLOCK Control VAR_IN_OUT InOut1 : int; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Var1 : int; Inst1 : Control; END_VAR Inst1(InOut1=>Var1); END_PROGRAM |
FUNCTION_BLOCK Control VAR_IN_OUT InOut1 : int; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Var1 : int; Inst1 : Control; END_VAR Inst1(InOut1:=Var1, InOut1=>Var1); END_PROGRAM |
VAR_IN_OUT demands expressions which might be on the left side of the assignment operator ':=' as well.
Solution
: Correct the assignment for the →in-out variable, in particular the expression on the right side of the assignment operator ":=" . There enter an expression which might be on the left side of the assignment operator ":=" as well.
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; END_VAR VAR_IN_OUT InOut1 : INT; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Var1 : INT; Inst1 : Control; END_VAR Inst1(IN1 := 5, InOut1 := 10); END_PROGRAM |
FUNCTION_BLOCK Control VAR_INPUT IN1 : INT; END_VAR VAR_IN_OUT InOut1 : INT; END_VAR END_FUNCTION_BLOCK PROGRAM Motor VAR Var1 : INT; Inst1 : Control; END_VAR Inst1(IN1 := 5, InOut1 := Var1); END_PROGRAM |
REF_TO is not possible for VAR_IN_OUT variables with data type 'ANY'.
Solution: Correct the call of the block with the →in-out variable of the →generic data type ANY so that a →reference is connected no longer.
It is not allowed to initialize a VAR_IN_OUT variable.
Solution
: Delete the initial value.
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Test VAR_IN_OUT InOut1 : int; END_VAR VAR Var1 : int; END_VAR END_FUNCTION_BLOCK FUNCTION_BLOCK Control VAR Inst1 : Test := (InOut1 := 25, Var1:= 6); END_VAR END_FUNCTION_BLOCK |
FUNCTION_BLOCK Test VAR_IN_OUT InOut1 : int; END_VAR VAR Var1 : int; END_VAR END_FUNCTION_BLOCK FUNCTION_BLOCK Control VAR Inst1 : Test := (Var1:= 6); END_VAR END_FUNCTION_BLOCK |
"Name" must be assigned to a variable.
Solution
: Assign the call of the block to a variable.
Only number array dimensions allowed.
Solution:
Correct the array declaration so that the specified restrictions are met. Details: see "Declaration of an ARRAY data type in ST".
Parameter "name" cannot be connected with multi-dimensional arrays.
Solution
: Connect the specified parameter of the block with a one-dimensional →array data type.
"name" cannot be assigned to multi-dimensional arrays.
Solution
: Assign the specified block to a one-dimensional →array data type.
Variable-length arrays are only supported for system functions and function blocks.
Solution
: Replace the variable-length array by an array with a definite index subrange [x..y].
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR Myarray1 : ARRAY [*, *] OF INT; END_VAR END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control VAR Myarray1 : ARRAY [1..10] OF INT; END_VAR END_FUNCTION_BLOCK |
Variable-length arrays are not allowed in a user-defined data type.
Solution
: Replace the variable-length array by an array with a definite index subrange [x..y].
Example:
Faulty code |
Correct code |
TYPE MyStruct : STRUCT element1 : ARRAY [*, *] OF INT; END_STRUCT; END_TYPE |
TYPE MyStruct : STRUCT element1 : ARRAY [1..10] OF INT; END_STRUCT; END_TYPE |
Functions that return an array of variable length may only appear on the right hand side of an assignment statement.
Solution
: Enter the function returning an variable-length array (e.g. ADD_2D_ARRAY block) on the right hand side of an →assignment statement only.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR array1 : ARRAY [1..10, -5..5] OF LREAL; array2 : ARRAY [-5..5, -5..5] OF LREAL; arrayResult : ARRAY [1..20, 1..20] OF LREAL; END_VAR ADD_2D_ARRAY(A1 := array1, A2 := array2); END_PROGRAM |
PROGRAM Test VAR array1 : ARRAY [1..10, -5..5] OF LREAL; array2 : ARRAY [-5..5, -5..5] OF LREAL; arrayResult : ARRAY [1..20, 1..20] OF LREAL; END_VAR arrayResult := ADD_2D_ARRAY(A1 := array1, A2 := array2); END_PROGRAM |
Function block instance is used with incompatible types (instance has been set to "type").
Solution
: Use the data type which is specified in the error message for all calls of the →function block instance.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR maxHold : MAX_HOLD; result1 : INT; result2 : UINT; END_VAR maxHold(OUT => result1); maxHold(OUT => result2); END_PROGRAM |
PROGRAM Test VAR maxHold : MAX_HOLD; result1 : INT; result2 : INT; END_VAR maxHold(OUT => result1); maxHold(OUT => result2); END_PROGRAM |
Declaration of an overloaded function block instance is not allowed at this location.
Solution
: Declare such →function block instances in local variable (VAR) sections only.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR_INPUT maxHold : MAX_HOLD; END_VAR END_PROGRAM |
PROGRAM Test VAR maxHold : MAX_HOLD; END_VAR END_PROGRAM |
References to constant variables are not allowed.
Solution
: Do not use →reference to →constant variables.
Example:
Faulty code |
Correct code |
PROGRAM Program1 VAR CONSTANT VarInt : INT; END_VAR VAR VarReference : REF_TO INT; END_VAR VarReference := REF(VarInt); END_PROGRAM |
PROGRAM Program1 VAR VarInt : INT; END_VAR VAR VarReference : REF_TO INT; END_VAR VarReference := REF(VarInt); END_PROGRAM |
A structure must contain at least one element.
Solution: Enter at least one structure element in the →structured data type.
Example:
Faulty code |
Correct code |
TYPE MyStruct: STRUCT END_STRUCT; END_TYPE |
TYPE MyStruct: STRUCT min : INT; END_STRUCT; END_TYPE |
Mixing formal and informal parameter assignments is not allowed.
Solution: Use either a formal →call or an non-formal call. See FAQ-article "When to use a formal call? When to use a non-formal call?" for details on the calls.
Example:
Faulty code |
Correct code |
PROGRAM Test AND(IN1:=1, 2); END_PROGRAM |
PROGRAM Test AND(IN1:=1, IN2:=2); END_PROGRAM |
"name" cannot be assigned to array of structure.
Solution: Just use those data types that are supported for the specified block. See the appropriate article in the user documentation.
Assignment from output parameter demands expressions which might be on the left side of the assignment operator ':=' as well.
Solution
: Correct the assignment from the output parameter in the call, in particular the expression on the right side of the assignment operator "=>" . There enter an expression which might be on the left side of the assignment operator ":=" as well.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR Var1 : REF_TO BOOL; Var2: INT; END_VAR Var1 := GET_NAMED_MEMORY(NAME:='test', RC => TO_USINT(Var2)); END_PROGRAM |
PROGRAM Test VAR Var1 : REF_TO BOOL; Var2: INT; Var3 : USINT; END_VAR Var1 := GET_NAMED_MEMORY(NAME:='test', RC => Var3); Var2 := TO_USINT(Var3); END_PROGRAM |
"name" is not an input variable.
Solution: Correct the assignment in the call (see example). Alternative: Correct the declaration of the variable so that is is an →input variable.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR MyInst : test1; testVar : INT; END_VAR MyInst(Var1 := testVar); END_PROGRAM FUNCTION_BLOCK test1 VAR_OUTPUT Var1 : INT; END_VAR END_FUNCTION_BLOCK |
PROGRAM Test VAR MyInst : test1; testVar : INT; END_VAR MyInst(Var1 => testVar); END_PROGRAM FUNCTION_BLOCK test1 VAR_OUTPUT Var1 : INT; END_VAR END_FUNCTION_BLOCK |
"name" is not an output variable.
Solution: Correct the assignment in the call (see example). Alternative: Correct the declaration of the variable so that is is an →output variable.
Example:
Faulty code |
Correct code |
PROGRAM Test VAR MyInst : test1; Var2 : int; result : int; END_VAR MyInst(IO1 := Var2, Var1 => result); END_PROGRAM FUNCTION_BLOCK test1 VAR_IN_OUT IO1 : int; END_VAR VAR Var1 : INT; END_VAR END_FUNCTION_BLOCK |
PROGRAM Test VAR MyInst : test1; Var2 : int; result : int; END_VAR MyInst(IO1 := Var2); END_PROGRAM FUNCTION_BLOCK test1 VAR_IN_OUT IO1 : int; END_VAR VAR Var1 : INT; END_VAR END_FUNCTION_BLOCK |
Variable "name" is not accessible in this context.
Solution: Correct the declaration of the variable. Alternative: Delete the access to the variable. The access might become possible, if you deactivate the
rules
that do not allow the assignments to/from variables.
Example: →In-out variables are not visible outside the POU in which they have been declared. These in-out variables are visible within the call of the POU (see the alternative for correct code).
Faulty code |
Correct code |
Alternative for correct code |
PROGRAM Test VAR MyInst : test1; result : INT; END_VAR result := MyInst.Var1; END_PROGRAM FUNCTION_BLOCK test1 VAR_IN_OUT Var1 : int; END_VAR END_FUNCTION_BLOCK |
PROGRAM Test VAR MyInst : test1; result : INT; END_VAR result := MyInst.Var1; END_PROGRAM FUNCTION_BLOCK test1 VAR_INPUT Var1 : int; END_VAR END_FUNCTION_BLOCK |
PROGRAM Test VAR MyInst : test1; result : INT; END_VAR Myinst(Var1:=result); END_PROGRAM FUNCTION_BLOCK test1 VAR_IN_OUT Var1 : int; END_VAR END_FUNCTION_BLOCK |
REF_TO, a function block or an interface is not possible as base type for a user-defined data type.
Solution: Correct the declaration of the →derived data type. See "Declaration of a directly derived data type in ST" for the restrictions when using derived data types.
Example:
Faulty code |
Correct code |
Details on solution |
TYPE MyType1 : REF_TO INT; END_TYPE |
TYPE MyType1 : INT; END_TYPE |
|
TYPE MyType2 : TOF; END_TYPE |
TYPE MyType2 : TOD; END_TYPE |
Assumption: TOF is a typing error. The required data type is TOD (abbreviation for TIME_OF_DAY). |
Nesting too deep for "name".
Solution: Reduce the nestings of the data types. See "Declaration of a directly derived data type in ST" for the restrictions when using derived data types.
Variable "name" is unused.
Solution: If necessary, correct the ST-code – either delete the declaration or use the declared variable.
Result value of function "name" is not assigned.
Solution: If necessary, correct the ST-code – either delete the return value of the function (the data type entered at its declaration) or assign the return value within the function.
It is not allowed to combine SFC elements and ST statements in this form.
Solution: Delete the SFC elements or the ST assignments (e.g. block calls or assignments) so that they are not combined at the upmost level with the POU any longer.
Several initial steps are existing in the same SFC network. But an SFC network must contain exactly one initial step.
Solution: Delete the redundant initial steps. Alternative: Correct the SFC elements so that several SFC networks exist in the POU.
Step "name" is used in an SFC network without an initial step. But an SFC network must contain exactly one initial step.
Solution: Create an initial step for the SFC network. Alternative: Enter an already existing initial step as predecessor or successor step for a transition within the SFC network in which the named step is used.
Transition "name" is used in an SFC network without an initial step. But an SFC network must contain exactly one initial step.
Solution: Create an initial step for the SFC network. Alternative: Enter an already existing initial step as predecessor or successor step for a transition within the SFC network in which the named transition is used.
A step must not be used within a step.
Solution: Correct the ST-code by specifying an →action within the step.
The priority of transitions is not evaluated.
Solution: Delete the specification PRIORITY entered for transitions.
Ambiguous identifier "name". Found in: POU1, POU2, ...
Solution: Just use one USING →namespace directive (see example). Alternative: Correct the declarations of the POUs within the namespaces so that they have a unique identifier and use the POU with the unique name (after all USING directives).
Example:
Faulty code |
Correct code |
PROGRAM Motor using Standard; using Alternate; Test(); END_PROGRAM NAMESPACE Standard FUNCTION Test END_FUNCTION END_NAMESPACE NAMESPACE Alternate FUNCTION Test END_FUNCTION END_NAMESPACE |
PROGRAM Motor using Standard; Test(); END_PROGRAM NAMESPACE Standard FUNCTION Test END_FUNCTION END_NAMESPACE NAMESPACE Alternate FUNCTION Test END_FUNCTION END_NAMESPACE |
"name" included more than once.
Solution: Enter different names in the INCLUDE_GLOBAL directives (see example). Alternative: Delete the duplicates.
See "Declaration of global variables in global-object and its usage in ST"
for information on the usage.
Example:
Faulty code |
Correct code |
PROGRAM Motor {INCLUDE_GLOBALS MyGVs1} {INCLUDE_GLOBALS MyGVs1} END_PROGRAM |
PROGRAM Motor {INCLUDE_GLOBALS MyGVs1} {INCLUDE_GLOBALS MyGVs2} END_PROGRAM |
Invalid partial access for "name".
Solution: Correct the partial access or the declaration for the variable so that it is a correct partial access for the variable. See "Partial access of ANY_BIT variables" for information on the usage.
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control_1 VAR VarBo : BOOL; VarBy : BYTE; END_VAR VarBo := VarBy.%X8; END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control_1 VAR VarBo : BOOL; VarBy : BYTE; END_VAR VarBo := VarBy.%X7; END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control_2 VAR Var1 : BOOL; END_VAR Var1.%X1 := TRUE; END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control_2 VAR Var1 : BYTE; END_VAR Var1.%X1 := TRUE; END_FUNCTION_BLOCK |
References to temporary variables are not allowed.
Solution: Correct the assignment to the reference variable or the declaration for the variable so that it is a correct assignment. See "Declaration of reference variables (incl. assignments to them)" about possible reference declarations.
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR_TEMP Int1R : REF_TO INT; Int1 : INT; END_VAR Int1R := REF(Int1); END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control VAR Int1R : REF_TO INT; Int1 : INT; END_VAR Int1R := REF(Int1); END_FUNCTION_BLOCK |
References to in-out variables are not allowed as initial value for reference variables.
Solution: Delete the initial value for the declared reference variable. Create an assignment in which you assign the reference to the in-out variable.
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR_IN_OUT IO1 : INT; END_VAR VAR Var1 : REF_TO INT := REF(IO1); END_VAR END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control VAR_IN_OUT IO1 : INT; END_VAR VAR Var1 : REF_TO INT; END_VAR Var1 := REF(IO1); END_FUNCTION_BLOCK |
Identifier exceeds the maximum length by number characters.
Solution: Shorten the identifier. It must not exceed 127 characters.
References to DMA-variables are not allowed.
Solution
: Do not use global variables with attribute DMA for assignments to variables declared with REF_TO or in section VAR_IN_OUT.
Assignment to named value "name" is not allowed.
Solution: Correct the assignment so that the named value is not located on the left side of the assignment operator ":=" any longer.
Example:
Faulty code |
Correct code |
TYPE Colors : INT (Red := 1); END_TYPE FUNCTION_BLOCK Control VAR Var1 : INT; END_VAR Red := 1; END_FUNCTION_BLOCK |
TYPE Colors : INT (Red := 1); END_TYPE FUNCTION_BLOCK Control VAR Var1 : INT; END_VAR Var1 := Red; END_FUNCTION_BLOCK |
The usage of "EN" is here not allowed. Only assignments to "EN" within the call of a block are possible.
Solution: Correct the use of EN.
Example:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR Var1 : bool; END_VAR Var1 := EN; END_FUNCTION_BLOCK |
PROGRAM Motor1 VAR iControl : Control; END_VAR iControl(EN := true); END_PROGRAM FUNCTION_BLOCK Control END_FUNCTION_BLOCK |
Property "name" is defined multiple times
Solution: Correct the code so that the mentioned property is defined just once.
Unsupported expression in the parameter list of this call.
Solution: Correct the parameter list of the →call by deleting the assignments with the faulty highlighted expressions. If necessary, declare and initialize one or several auxiliary variables, then use these auxiliary variables in the parameter list of the call.
Examples:
Faulty code |
Correct code |
FUNCTION_BLOCK Control VAR inputString1 : STRING[4]; END_VAR Simple(stringArray[1] := inputString1); END_FUNCTION_BLOCK FUNCTION Simple VAR_IN_OUT stringArray : ARRAY [1..3] OF STRING[4]; END_VAR END_FUNCTION |
FUNCTION_BLOCK Control VAR Var1 : ARRAY [1..3] OF STRING[4]; END_VAR Simple(stringArray := Var1); END_FUNCTION_BLOCK FUNCTION Simple VAR_IN_OUT stringArray : ARRAY [1..3] OF STRING[4]; END_VAR END_FUNCTION |
FUNCTION_BLOCK Control VAR inputString1 : STRING[4]; iTest : Test01; END_VAR iTest(stringArray^[1] := inputString1); END_FUNCTION_BLOCK FUNCTION_BLOCK Test01 VAR_INPUT stringArray : REF_TO ARRAY [1..3] OF STRING[4]; END_VAR END_FUNCTION_BLOCK |
FUNCTION_BLOCK Control VAR Var1 : ARRAY [1..3] OF STRING[4]; iTest : Test01; END_VAR iTest(stringArray := REF(Var1)); END_FUNCTION_BLOCK FUNCTION_BLOCK Test01 VAR_INPUT stringArray : REF_TO ARRAY [1..3] OF STRING[4]; END_VAR END_FUNCTION_BLOCK |
Reason exceeds the maximum length by number characters.
Solution: Shorten the reason. It must not exceed 255 characters.
The given data type does not allow a bit size specification.
Solution: Delete the attribute SIZE that has been specified for the data type. Alternative: Change the base data type to one of the data types for which the attribute SIZE is allowed. Details: see "Declaration of a directly derived data type in ST"
The bit size is outside of the allowed range for the data type.
Solution: Adapt the specification for the attribute SIZE so that the specification is within the range allowed for the base data type. Details: see "Declaration of a directly derived data type in ST"
Invalid index subrange for an array.
Solution: Correct the used array data type.
Invalid index subrange for an array: Illegal data type.
Solution: Correct the base data type for the data type with the named values. Details: see "Using named values as array limits"
Example:
Faulty code |
Correct code |
TYPE myType : ARRAY [Red..Green] OF INT; Colors3 : REAL(Red := 1.0, Green := 100.0); END_TYPE |
TYPE myType : ARRAY [Red..Green] OF INT; Colors3 : DINT(Red := 1, Green := 100); END_TYPE |
Invalid index subrange for an array: Illegal value (corresponds to decimal value "value") for the array limit.
Solution: Correct the corresponding value for the data type with the named values. Details: see "Using named values as array limits"
Example:
Faulty code |
Correct code |
TYPE myType : ARRAY [Red..Green] OF INT; Colors3 : ULINT(Red := 16#000000000, Green := 16#100000010); END_TYPE |
TYPE myType : ARRAY [Red..Green] OF INT; Colors3 : ULINT(Red := 16#000000000, Green := 16#000000064); END_TYPE |
Could not load tooltip data for some annotation markers.
There is a task icon within the border left of the code. No tooltip can be displayed for this icon.
Solution: Move the mouse pointer onto the icon displayed within the border right of the code. The tooltip is displayed for this icon.
The access scope is only evaluated for library elements.
Solution: Search for the specification { AccessLevel := ...}. If the specification is included in a user-defined POU within the project (hence, not within a library), delete this specification.
Note: The statement { AccessLevel := ...} is automatically generated by logi.CAD 3, in particular for a POU within a library as the POU is specified within a library configuration.
The declaration of a function block instance or of an interface is not allowed due to "{noCodeGeneration}".
Solution: Delete the declaration of the function block instance or of the interface from the section with the declaration of the internal variables (= the instance parameters). Alternative: Delete the specified →pragma from the section.
A structure element of the data type "name" uses a function block as type. However, this usage is not allowed due to "{noCodeGeneration}".
Solution: Delete the used function block from the →structured data type. Alternative: Delete the specified pragma from the section with the declaration of the internal variables.
The variable "name" must not be used due to "{noCodeGeneration}".
Solution: Do not use the variable within the ST-code (e.g. within an →assignment). Alternative: Delete the specified pragma from the section with the declaration of the internal variables.
The usage of "{noCodeGeneration}" is not allowed within a function. or
The usage of "{instanceParam}" is not allowed within a function. or
Declaration of a function block instance or of an interface is not allowed at this location due to "{instanceParam}". or
REF_TO is not allowed at this location due to "{instanceParam}".
Solution: Delete the specified pragma from the section with the appropriate declaration.
Best practice is to use "{noCodeGeneration}" together with "{instanceParam}".
Solution: Enter both pragmas in the section with the declaration of the internal variables.
The instance parameters refers the illegal variable "name".
Solution: Correct the variable that is entered after @RELATES_TO within the instance parameters so that it is not an illegal variable anymore. Illegal variables are:
variables that are declared as the instance parameters (= within a section with the declaration of the internal variables and the pragma {instanceParam})
"@RELATES_TO" is only allowed for instance parameters. The pragma "{instanceParam}" is required for such instance parameters.
Solution: Delete the pragma { @RELATES_TO := name;} for the variable. Alternative: Add the pragma {instanceParam} within the section with the declaration of the internal variables so that the variables within the section become instance parameters.
The variable "name" must not be used for different "@RELATES_TO" pragmas.
Solution: Correct the variable that is entered after @RELATES_TO within the instance parameters so that a different variable is used.
Illegal data type "name" with instance parameter "name". Only elementary or structured data types are legal.
Solution: Correct the