The trend records the value stored in the tag you select; scaling and decimal placement belong to the numeric display. Compute a floating point tag from the raw signed 16-bit integer, divide by 1000.0, and point the trend at the result: raw 6490 plots as 6.49 pH instead of 6490.
Your trend is doing its job. A trend object records and plots the value stored in the tag it is pointed at. The scaling you set on a numeric display is drawing-time formatting: it turns raw 6490 into 6.49 pH on screen while the tag itself still holds 6490. A trend has no per-tag scaling layer, so the trace draws in counts. Stop asking the trend to scale. Compute a floating point engineering tag from the raw signed 16-bit integer and point the trend at the new tag. This article works a pH loop as the example: raw 6490 means 6.49 pH, so the divisor is 1000.
Why the trace shows 6490 when the display shows 6.49
A numeric display applies its scaling when it draws. Raw range, engineering range and decimal places live in the object, and the tag keeps the integer the whole time. A trend samples the tag and draws what it finds. Trend control objects in major HMI packages document themselves as displaying tag values from the current process or from the log, and published sample programs trend integer tags placed straight on the object. The integer plots as an integer.
The trend's own scale setting belongs to the axis. In one documented HMI, a trend's runtime scale is a percentage range, 0 to 100, of the trended tag's engineering unit range: the setting picks which slice of the range the axis draws. The plotted numbers stay whatever the tag holds, so a counts tag draws counts under an axis labeled in pH. Read your own HMI's trend object page for the exact fields.
If your trend object offers raw and engineering range fields, setting raw and engineering units on an HMI trend covers what each field changes. And when the trace misbehaves in other ways while the on-screen number looks right, why an HMI trend graph spikes while the number stays stable walks the same split between the number's path and the trace's path.
What each symptom points to
Match your trace to one of these before touching anything.
- Trace in the thousands while the display shows a decimal value. The trend is bound to the raw counts tag and no conversion exists yet. In the pH loop here, that is 6490 plotted against a display showing 6.49.
- Trace steps in whole numbers and holds flat for long stretches. The conversion ran in integer arithmetic. Raw 6000 to 6999 all divide to 6, so a band worth 1.000 pH draws as one flat line.
- Trace falls to 0 where the reading should be negative. Integer division truncates toward zero, so raw -490 computes 0, or the destination tag is an integer that cannot hold -0.49.
- Trace pegged at the top of a sensible axis. The axis is set for 0.00 to 14.00 pH while the data is still counts in the thousands.
- Trace off by a clean multiple such as 10 or 1000. The divisor is wrong or missing. The same arithmetic family appears in HMI shows the value ten times too small and in why the scale value differs from the PLC analog input.
Check the pair before you change anything
- Capture one trusted pair at the same moment: the raw counts and an engineering reading you believe. In the pH loop, raw 6490 against a trusted 6.49 gives divisor 6490 / 6.49 = 1000. A range note such as 10000:1000 points to the same divisor here, but you scale to the pair you measured.
- Confirm the source tag type. A signed 16-bit integer spans -32,768 to +32,767, which tells you the sign survives the input and fixes the conversion path.
- Leave the transmitter scaling, the raw tag and the old trend alone until the new value is checked against two known points. Until then the new trace is a diagnostic only, and nobody should act on it.
The fix: compute a real tag and trend that
- Create a floating point tag in the controller. The example calls it pH_eng; use your project's naming standard. It must be a new tag: a 16-bit integer cannot hold 6.49, and writing a scaled value back over the raw counts destroys the reference and every consumer that expects counts.
- Compute pH_eng = raw / 1000.0 every scan. Write the divisor as a real constant, 1000.0, and where the instruction set separates integer and real math, convert the signed integer to real first. Controller instruction sets document copy and conversion instructions for moving data between integer and floating point registers; your controller's instruction reference names the one for yours. Integer-first division is the bug you are fixing: 6490 divided by integer 1000 gives 6.
- Point the trend at pH_eng. Leave the numeric display where it is, or point it at pH_eng and drop its scaling. Keep a small raw-counts readout beside the trace either way.
- Prove it with motion. Let the process move through two known points while you watch raw counts, pH_eng and the trace together. Add one negative reading if the instrument can produce a valid one: raw -490 must draw as -0.49.
| Where the conversion lives | Use when | What the trend receives |
|---|---|---|
| Controller, new real tag | The controller runs real math | A real engineering value, also available to alarms, historians and other screens |
| HMI internal real tag | The controller cannot change, and the HMI documentation shows real math on internal tags | A real value inside the HMI only; confirm the trend accepts internal real tags |
| Copy into a second integer register | Never fixes the trace | The same 6490 counts, plotted as 6490 |
Example: raw 6490 to 6.49 pH
Take one reading with raw 6490 in the signed 16-bit tag and a trusted handheld showing 6.49 pH.
- Pair check: 6.49 x 1000 = 6490, so divisor 1000 is right.
- Real path: pH_eng = 6490 / 1000.0 = 6.49. The trend plots 6.49 pH.
- Integer path, for contrast: 6490 / 1000 in integer arithmetic gives 6 with remainder 490 discarded. The trace plots 6 pH, which is 0.49 pH low at this reading, about 7.6% (0.49 / 6.49 = 0.0755).
- Flat band: every raw value from 6000 to 6999 computes 6, so 1000 counts, worth 1.000 pH, draw as a horizontal line.
- Sign: raw -490 gives -490 / 1000.0 = -0.49 on the real path; integer division truncates toward zero and plots 0.
- Range: signed 16-bit spans -32,768 to +32,767 counts, which divides to -32.768 to +32.767 pH. The 0.00 to 14.00 pH span needs raw 0 to 14000, well inside. One count is 0.001 pH, finer than the display needs.
The decision, case by case
If the controller runs real math, the rung in the fix above is the whole job, and it is the best case: the engineering value becomes available to alarms, historians and every screen, and you can test it at the source with the controller online.
If the controller cannot change, use the HMI's internal real tag, provided the HMI documentation shows real-number math on internal tags and the trend accepts internal real tags. Scaled integer math when your PLC has no floating point keeps arithmetic alive on an integer-only controller, but a trace with decimals still needs a tag that holds decimals, so the conversion lands in a real tag somewhere.
Two routes that look tempting and fail:
- Rescaling the RTU or transmitter into an integer engineering value. 6.49 stored in an integer is 6. That truncates at the source and breaks every consumer of counts.
- Relabeling the axis and leaving counts on the trace. Axis settings pick the slice of the range to draw, as covered above; they convert nothing.
Once the trace follows the engineering value, write the divisor and the tag roles into the project notes so the next engineer does not rediscover the factor of 1000. For a value the crew needs from across the floor, how to display a PLC counter value where operators can see it covers placement and letter size, and more fixes for floor screens sit in the shop-floor screens section.
Recommendation: Add one real tag in the controller, compute engineering = raw / 1000.0 with a real divisor, and point the trend at that tag. Keep the signed 16-bit raw tag untouched for the numeric display, alarms and diagnostics. Move the calculation into an HMI internal real tag only when the controller cannot hold reals and the HMI's own documentation shows real-number math on internal tags; if the trend object accepts only integer tags, put the conversion in the controller or in a device between them that stores reals.
Questions
Is the divisor always 1000?
No. The divisor comes from a measured pair. With raw 6490 matching 6.49 pH, the divisor is 6490 / 6.49 = 1000. A different instrument range changes it: a 0 to 32767 count input scaled to 0.0 to 100.0 units divides by 327.67. Capture one raw and engineering pair from your own instrument, then divide raw by engineering to get your divisor.
How tall is each flat step when integer division truncates?
One whole engineering unit. With divisor 1000, raw 6000 to 6999 all compute 6, so the step is 1000 counts or 1.000 pH tall. With divisor 10, raw 10 to 19 all compute 1, a step of 10 counts that is also 1.0 unit tall. Whole-unit staircasing on a trace that should show fractions is the signature of integer arithmetic.
Why keep the raw integer tag after the fix?
The raw counts feed the numeric display's own scaling, any alarms set on counts, and downstream logic such as a historian that expects counts. Keeping the tag lets you park a raw readout beside the trended engineering value when the trace looks wrong, and it leaves one place to compare when the sensor or the input card is in doubt.
Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.