PLC Analog Scaling and Raw Count Explained: Formula, Calculator and Brand Reference

Share:

PLC · Analog Scaling · 4-20 mA · Raw Count

PLC Analog Scaling and Raw Count Explained: Formula, Calculator and PLC Brand Reference

A complete plain-English guide to PLC analog input scaling: what raw counts are and why they exist, the linear scaling formula derived step by step, the reverse formula, resolution calculation, raw count ranges for Siemens S7-1200/1500 and Allen-Bradley, NAMUR NE43 fault zones in raw counts, and a bidirectional interactive calculator with PLC presets.

Raw to EU and EU to Raw Siemens and Allen-Bradley Presets NAMUR NE43 Fault Zones Resolution Calculation

When a pressure transmitter sends 12 mA to a PLC analog input card, the PLC does not receive the number 12. It receives a number like 13824. That number is the raw count: the output of the analog-to-digital converter (ADC) inside the analog input module. Every 4-20 mA signal, every 0-10 V signal and every thermocouple millivolt input arrives in the PLC as a raw count first. Everything you see on an HMI (4.5 bar, 250 m³/h, 82°C) was originally a raw count that was scaled into engineering units by the PLC program.

Wrong scaling is one of the most common and most expensive errors in PLC commissioning. A technician who confuses the raw count range of a Siemens S7-1200 (where the low end starts at 5530, not 0) with an Allen-Bradley ControlLogix (where it starts at 0) will get a process reading that is wrong by up to 20% at low signal values, even though every wire in the system is correct. Understanding raw counts from first principles prevents this class of error entirely.

This guide explains analog scaling from the ground up: what an ADC is, why different PLC brands produce different raw count ranges, the complete linear scaling formula with derivation and worked examples in both directions, how to calculate the resolution of a scaling in engineering units per count, the NAMUR NE43 fault zones translated into raw counts for each major PLC platform, and an interactive bidirectional calculator with one-click presets for Siemens S7-1200, S7-1500 and Allen-Bradley. For context on the 4-20 mA signal that feeds the PLC input, see our guide on the 4-20 mA current loop explained.

What this guide covers
What raw counts are and why PLCs use them  ·  How the ADC converts current to raw count  ·  Raw count ranges for Siemens S7-1200, S7-1500 and Allen-Bradley  ·  The linear scaling formula (raw to EU) derived step by step  ·  The reverse formula (EU to raw) for analog output scaling  ·  Resolution: engineering units per count  ·  NAMUR NE43 fault zones in raw counts  ·  Three worked examples: pressure, flow, temperature  ·  Interactive bidirectional calculator with PLC presets  ·  Common scaling mistakes and how to avoid them.
Advertisement
Advertisement

What Is a Raw Count and Why Does a PLC Use One?

A 4-20 mA current loop carries an analog electrical signal. The PLC's analog input module contains an analog-to-digital converter (ADC) that samples this current many times per second and converts each sample into a binary digital number. This binary number is called the raw count.

The reason PLCs use raw counts instead of directly storing the mA value is straightforward. Processors work with integers. An ADC with 16-bit resolution produces integers from 0 to 65535 (2¹⁶ = 65536 possible values). A 12-bit ADC produces integers from 0 to 4095. These integers are the native language of the processor. Converting them to a floating-point mA value before the PLC program even sees them would waste CPU time and add an unnecessary intermediate conversion step. Instead, the PLC stores the raw integer and lets the programmer scale it to whatever engineering unit the application requires.

Figure 1: The Complete Signal Chain from Field Instrument to HMI Display
TRANSMITTER Pressure, temp, flow Physical process 4-20 mA AI MODULE ADC converts mA → integer 16-bit, 12-bit etc Hardware Raw count e.g. 13824 PLC CPU Scaling formula Raw → EU NORM_X/SCALE_X Software (PLC program) EU value e.g. 5.00 bar HMI / SCADA Displays 5.00 bar triggers alarms Operator display CONTROL PID / alarms / interlocks Raw count scaling happens in the PLC CPU. The AI module delivers only a raw integer. The PLC program converts it to engineering units.

Figure 1: Complete signal chain from field transmitter to HMI display. The ADC inside the AI module converts the 4-20 mA current into a raw integer count. The PLC scaling formula then converts that raw count into the engineering unit value that appears on the HMI and drives control logic.

