S7-1200 Programmable Controller - Processing of Analog Values
S7-1200 Programmable Controller - Processing of Analog Values
Analog signal modules provide input signals or expect output values that represent either a
voltage range or a current range. These ranges are ±10 V, ±5 V, ±2.5 V, or 0 - 20 mA. The values
returned by the modules are integer values where 0 to 27648 represents the rated range for
current, and -27648 to 27648 for voltage. Anything outside the range represents either an
overflow or underflow. See the tables for analog input representation and analog output
representation for details about the types of out-of-range values.
In your control program, you probably need to use these values in engineering units, for
example to represent a volume, temperature, weight or other quantitative value. To do this for
an analog input, you must first normalize the analog value to a real (floating point) value from
0.0 to 1.0. Then you must scale it to the minimum and maximum values of the engineering
units that it represents. For values that are in engineering units that you need to convert to an
analog output value, you first normalize the value in engineering units to a value between 0.0
and 1.0, and then scale it between 0 and 27648 or -27648 to 27648, depending on the range
of the analog module. STEP 7 provides the NORM_X and SCALE_X instructions for this purpose.
You can also use the CALCULATE instruction to scale the analog values.
0 50 °C
6192 62.5 °C
12384 75 °C
18576 87.5 °C
24768 100 °C
The calculation for determining engineering units from the analog input value in this example
is as follows:
Engineering units value = 50 + (Analog input value) * (100 - 50) / (24768 - 0)
For the general case, the equation would be:
This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims all
liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties.
11/1/2024
S7-1200 Programmable controller
Processing of analog values
In PLC applications, the typical method is to normalize the analog input value to a floating point
value between 0.0 and 1.0. Then, you would scale the resulting value to a floating point value
in the range of your engineering units. For simplicity, the following LAD instructions use
constant values for the ranges; you might actually choose to use tags:
Network 1
Network 2
See also
→ Measurement ranges of the analog inputs for voltage and current (SB and SM)
→ Measurement ranges of the analog outputs for voltage and current (SB and SM)
→ SCALE_X (Scale) and NORM_X (Normalize)
→ CALCULATE (Calculate)
→ Creating a complex equation with a simple instruction
This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims all
liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties.
11/1/2024