This shows you the differences between two versions of the page.
|
4control_help:err:compiler:c1544 [2009/06/19 06:08] patbarnes (regex)Fixed html entities |
4control_help:err:compiler:c1544 [2009/07/17 03:26] (current) patbarnes fixed code examples |
||
|---|---|---|---|
| Line 4: | Line 4: | ||
| ==== l-value expected at parameter <number> of '<function name>' ==== | ==== l-value expected at parameter <number> of '<function name>' ==== | ||
| - | === Explanation: === | + | === Explanation: === |
| - | In a function call, an actual parameter that is not an l-value, i.e. that cannot be written in, was assigned to a formal function parameter declared as VAR_IN_OUT or VAR_OUTPUT in the interface of the function. This may have been a constant or literal. An actual parameter in which a value can be written must be passed to each IN_OUT and OUTPUT parameter of a function.**Example: ** FUNCTION Function1 VAR_INPUT In1 : DINT; In2 : DINT; END_VAR VAR_IN_OUT Out1 : BOOL; END_VAR ................. ................. END_FUNCTION PROGRAM Program1 VAR var1 : DINT := 5; var2 : DINT := 8; END_VAR VAR CONSTANT ConstVar : BOOL := TRUE; END_VAR Function1(var1, var2, ConstVar); END_PROGRAMThe interface of the function //Function1// contains the IN_OUT parameter //Out1// as the third parameter. When //Function1// is called from //Program1//, the constant //ConstVar// is assigned to this parameter as an actual parameter. Since a constant is not an l-value, the error described here is issued during compilation. | + | |
| + | In a function call, an actual parameter that is not an l-value, i.e. that cannot be written in, was assigned to a formal function parameter declared as VAR_IN_OUT or VAR_OUTPUT in the interface of the function. This may have been a constant or literal. An actual parameter in which a value can be written must be passed to each IN_OUT and OUTPUT parameter of a function. | ||
| + | ==Example:== | ||
| + | <code 4c_st> | ||
| + | FUNCTION Function1 | ||
| + | VAR_INPUT | ||
| + | In1 : DINT; | ||
| + | In2 : DINT; | ||
| + | END_VAR | ||
| + | VAR_IN_OUT | ||
| + | Out1 : BOOL; | ||
| + | END_VAR | ||
| + | ................. | ||
| + | ................. | ||
| + | END_FUNCTION | ||
| + | |||
| + | PROGRAM Program1 | ||
| + | VAR | ||
| + | var1 : DINT := 5; | ||
| + | var2 : DINT := 8; | ||
| + | END_VAR | ||
| + | VAR CONSTANT | ||
| + | ConstVar : BOOL := TRUE; | ||
| + | END_VAR | ||
| + | |||
| + | Function1(var1, var2, ConstVar); | ||
| + | |||
| + | END_PROGRAM | ||
| + | </code> | ||
| + | |||
| + | The interface of the function //Function1// contains the IN_OUT parameter //Out1// as the third parameter. When //Function1// is called from //Program1//, the constant //ConstVar// is assigned to this parameter as an actual parameter. Since a constant is not an l-value, the error described here is issued during compilation. | ||
| //Generated automatically from help documentation// | //Generated automatically from help documentation// | ||