Raw Count Ranges by PLC Brand: Why They Are Different

Different PLC manufacturers chose different ADC resolutions and different conventions for mapping the 4-20 mA signal range to raw counts. This means the same 12 mA signal produces a completely different raw count number depending on which PLC you are using. Getting this wrong is the single most common cause of scaling errors in multi-brand plants or when technicians work across different PLC families.

PLC PlatformSignal typeRaw Min (0% / 4 mA)Raw Max (100% / 20 mA)Usable spanADC bits used
Siemens S7-12004-20 mA (AI module)55302764822118 counts15-bit effective (0-27648 range)
Siemens S7-15004-20 mA (AI module)02764827648 counts15-bit effective (0-27648 range)
Siemens S7-300/4004-20 mA (AI module)02764827648 counts15-bit effective (0-27648 range)
Allen-Bradley ControlLogix / CompactLogix4-20 mA (1756-IF16)03276732767 counts15-bit (0 to 32767)
Allen-Bradley Micro820 / MicroLogix4-20 mA040954095 counts12-bit (0 to 4095)
Siemens all platforms (over-range diagnostic)4-20 mA extended-691232511Includes under-range and over-range diagnostic zonesExtended range
Why does the Siemens S7-1200 start at 5530, not 0?
The Siemens S7-1200 AI module reserves the raw count range below 5530 for diagnostic purposes. A raw count below 5530 on a 4-20 mA input indicates an under-range or wire break condition, not a valid process measurement. When you use the standard 4-20 mA range, 4 mA maps to raw count 5530 and 20 mA maps to 27648. If you mistakenly set Raw Min = 0 instead of 5530 in the scaling formula, your reading at 4 mA (empty/zero process condition) will show a negative engineering value instead of zero. This is one of the most common commissioning errors on S7-1200 installations.

The Linear Scaling Formula: Derivation and Use

PLC analog scaling uses a simple linear (proportional) relationship between the raw count range and the engineering unit range. The formula comes directly from the equation of a straight line (y = mx + c) applied to the two coordinate pairs (RawMin, EngMin) and (RawMax, EngMax).

Formula 1: Raw count to Engineering Unit (the standard scaling formula) EU = ((Raw - RawMin) / (RawMax - RawMin)) x (EngMax - EngMin) + EngMin
Where:
Raw = current raw count from PLC AI register
RawMin = raw count at 0% of range (4 mA for 4-20 mA)
RawMax = raw count at 100% of range (20 mA for 4-20 mA)
EngMin = engineering value at 0% (LRV of transmitter)
EngMax = engineering value at 100% (URV of transmitter)
EU = calculated engineering unit value
Simplified form: EU = (Raw - RawMin) x Span_EU / Span_Raw + EngMin
Where:
Span_EU = EngMax - EngMin
Span_Raw = RawMax - RawMin
Formula 2: Engineering Unit to Raw count (reverse scaling for AO modules and verification) Raw = ((EU - EngMin) / (EngMax - EngMin)) x (RawMax - RawMin) + RawMin
Or equivalently:
Raw = (EU - EngMin) x Span_Raw / Span_EU + RawMin
Use the reverse formula when:
- You need to write a raw count to an AO module to output a specific mA signal
- You need to verify: given a known process value, what raw count should the AI be showing?
- You are testing DCS/PLC software with simulated raw count inputs
Formula 3: Resolution (engineering units per count) Resolution = (EngMax - EngMin) / (RawMax - RawMin) = Span_EU / Span_Raw
Example: Siemens S7-1500, pressure transmitter 0-10 bar
Resolution = (10 - 0) / (27648 - 0) = 10 / 27648
Resolution = 0.000362 bar per count (0.362 mbar per count)
This means the PLC can distinguish pressure differences as small as 0.362 mbar. A 12-bit ADC (AB Micro820, Raw 0-4095) gives: Resolution = 10 / 4095 = 0.00244 bar per count (2.44 mbar per count) The S7-1500 is 6.75 times more precise at this pressure range.
Advertisement
Advertisement

PLC Analog Scaling Calculator: Bidirectional with PLC Presets

