100BBasic instructions
7.7 Convert
S7-1200 Programmable controller
206
System Manual, 11/2011, A5E02486680-05
7.7.5
Scale and normalize instructions
Table 7- 89 SCALE_X and NORM_X instructions
LAD / FBD
SCL
Description
out :=SCALE_X(min:=_in_,
value:=_in_,
max:=_in_);
or
out := value (max - min) + min;
Scales the normalized real parameter VALUE
where ( 0.0 <= VALUE <= 1.0 ) in the data type
and value range specified by the MIN and MAX
parameters:
OUT = VALUE (MAX - MIN) + MIN
out :=NORM_X(min:=_in_,
value:=_in_,
max:=_in_);
or
out := (value - min) / (max - min);
Normalizes the parameter VALUE inside the
value range specified by the MIN and MAX
parameters:
OUT = (VALUE - MIN) / (MAX - MIN),
where ( 0.0 <= OUT <= 1.0 )
1
For LAD and FBD: Click the "???" and select a data type from the drop-down menu.
Table 7- 90 Data types for the parameters
Parameter
Data type
1
Description
MIN
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
Input minimum value for range
VALUE
SCALE_X: Real, LReal
NORM_X: SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
Input value to scale or normalize
MAX
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
Input maximum value for range
OUT
SCALE_X: SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
NORM_X: Real, LReal
Scaled or normalized output value
1
For SCALE_X: Parameters MIN, MAX, and OUTmust be the same data type.
For NORM_X: Parameters MIN, VALUE, and MAXmust be the same data type.