PLC Analog Scaling Calculator

Convert raw analog input counts to engineering units (or the reverse), and get the slope and offset to use in your PLC program.

Scaling range

For a 4-20 mA input, enter the raw count the card reports at 4 mA as the low end and at 20 mA as the high end. These counts are listed in the input module's manual.

Raw count to engineering value

Engineering value to raw count

How it works

An analog input card converts the signal into an integer. Your program must turn that integer into a meaningful number such as PSI or degrees. The relationship is a straight line, so one multiplication and one addition are enough.

value = (raw − rawlow) × (outhigh − outlow) / (rawhigh − rawlow) + outlow
slope = (outhigh − outlow) / (rawhigh − rawlow)
offset = outlow − rawlow × slope

Most PLCs have a built-in instruction for this, such as SCP or SCL on Allen-Bradley, and NORM_X with SCALE_X on Siemens. If you scale in your own logic, do the math in floating point (REAL) so intermediate results cannot overflow a 16-bit integer.

Worked example

A pressure transmitter is ranged 0-150 PSI and the card reports 0-32767 counts. The PLC reads 8192.

In the other direction, 100 PSI is 100 / 150 × 32767 = 21,845 counts.

Common questions

Why does my reading drift below zero?

Many cards report counts slightly below the 4 mA count when the signal is under 4 mA, and a broken wire reads near 0 mA. That is a feature. Alarm on it instead of clamping it away.

Which raw range does my card use?

It depends on the module and its configuration. Check the module's documentation. The presets above cover common values but are not a substitute.

Calculations are provided for convenience and education. Verify results against your module documentation before relying on them.