IMDTouchKnowledge BaseShop main store

Troubleshooting

Why an HMI counter display jumps from 9 to 16

PLCs and controllers Published 9 min read

Short answer

The counter stores each count in BCD and the HMI tags are typed as integers, so the word for 10 reads as 16 and a preset of 25 arms the counter at 19. Set both the preset-entry tag and the accumulator-display tag to BCD int 16, keep the addresses, and use BIN only when ladder logic needs binary.

On this page
  1. Why does the counter display jump from 9 to 16?
  2. Why does the machine index before the preset count is reached?
  3. How do I confirm the counter value is stored as BCD?
  4. What data type should the HMI tags use for a BCD counter?
  5. Why didn't changing the V-memory format to decimal fix it?
  6. How do I convert a BCD counter value to binary for ladder logic?
  7. How do I prove the fix before releasing the machine?
  8. Questions asked

The counter is not losing parts; the HMI is using the wrong number system at both ends of the word. A BCD counter packs each decimal digit into its own four-bit group, so the count 10 sits in memory as a word a plain integer tag evaluates as 16 — exactly the jump on the panel. Set every HMI tag that touches the counter, the preset-entry tag and the accumulator-display tag alike, to the 16-bit BCD type instead of integer, keep the addresses as they are, and let operators keep entering plain decimal. Convert to binary with the BIN instruction only where ladder logic itself needs ordinary arithmetic. On the machine that showed this symptom, changing the two tag data types to BCD int 16 was the whole fix: the display tracked the counter again and the magazine indexed at the entered count.

Why does the counter display jump from 9 to 16? #

The jump is a data-type mismatch, not a counting fault: the counter stores the count 10 in BCD as 0001 0000, and an HMI tag typed as a plain integer evaluates that same bit pattern as 16, so the panel leaps from 9 to 16 in one step.

BCD packs each decimal digit of the count into its own four-bit nibble, so the 16-bit word holds four decimal digit positions side by side. Counts 1 through 9 occupy only the units nibble, where BCD and binary are bit-for-bit identical, which is why the fault hides until a second digit appears. Worked example, the exact transition in the symptom: at a true count of 10 the counter stores 0000 0000 0001 0000. Read as a binary integer, that word is (1 × 16) + (0 × 1) = 16, so the panel steps from 9 to 16 and never shows 10 through 15.

True count Word in memory (BCD) Integer tag displays Display error
9 0000 0000 0000 1001 9 0
10 0000 0000 0001 0000 16 +6
11 0000 0000 0001 0001 17 +6
16 0000 0000 0001 0110 22 +6
25 0000 0000 0010 0101 37 +12
99 0000 0000 1001 1001 153 +54

The pattern behind the table: each step of the tens digit adds 16 to an integer readout but only 10 to the counter, so the displayed value runs 6 ahead per tens digit carried — 6 ahead at 10, 12 ahead at 20, 54 ahead at 99. An HMI tag whose data type disagrees with the PLC word produces this family of wrong numbers in other forms too, as in why an HMI writes the wrong PLC value above 9.

Why does the machine index before the preset count is reached? #

The early index is the same mismatch running in the write direction: the counter expects its preset as BCD, the integer tag delivers it as binary, and the counter arms low — a preset of 25 entered normally arms the counter at 19 parts.

The arithmetic runs opposite to the display fault. You enter 25; the integer tag writes 25 = 16 + 8 + 1, the word 0000 0000 0001 1001, hexadecimal 0019. The counter's BCD decoder reads the nibbles as decimal digits — 0, 0, 1, 9 — and arms at 19 parts, six early. The shortfall is not a constant: a preset of 100 writes 0x0064, which BCD reads as 64 (36 early), and 150 writes 0x0096, read as 96 (54 early). Because the gap depends on the digits entered, no fixed offset or enter-a-larger-number habit can compensate it, which is also why the fault looked random across products running different presets. Do not tune the preset upward to mask it; the entered, displayed and armed counts only agree again once the tag type is corrected.

How do I confirm the counter value is stored as BCD? #

Compare two views of the same word: when the counter status in the PLC programming software steps 9, 10, 11 while the panel steps 9, 16, 17 across one transition, memory holds BCD and the panel's tag data type is the fault.

