Function for monitoring the range limits of a subrange type of type DINT
Example for CheckRangeSigned
The assignment of a value to a DINT variable of a signed subrange type is a condition
for automatically calling the CheckRangeSigned. The function restricts the assignment value to the subrange as defined in the variables
declaration. The default implementation of the function in ST is as follows:
Declaration part:
// Automatisch erzeugter Code : NICHT EDITIEREN
FUNCTION CheckRangeSigned : DINT
VAR_INPUT
value, lower, upper: DINT;
END_VAR
Implementation:
// Automatisch erzeugter Code : Es handelt sich hierbei um einen Implementierungsvorschlag.
IF (value < lower) THEN
CheckRangeSigned := lower;
ELSEIF(value > upper) THEN
CheckRangeSigned := upper;
ELSE
CheckRangeSigned := value;
END_VAR
-
Monitoring range limits