Worked problem

PLC Analog Input: Raw Counts to Engineering Units

Convert raw PLC input counts into temperature using stated counts at 4 mA and 20 mA, and find the raw-count value of an alarm threshold.

Controls & Instrumentation · Last reviewed

Given

A temperature transmitter measures 0 to 150 °C and outputs 4 to 20 mA. The PLC analog input module reports 6,400 raw counts at 4 mA and 32,000 raw counts at 20 mA (these are exercise values, check your module documentation). The input is currently 18,560 counts. A high-temperature alarm is required at 120 °C.

Find

The temperature and the current for 18,560 counts, and the raw-count value that corresponds to the 120 °C alarm.

Solution

EU = EU(min) + (counts − counts(4 mA)) ÷ (counts(20 mA) − counts(4 mA)) × (EU(max) − EU(min))
  1. Span in counts = 32,000 − 6,400 = 25,600.
  2. Fraction of span = (18,560 − 6,400) ÷ 25,600 = 0.475.
  3. Temperature = 0 + 0.475 × 150 = 71.25 °C.
  4. Current = 4 + 0.475 × 16 = 11.6 mA.
  5. Alarm at 120 °C: fraction = 120 ÷ 150 = 0.80, so counts = 6,400 + 0.80 × 25,600 = 26,880 counts (16.8 mA).

Answer

18,560 counts = 71.25 °C (11.6 mA) | 120 °C alarm = 26,880 counts

The zero is not at zero counts

A live-zero 4 to 20 mA signal puts 0% of the measurement at 4 mA, so the raw count at 0 °C is 6,400, not 0. Scaling from zero counts would give 18,560 ÷ 32,000 × 150 = 87 °C, wrong by about 16 °C. The live zero lets the PLC tell a true zero reading from a broken wire.

Detecting a fault

A signal below about 3.6 mA (5,760 counts here, using the usual NAMUR NE43 limit) is normally treated as a wire break or transmitter fault and not as a temperature. Add a check for it so the alarm does not read a broken loop as 0 °C.

Common mistakes

  • Taking 0 counts as 0 °C instead of using the count at 4 mA.
  • Using the wrong counts for the module and range. A different module or scaling setting changes both end values.
  • Setting the alarm in counts and later changing the range without updating it. Keeping the alarm in engineering units avoids this.
  • Integer division in the PLC code, which loses the fractional part of the span.

Related tools and labs

Calculators, labs and simulators are part of the All-Access Pass.

More worked problems

Questions

Why do some modules give 0 to 27,648?

Different manufacturers use different raw ranges. Always take the counts at 4 mA and 20 mA from the module manual or measure them.

How do I scale in the PLC?

Most PLCs have a scaling instruction that takes the raw minimum and maximum and the engineering minimum and maximum, and applies the same formula.

How is a 0 to 20 mA input different?

There is no live zero. The raw count at 0 mA is zero and 0% corresponds to 0 mA.

Educational material. Examples use simplified, hypothetical inputs and are not a design, a construction document or professional engineering advice. Confirm requirements with the codes and standards adopted where the work is built and with a licensed engineer.

← All worked problems