Select a PLC preset to load the correct raw count range automatically, then enter your process engineering range and either a raw count or an engineering value to convert in either direction.

PLC Analog Scaling Calculator
Raw to EU · EU to Raw · Resolution · NAMUR fault detection · All major PLC brands

PLC Preset (loads raw count range)

Value at 0% / 4 mA / RawMin
Value at 100% / 20 mA / RawMax
Read from PLC AI register (e.g. from online monitoring or loop check)
✔ Result
Engineering value (EU)
Percentage (%)
Equivalent mA
Resolution
Raw span used
NAMUR status
Enter the process value you want to verify or output (e.g. target AO setpoint)
✔ Result
Raw count (integer)
Percentage (%)
Equivalent mA
Advertisement
Advertisement

Worked Examples: Three Common Applications

Example 1: Pressure Transmitter on Siemens S7-1500

Given: Pressure transmitter 0-10 bar, 4-20 mA. S7-1500 AI. Raw Min = 0, Raw Max = 27648. PLC AI register reads 13824. EU = ((13824 - 0) / (27648 - 0)) x (10 - 0) + 0 = (13824 / 27648) x 10 = 0.5000 x 10
EU = 5.000 bar (exactly 50% of range, equivalent to 12.00 mA)
Verification: 4 + (13824/27648) x 16 = 4 + 8.000 = 12.000 mA. Correct.
Resolution = 10 / 27648 = 0.000362 bar per count (0.362 mbar)

Example 2: Flow Transmitter on Allen-Bradley ControlLogix

Given: Flow transmitter 0-500 m³/h, 4-20 mA. AB ControlLogix. Raw Min = 0, Raw Max = 32767. PLC AI register reads 8192. EU = ((8192 - 0) / (32767 - 0)) x (500 - 0) + 0 = (8192 / 32767) x 500 = 0.25001 x 500
EU = 125.0 m³/h (25.0% of range, equivalent to 8.00 mA)
Resolution = 500 / 32767 = 0.01526 m³/h per count (15.3 litres/h per count)

Example 3: Temperature Transmitter on Siemens S7-1200 (the tricky one)

Given: Temperature transmitter 0-200°C, 4-20 mA. S7-1200 AI. Raw Min = 5530, Raw Max = 27648. PLC AI register reads 16589. Span_Raw = 27648 - 5530 = 22118 EU = ((16589 - 5530) / 22118) x (200 - 0) + 0 = (11059 / 22118) x 200 = 0.49995 x 200
EU = 99.99°C (approximately 50.0% of range, equivalent to 12.00 mA)
WRONG result if Raw Min = 0 used by mistake: EU = (16589 / 27648) x 200 = 120.0°C (20°C too high!)
This is the exact error that occurs when a technician uses S7-1500 parameters on an S7-1200 installation. Always confirm Raw Min = 5530 for S7-1200 4-20 mA inputs before scaling.

Example 4: Reverse scaling: writing to an AO module (EU to Raw)

Given: Control valve positioner AO output, 4-20 mA. S7-1500. Raw Min = 0, Raw Max = 27648. Need to output exactly 75% open (valve setpoint from PID = 75%). Raw = ((75 - 0) / (100 - 0)) x (27648 - 0) + 0 = 0.75 x 27648
Raw = 20736 (write this integer to the AO DAC register)
Verification: EU = (20736 / 27648) x 100 = 75.00%. Correct.
Equivalent mA = 4 + 0.75 x 16 = 16.00 mA. Correct.

NAMUR NE43 Fault Zones Translated to Raw Counts

The NAMUR NE43 standard defines the signal ranges that indicate fault conditions in 4-20 mA loops. These correspond to specific mA values: below 3.6 mA is a hard fault (wire break or sensor failure) and above 21.0 mA is an over-range fault. The table below converts these mA boundaries into raw counts for each major PLC platform, so you know exactly which raw count values should trigger fault alarms in your PLC program.

