For an S7-1200/S7-1500 controller in STEP 7 (TIA Portal), how do you scale integer values in real numbers and vice versa for analog inputs and outputs?
-
Entry
-
Associated product(s)
Instructions
You can use the SCALE_ X "Scale" and NORM_X "Normalize" converters to scale analog values. These blocks are located in STEP 7 (TIA Portal) in "Instructions" task card under "Basic Instructions" and "Converters". A detailed description of the function and parameterization is available in the STEP 7 Online Help. To obtain the Online Help for a block, mark the block concerned (SCALE_X, for example) and press the "F1" key.
In the following examples it is assumed that the measuring ranges are unipolar. The integer input value is then between 0 and 27648.
The following values are generated by the conversion (for determining temperature via current measurement, for example):
Integer value (analog value) | Measured value (in the 0-20mA range) | Measured value (in the 4-20mA range) | Phys. value |
---|---|---|---|
0 | 0.0 | 4.0 | 20°C |
6912 | 5.0 | 8.0 | 52.5°C |
13824 | 10.0 | 12.0 | 85°C |
20736 | 15.0 | 16.0 | 117.5°C |
27648 | 20.0 | 20.0 | 150°C |
Example 1 - Conversion of an analog value into a physical value (analog input, taking the example of determining temperature)
The upper and lower limits are MAX=27648 and MIN=0 for normalization and MAX=150°C and Min=20°C for scaling. Since the input values are of the Integer data type and the output values are scaled as Real data type, the NORM_X function converts the data type from Integer to Real. The value 20000 corresponds to a measured value of 14.4676mA in the 0-20mA measuring range.

Fig. 1
NORM_X_VALUE - NORM_X_MIN | SCALE_X_OUT - SCALE_X_MIN | |
------------------------------------------- | = | ----------------------------------------- |
NORM_X_MAX - NORM_X_MIN | SCALE_X_MAX - SCALE_X_MIN |
If the input "VALUE" of the NORM_X block has the value 20000 and the limit values as in Fig. 1, then the output "OUT" of the SCALE_X block has the value:
20000 - 0 | SCALE_X_OUT - 20 | |
------------- | = | ----------------------- |
27648 - 0 | 150 - 20 | |
| ||
SCALE_X_OUT = 114.04 (corresponds to: 114.04°C) |
Example 2 - Conversion of a physical value into an analog value (analog output taking the example of a control output)
Since the input values are of the Real data type and the output values are scaled as Integer data type, the SCALE_X function converts the data type from Real to Integer. The integer value 27648 corresponds to the upper limit and the integer value 0 to the lower limit of the output range. For example, for a control output of 65.0 the analog value 19968 is scaled, which corresponds to a current value of 14.4445mA (in the output range of 0-20mA).

Fig. 2
To change the data type conversion for the blocks, mark the block concerned and click on the yellow arrow. You can then select the required data type conversion from the drop-down list that opens. You must then change the parameters, because the data types of the parameters have changed.

Fig. 3
Voltage measurement, Temperature measurement, Resistance measuring, Pressure sensor
- German
- French
- Italian
- Spanish
- Chinese