SA0038: Read access to output variable
Function | Determines output variables (VAR_OUTPUT) that are subject to read access within the POU. |
Reason | The IEC-61131-3 standard prohibits reading an output within a function block. It indicates that the output is not only used as an output but also as a temporary variable for intermediate results. Such dual use should be avoided. |
Importance | Low |
Sample:
Function block FB_Sample:
FUNCTION_BLOCK FB_Sample
VAR_OUTPUT
bOut : BOOL;
nOut : INT;
END_VAR
VAR
bLocal : BOOL;
nLocal : INT;
END_VARMethod FB_Sample.SampleMethod:
IF bOut THEN // => SA0038
bLocal := (nOut > 100); // => SA0038
nLocal := nOut; // => SA0038
nLocal := 2*nOut; // => SA0038
END_IF