- Home
- PLC programming
- Scaling calculator
PLC scaling calculator
Convert between the signal on the wire, the raw value in the PLC and the value in engineering units, for 4 to 20 mA, 0 to 10 V and other analogue signals. Useful for programming and for loop checks on site.
- Tool
- Analogue scaling
- Signals
- mA, volts or your own
- Raw values
- Siemens, Beckhoff, custom
- Cost
- Free
Convert a value
Set the signal, the PLC and the range of the sensor, then type any one of the three values.
Result
- Signal
- 12mA
- PLC raw value
- 13824
- Engineering value
- 50bar
50% of the range
Check the result against your module and sensor documents before you rely on it on a live machine.
Loop check points
Five points across the range, for checking a transmitter, the input card and the screen against each other.
| Point | Signal (mA) | PLC raw | Value (bar) |
|---|---|---|---|
| 0% | 4 | 0 | 0 |
| 25% | 8 | 6912 | 25 |
| 50% | 12 | 13824 | 50 |
| 75% | 16 | 20736 | 75 |
| 100% | 20 | 27648 | 100 |
PLC code for this scaling
The code follows the settings above. Add your own handling for signals that leave the range, such as a broken wire.
Siemens TIA Portal, SCL
// rawValue : Int; norm, scaled : Real (bar)
#norm := NORM_X(MIN := 0, VALUE := #rawValue, MAX := 27648);
#scaled := SCALE_X(MIN := 0.0, VALUE := #norm, MAX := 100.0);Structured text, TwinCAT and CODESYS
// rawValue : INT; scaled : REAL
VAR CONSTANT
RAW_LO : REAL := 0.0;
RAW_HI : REAL := 27648.0;
EU_LO : REAL := 0.0; // bar
EU_HI : REAL := 100.0; // bar
END_VAR
scaled := EU_LO + (INT_TO_REAL(rawValue) - RAW_LO)
* (EU_HI - EU_LO) / (RAW_HI - RAW_LO);Analogue scaling questions
What raw value is 12 mA on a Siemens S7-1500?
How do I detect a broken wire on a 4 to 20 mA loop?
Why does my value read a little under or over the range?
Where do I find the raw range of my module?

Need a hand with the PLC?
We program Siemens, Rockwell, Beckhoff, Schneider, Omron, Mitsubishi and ABB: new control systems, upgrades and fault finding.