The comparison costs one count transition and no extra hardware. The counter box in DirectSOFT decodes the instruction's own structure, so place panel and software side by side and watch the 9-to-10 step. The raw memory view confirms the fingerprint: the accumulator address reads 0010 in hexadecimal, four digit positions carrying the decimal digits 0, 0, 1, 0. A binary counter would show the same number in both places, so it is this 9-10-16 triple that pins BCD. Chapter 5 of the PLC user manual, Standard RLL Instructions, documents these counting instructions together with the BIN and BCD conversions built for exactly this boundary; verify your counter against that document before editing tags.

What data type should the HMI tags use for a BCD counter? #

Set both tags — the numeric input writing the preset and the numeric display reading the accumulator — to the 16-bit BCD entry in the tag's data-type list, shown there as BCD int 16, and leave each V-memory address exactly as it is.

The data type is the conversion, not the cosmetics: it tells the panel how to encode what the operator types and how to decode what comes back. Format fields such as digit count and decimal point only shape the rendering afterward, so no format setting can substitute for the type.

  • Open every tag that touches the counter. The preset input and the accumulator display are separate tags, each with its own data type — fixing the write does not fix the read, which is exactly why the display stayed wrong after the counter itself behaved.
  • Change each tag's type from integer to BCD int 16 and leave the V-memory address, the counter reference and any scaling fields untouched.
  • Sweep for duplicates: a second display, a recipe entry or a logging tag on the same word carries its own type and fails on its own.
  • Apply or download the project by the panel's normal procedure, with the machine held, then enter a known test preset.

With the types set, entering 25 writes 0x0025 and the counter arms at digit group 0025, which is 25; the accumulator word 0x0010 decodes to digits 1 and 0 and the panel shows 10. The conversion now happens in one place, the tag boundary, and each side sees its native format.

Why didn't changing the V-memory format to decimal fix it? #

The V-memory format selector only changes how the programming software renders a word on your screen; it cannot change what the counter instruction expects or what the HMI panel puts on the wire, so the display format changed and the counts did not.

Three layers sit between the operator's number and the count. The word in memory is fixed by the counter's design: BCD, not configurable. The programming software's view is the V-memory format selector, a rendering choice for your screen — decimal, hexadecimal, either way the bits stay put. The panel's tag data type is the only layer that actually converts, and it was the only layer that was wrong. Changing the selector re-rendered the word inside the software and moved nothing on the wire; the counter kept expecting BCD and the panel kept sending binary. That is why the symptom survived every format change, and why the fix had to land on the tags.

How do I convert a BCD counter value to binary for ladder logic? #

Keep the counter words in BCD and convert a copy when logic needs ordinary arithmetic: the BIN instruction turns a BCD word into binary, the BCD instruction does the reverse, and the three-rung sequence LD CTA0, BIN, OUT V2000 stores counter 0's accumulator as binary in V2000.

LD    CTA0
BIN
OUT   V2000

CTA0 is counter 0's accumulator as the programming software names it, and V2000 receives the binary equivalent. Prove it by value: with the accumulator showing BCD 0010, V2000 reads 000A hexadecimal, and 0x000A = 10, so both words are the count 10 in their own systems. Point comparisons and calculations at V2000, never at the raw accumulator word.

The BIN instruction has one job — re-encoding a four-digit BCD word as its binary equivalent — and how the BIN instruction converts BCD words to binary steps through that re-encoding digit by digit. The reverse direction matters just as much: when a calculation produces a preset in binary, the BCD instruction converts it back before it lands in any BCD word or BCD-typed tag.

In DirectSOFT Release 5 the same conversion fits inside a MATHBIN IBox: the expression BIN(CTA0) converts the accumulator before the box evaluates, and because MATHBIN computes entirely in binary, every BCD operand must be wrapped in BIN individually. The rule crosses PLC families — a raw BCD operand fed into ordinary addition or subtraction produces garbage anywhere — and why BCD values must be converted before binary addition and subtraction works the same arithmetic on a different controller to the same conclusion.

How do I prove the fix before releasing the machine? #

Run the boundary, not a single value: with the machine held from production, step the count through 9, 10 and 11 and compare panel, counter status and index behavior at each step; the fix is proven when all three agree across the transition.