NAMUR NE43 zonemA rangeS7-1200 raw countsS7-1500 raw countsAB ControlLogix raw countsMeaning
Hard fault / wire breakBelow 3.6 mABelow 4529Below -1104Below -1229Transmitter failure, broken wire or loss of loop power
Low alarm saturation3.6 to 3.8 mA4529 to 5082-1104 to -552-1229 to -614Measurement below LRV or sensor burnout (downscale)
Normal operating range4.0 to 20.0 mA5530 to 276480 to 276480 to 32767Valid process measurement. PLC scaling applies normally.
High alarm saturation20.0 to 21.0 mA27648 to 2932527648 to 2932532767 to 34714Measurement above URV or sensor burnout (upscale)
Hard fault over-rangeAbove 21.0 mAAbove 29325Above 29325Above 34714Transmitter failure, short circuit in loop or sensor damage
How to use this table in your PLC program
Add comparator blocks in your PLC program that check the raw count BEFORE the scaling formula is applied. If the raw count is outside the normal operating range (below Raw Min or above Raw Max), set a fault flag in a dedicated BOOL tag, inhibit the scaling output and write a substitute safe value (typically the last good value or a fail-safe value). This prevents the scaling formula from producing nonsense engineering values during a fault condition, which could trigger incorrect alarms or unsafe control actions.

PLC Internal Scaling vs External Raw Count Calculator

AspectPLC Internal Scaling Blocks (NORM_X/SCALE_X, SCP)External Raw Count Calculator
Where it runsInside PLC CPU, every scan cycleOutside PLC, on engineer's laptop or phone
PurposeReal-time conversion during plant operationVerification, commissioning checks, training and troubleshooting
Requires PLC connectionYes: needs online access to read live valuesNo: works offline with any raw count value
Formula visibilityHidden inside instruction block. Parameters must be opened to see.Fully visible. Every step of the calculation is shown.
Fault detectionPossible but requires additional logic blocksBuilt-in NAMUR status check on every conversion
Reverse scalingRequires separate instruction or custom codeDirect, same interface
Multi-brandEach brand has its own instruction setOne calculator handles all brands via preset selection
When to useProduction operation: alwaysDesign, commissioning, FAT, troubleshooting: always

Common Scaling Mistakes and How to Avoid Them

MistakeWhat goes wrongHow to prevent it
Using Raw Min = 0 on Siemens S7-1200At 4 mA (empty tank, zero pressure), the EU value shows negative instead of zero. The error grows at low signal levels and can be 20% wrong at 5 mA.Always use Raw Min = 5530 for 4-20 mA inputs on S7-1200. Confirm the raw count range from the module manual (ET200SP AI module datasheet).
Confusing AB 15-bit (32767) with Siemens (27648)Using AB parameters on a Siemens system (or vice versa) introduces a constant ratio error of 32767/27648 = 18.5%. At 50% signal, the reading will be 9.25% wrong.Always confirm the PLC brand and specific module used. Create a site engineering standard that lists Raw Min and Raw Max for every AI/AO module type used on site.
Not checking fault zones before scalingA broken wire gives a raw count of 0 on S7-1500. The scaling formula converts this to a negative pressure value. The DCS displays -0.36 bar. Operator assumes transmitter is working at slightly below zero rather than recognising a wire break.Add raw count range checks before every scaling block. If raw is outside [Raw Min, Raw Max], set a fault bit and hold the last good value or substitute a fail-safe value.
Applying the wrong formula for AO modulesThe raw-to-EU formula is used to write to an AO register instead of the EU-to-raw formula. The AO output is completely wrong.Remember: AI modules produce raw counts (read with raw-to-EU formula). AO modules accept raw counts (write with EU-to-raw formula). They are inverses of each other.
Ignoring transmitter suppressed zero rangesA flow transmitter with LRV = 100 m³/h (not zero) has EngMin = 100, not 0. Using EngMin = 0 makes the display read 0 when the actual flow is 100 m³/h.Always read the instrument datasheet or HART configuration for the actual LRV and URV. Do not assume LRV = 0.
Advertisement
Advertisement

Further Reading and External Resources

Trusted external resources on PLC analog scaling

Frequently Asked Questions: PLC Analog Scaling and Raw Counts

