HMI Date Time Display Errors: Troubleshooting BCD vs Decimal

Karen Mitchell9 min read
HMI / SCADAOther ManufacturerTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Problem Overview

After importing PLC routines from a working cell into a new cell and adjusting tag designations, the HMI displays date and time values that are significantly offset from the actual controller clock. A typical symptom is the displayed date drifting by approximately half a month (≈14–16 days), while the PLC's internal real-time clock continues to advance correctly. The HMI hardware clock is set correctly on both units, ruling out battery, RTC, or panel-side configuration issues.

This class of fault almost always traces to a data representation mismatch between the PLC clock registers and the HMI's numeric object format. The most common root cause is a BCD (Binary-Coded Decimal) versus binary/decimal interpretation mismatch at the display object or tag-mapping layer.

Root Cause: BCD vs Decimal Interpretation

Many integrated PLC/HMI controllers store clock values in BCD format in dedicated system registers. Each decimal digit of the date or time is encoded in a 4-bit nibble, so a value like 28 (day) is stored as 0x28 in the register, not 0x1C (the binary equivalent of 28).

Date Element Decimal Value BCD Encoding (Hex) Binary Interpretation (Hex)
Day 28 0x28 0x1C
Hour 14 0x14 0x0E
Year (2-digit) 26 0x26 0x1A
Month 12 0x12 0x0C

If the HMI numeric display object or the tag-mapping function block is configured to interpret the register as a straight binary/decimal word rather than BCD, the value shown will be mathematically wrong. For day=28, the display would render 0x1C = 28 (coincidentally identical for values under 32), but for day=29 it would show 0x1D = 29. The offset becomes clearly visible on month, day, and year boundaries.

Why a Half-Month Offset Appears

A consistent offset of approximately 14–16 days is a strong indicator of a BCD/binary mismatch. When the controller writes the day-of-month register using BCD and the HMI reads it as a binary integer, the displayed day becomes a non-linear, multi-digit value that cannot be mapped back to a real calendar date. Because BCD uses only values 0x00–0x99 per byte and binary uses 0x00–0xFF, the apparent "drift" depends on which digits are affected.

For example, if the day register contains BCD 0x31 (= decimal 31) but is read as binary, it is interpreted as 49. The HMI may then attempt to render 49 as a day, and depending on the display logic, may roll over into the next month or display garbage. Repeated across month boundaries, the cumulative appearance is a date that is roughly half a month off from the actual clock.

Diagnostic Procedure

  1. Identify the clock source registers. List every PLC tag and system register that contributes to the HMI date/time display. Common register blocks include seconds, minutes, hours, day, month, and year (often two-digit). On integrated PLC/HMI platforms these are typically fixed system words (e.g., SR, SYS, or platform-specific names).
  2. Inspect the tag name mapping. Confirm that the new cell's tag database points to the same clock source registers as the working cell. Renaming or aliasing tags during import can silently re-route the display to an unrelated word, a counter, or a constant.
  3. Read the raw register values. Use the PLC programming software's online monitor to view the raw word at each clock register. Note the hex value displayed in the monitor.
  4. Check the HMI numeric object format. Open the HMI screen object that displays the date or time. Inspect the data type and format attributes. Common settings: Signed Decimal, Unsigned Decimal, BCD, Hex.
  5. Compare the two interpretations. Manually convert the raw hex register value as BCD and as binary. The interpretation that matches the PLC's actual clock is the correct format for the HMI object.
  6. Verify against the controller clock. Cross-check the PLC's system clock value (usually available in a diagnostics or status screen) against the value shown on the HMI. If the PLC clock is correct but the HMI displays an offset, the mismatch is at the HMI object or tag-mapping layer.

Solution: Correcting the Data Format

Once the BCD vs decimal mismatch is confirmed, apply the correct format to the HMI numeric display object.

Option A — Change the HMI Object Format to BCD

  1. Open the screen containing the affected date/time display.
  2. Select the numeric display object.
  3. In the object's properties, locate the Data Format, Display Format, or Numeric Format field.
  4. Change the format from Decimal or Binary to BCD.
  5. If the platform offers a "BCD word" or "BCD byte" option for multi-digit values, select the appropriate width (byte for 2-digit fields, word for 4-digit fields).
  6. Compile and download the corrected screen to the HMI.

Option B — Add a Conversion Function Block in the PLC

If the HMI platform does not natively support BCD display for the object type, insert a conversion routine in the PLC that reads the BCD clock register and outputs a binary integer to an intermediate tag used only by the HMI.

// Pseudo-logic for BCD → Binary conversion of a clock register
RawWord := ClockRegister;        // e.g., 0x31 for day 31
HighNibble := (RawWord >> 4) & 0x0F;
LowNibble  := RawWord & 0x0F;
BinaryOut  := (HighNibble * 10) + LowNibble;  // 0x31 → 31

Repeat this conversion for each date/time field (day, month, year, hour, minute, second) and expose the binary results as the HMI-facing tags.

Option C — Re-Alias the Tag to the Correct Register