Treat a mis-armed counter as a motion hazard until this test passes: a preset that arms low fires the index earlier than any operator intended, so keep the station guarded or held while presets and tag types change.

  • Enter a preset whose BCD and binary forms differ — 25 is ideal — and read it back in the counter status; it must show 25, not 19.
  • Step the count through 9, 10 and 11 by the approved commissioning method and confirm the panel tracks the counter box exactly through the transition.
  • Let a dry run reach the preset and confirm the index fires on the entered count.
  • Repeat with 150: it must arm at 150, never at 96, because a tag still typed as integer passes small single-digit tests and fails here.
  • Restore the production preset and record the tag types you changed, so the next copy of the panel project inherits them.

The decision, case by case. Display jumping from 9 to 16: the accumulator tag goes to BCD int 16. Indexing early: the preset tag goes to BCD int 16, same address. Ladder logic that must do arithmetic: BIN a copy into a binary word such as V2000 and compute there, converting results back with BCD for anything BCD-typed. Format selector: leave it alone; it renders and decides nothing. Every case in this fault resolves at the tag data type — the counter, the ladder and the operator's entry habits stay as they are.

Questions asked

Does a 16-bit BCD tag limit the largest count the panel can show?

Yes. Four BCD digits in one 16-bit word reach 9999, while a 16-bit binary word reaches 65535. If the process can legitimately exceed 9999 counts, one word is not enough: use the larger BCD arrangement your PLC documents, or a binary counter with a BIN-converted copy for the panel. Check the counter's documented range before trusting a single-word preset.

What happens to a count that is not a valid BCD pattern?

An integer tag can place a nibble above 9 into the word: integer 15 writes 0000 1111, whose low nibble is hexadecimal F, and F is no decimal digit. Conversions and counters meeting such a word either set an error or produce a meaningless number, so counts can scramble or vanish rather than merely shift. One more reason the tag type, not the entered value, must carry the format.

Can operators just enter the decimal equivalent of the hex pattern instead?

Arithmetically it works: with an integer tag, entering 16 stores 0x0010, which the BCD counter reads as 10, and a preset of 150 entered as 336 lands correctly too. It is still the wrong fix. Every preset takes a mental hex-to-decimal conversion, one slip arms the wrong count, and the accumulator display stays wrong regardless. Typing the tags BCD removes the entire exercise.

Do timer values follow the same BCD convention on this PLC family?

Yes. Timer and counter current values and presets in this family are BCD words in the same way, so an HMI numeric input on a timer preset needs the BCD tag type as well, and a timer accumulator used in a calculation needs BIN before the math. The symptom looks different — a time too short or too long instead of an early index — but the tag fix is identical.

Why did counts below 10 never expose the problem during earlier testing?

Every decimal digit from 0 through 9 has the identical four-bit pattern in BCD and in binary, so single-digit counts cannot reveal the mismatch. The representations first diverge at 10 and diverge wider with every added digit position. Any test for this fault needs at least one two-digit value, and the step across 9 is the cheapest place to watch it happen live.

Keep reading

  • Troubleshooting

    Why an HMI Writes the Wrong PLC Value Above 9

    When an HMI display and its PLC register agree up to 9 but the PLC then reads 16 for a setting of 10, 25 for 19 and 32 for 20, the HMI tag is encoding BCD into a binary register. Set the tag data type to Signed Int 16, download, and step through the full range to confirm both numbers match.

    HMI and touchscreens

  • How-to

    How to Display a Time-Until-Closed Countdown on an HMI

    Display time until closed by computing the timer preset minus the accumulated value (.PRE - .ACC) in the PLC and binding the numeric display to that result. Clamp the value to zero when the done bit sets, keep the operator's duration in its own tag, and let the timer-done rung in the controller close the valve - never the panel.

    HMI and touchscreens

  • How-to

    Display large PLC array history on an HMI with a buffer page

    Put a display buffer in the PLC sized to one visible page (10 rows here) and let the HMI show only that. On each page change the PLC clamps a start index and copies the requested slice of four 5000-entry test arrays plus a timestamp array into five 10-element buffers, so 1000 exposed entries become 100 pages and 50 HMI-facing values instead of one object per tag.

    HMI and touchscreens