What is a raw count in a PLC?
A raw count is the integer output of the analog-to-digital converter (ADC) inside a PLC analog input module. When a 4-20 mA transmitter sends a signal, the AI module samples the current and converts it into a binary integer. This integer (the raw count) is what the PLC stores in its memory. A Siemens S7-1500 with a 4-20 mA input stores integers from 0 (at 4 mA) to 27648 (at 20 mA). The scaling formula then converts this integer into a meaningful engineering unit value.
What is the PLC analog scaling formula?
The standard linear scaling formula is: EU = ((Raw - RawMin) / (RawMax - RawMin)) x (EngMax - EngMin) + EngMin. Where Raw is the current raw count from the PLC AI register, RawMin and RawMax are the raw counts at 0% and 100% of range (varies by PLC brand), EngMin is the transmitter LRV and EngMax is the transmitter URV. The reverse formula for writing to an AO module is: Raw = ((EU - EngMin) / (EngMax - EngMin)) x (RawMax - RawMin) + RawMin.
Why is the Siemens S7-1200 raw count range different from S7-1500?
On the Siemens S7-1200, the 4-20 mA signal maps to raw counts 5530 to 27648. The range below 5530 is reserved by the module for under-range and diagnostic signalling. On the S7-1500 and S7-300/400, the 4-20 mA signal maps to 0 to 27648. Using the S7-1500 parameters (Raw Min = 0) on an S7-1200 system produces a wrong result: at 4 mA the reading shows negative instead of zero, and the error gets larger at low signal values.
What does NAMUR NE43 say about raw counts at fault conditions?
NAMUR NE43 defines that a 4-20 mA signal below 3.6 mA indicates a hard fault (broken wire, sensor failure) and above 21.0 mA indicates an over-range fault. In raw counts, these boundaries fall at: S7-1500 approximately -1104 (below 3.6 mA) and 29325 (above 21 mA). Allen-Bradley approximately -1229 and 34714 respectively. PLC programs should check raw counts against these boundaries before applying the scaling formula.
How do I calculate the resolution of a PLC analog input?
Resolution = (EngMax - EngMin) / (RawMax - RawMin). For a Siemens S7-1500 with a 0-100 bar transmitter: Resolution = 100 / 27648 = 0.00362 bar per count (3.62 mbar per count). For an Allen-Bradley ControlLogix with the same transmitter: Resolution = 100 / 32767 = 0.00305 bar per count. Higher Raw Max means more counts for the same engineering span, so finer resolution. A 12-bit module (0-4095) has coarser resolution: 100 / 4095 = 0.0244 bar per count (24.4 mbar per count).
What is the Siemens NORM_X and SCALE_X instruction?
NORM_X and SCALE_X are the built-in scaling instructions in Siemens TIA Portal for S7-1200 and S7-1500. NORM_X normalises an input value to a 0.0 to 1.0 floating point range based on defined min and max values. SCALE_X then scales this normalised value to any target engineering unit range. Together they implement the same formula as the manual calculation. The manual calculation (or an external calculator) is still needed to verify the parameters are correct before downloading to the PLC.

What we learn today

  • A raw count is the integer output of the ADC inside a PLC AI module. The scaling formula EU = ((Raw - RawMin) / (RawMax - RawMin)) x (EngMax - EngMin) + EngMin converts raw counts to engineering units. The reverse formula Raw = ((EU - EngMin) / (EngMax - EngMin)) x (RawMax - RawMin) + RawMin converts engineering values to raw counts for AO modules and verification.
  • Raw count ranges differ by PLC brand: Siemens S7-1500 uses 0 to 27648 for 4-20 mA. Siemens S7-1200 uses 5530 to 27648 (4 mA = 5530, NOT 0). Allen-Bradley ControlLogix uses 0 to 32767. Using the wrong Raw Min is the single most common cause of scaling errors at the low end of the signal range.
  • Resolution = (EngMax - EngMin) / (RawMax - RawMin). Siemens (27648 counts) and Allen-Bradley (32767 counts) both provide fine resolution. 12-bit modules (4095 counts) are six times coarser. Always calculate resolution for your application to confirm the module can resolve small process changes that matter for control or alarm purposes.
  • NAMUR NE43 defines 3.6 mA (under-range fault) and 21.0 mA (over-range fault) as boundaries. Always add raw count range checks in the PLC program BEFORE the scaling block. If raw count is outside the normal range, set a fault flag and hold the last good value rather than scaling a fault condition into a false engineering unit reading.

Leave a Reply

Your email address will not be published. Required fields are marked *