If tag renaming during import caused the display to read from a non-clock register, correct the alias so the HMI reads from the system clock source exactly as in the working cell. This is the safest fix because it preserves the original data flow and avoids format-specific code in the HMI.

Verification Steps

  1. After applying the fix, place the controller in run mode and force a clock update, or wait for the next minute rollover.
  2. Observe the HMI display for at least one full day boundary (midnight) and one full month boundary to confirm the date increments correctly.
  3. Verify the year field at the next year rollover if practical; BCD-encoded years are a common failure point.
  4. Compare the HMI-displayed date/time against an independent reference (PC clock synchronized via NTP, or a secondary indicator).
  5. Document the corrected tag database and export the project for backup before any further modifications.

Troubleshooting Matrix

Symptom Likely Cause Recommended Action
HMI date off by ~14–16 days BCD vs binary mismatch on day/month register Set HMI object format to BCD or add conversion FB
HMI time shows non-numeric or static value Tag alias points to unused or constant word Re-alias tag to system clock source
HMI date correct at boot, drifts over weeks Display reads from application counter instead of RTC Switch tag to dedicated clock register
Year field shows wrong century or jumps BCD overflow on two-digit year Verify BCD width is byte (not nibble) for year field
Both HMIs show wrong time, PLC clock correct Common tag mapping error in imported routine Compare tag-by-tag against working cell's database
HMI clock resets at power cycle Battery or RTC configuration issue (not a format problem) Replace battery, verify RTC settings in HMI setup menu

Preventive Measures for Future Routine Imports

  • Export the full tag database from the source cell before importing into the target cell. Diff the two databases to identify any tag remapping that occurred during import.
  • Maintain a clock-register reference sheet for the specific PLC/HMI platform, documenting which system words hold seconds, minutes, hours, day, month, and year, and the native encoding (BCD vs binary).
  • Use platform-native clock function blocks rather than reading raw system registers, when available. Native blocks handle encoding internally and reduce the chance of format mismatches.
  • Validate date/time displays immediately after import, before deploying the project to production. A 24-hour burn-in test catches most BCD/binary mismatches and RTC drift issues.
  • Lock down tag renaming during import workflows. If tag names must change for cell-specific reasons, document every alias and verify clock-related tags remain mapped to the correct source registers.

Edge Cases and Platform Notes

Some integrated PLC/HMI platforms expose the real-time clock as a structured tag (e.g., Clock.Year, Clock.Month) rather than as raw registers. In these environments, BCD/binary mismatches are less likely because the platform handles encoding in firmware. However, when routines are imported across platform versions or when user-defined tags are used as intermediaries, the structured tag may be bypassed and the raw register exposed to the HMI display object.

Another edge case occurs when the HMI's numeric display object supports only unsigned decimal but the clock register contains a signed value for fields like day-of-week (where Sunday = 0 or 7 depending on convention). A signed interpretation of 0xFF yields -1, which may render as a blank or as an out-of-range day. Always verify signed/unsigned settings in addition to BCD/binary.

Note: When the HMI platform is unspecified (as is common in field troubleshooting), begin with the assumption that the clock registers are BCD-encoded. Integrated PLC/HMI platforms from multiple manufacturers have historically used BCD for clock storage. If BCD correction does not resolve the offset, proceed to inspect tag aliases and RTC configuration as secondary causes.

FAQ

Why is the HMI date about half a month off after importing a PLC routine?

A half-month offset is a classic symptom of a BCD vs binary/decimal data format mismatch on the PLC clock register feeding the HMI display. The HMI object is interpreting a BCD-encoded register as a straight binary integer, causing the displayed day or month to map to a non-real calendar value. Change the HMI object's data format to BCD, or add a BCD-to-binary conversion function block in the PLC.

How do I check whether a PLC clock register is BCD or binary?

Read the raw register value in the PLC programming software's online monitor and note the hex value. Convert the same value two ways: as BCD (each nibble is a decimal digit) and as binary integer. The interpretation that matches the actual clock (e.g., day = 14, hex 0x14) is the correct format. If the hex value already looks like a decimal number (0x14 for 14, 0x31 for 31), the register is almost certainly BCD.

Can renaming tags during routine import cause date/time errors?

Yes. If a clock-related tag is renamed or re-aliased during import, the HMI may end up reading from an unrelated register, a constant, or an application counter. Always compare the tag database of the imported project against the working source project, focusing on any tag that feeds a date or time display object.

Do I need to replace the HMI battery if the clock is wrong?

Not necessarily. If the HMI hardware clock (visible in the panel's system menu or setup screen) shows the correct time but the displayed date/time on the application screen is wrong, the battery and RTC are functioning. The fault is in the data path between the PLC clock registers and the HMI display object, not in the HMI hardware clock itself.

What is the fastest way to verify a BCD/binary fix?

Apply the corrected format, place the controller in run mode, and watch the display across at least one midnight rollover. If the date increments from 28 to 1 of the next month correctly, the BCD interpretation is correct. If the display shows values above 31 or jumps unexpectedly, re-check the object format and tag mapping.

Back to blog