IMDTouchKnowledge BaseShop main store

Troubleshooting

Displaying a PLC counter current value with a signed HMI tag

HMI and touchscreens Published 6 min read

Short answer

The counter current value is missing from the HMI address list because the CLICK types CTD current values as a signed 32-bit double word, so the tag must be Signed Integer 32. When the minus sign is unacceptable, copy the CTD value to a plain DD register every scan and read that register as Unsigned Integer 32; keep the signed tag whenever the counter can count below zero.

On this page
  1. Why the tag data type gates the address list
  2. Expose the CTD address with a signed tag
  3. Remove the minus sign with a DD transfer register
  4. Worked example: a down counter at -3 counts read as Unsigned Integer 32
  5. Verify the display path end to end
  6. Questions asked

The counter current value is missing from the HMI address list because of the tag data type, not because the driver lacks counter support. AutomationDirect's CLICK documentation types the CTD counter current values CTD1 through CTD250 as Double Word Integer — a signed 32-bit value — so the driver offers CTD addresses only to a tag set to Signed Integer 32. In the reported CLICK-to-C-more setup, a tag set to Unsigned Integer 32 offered nothing but DD addresses, and switching that tag to Signed Integer 32 made the counter current value selectable. When the minus sign a signed tag can print is unacceptable on an operator screen, copy the CTD value into a plain DD register on every scan and read that register as Unsigned Integer 32. Below are both fixes, the rule that chooses between them, and the checks that prove the display.

Why the tag data type gates the address list #

An HMI tag combines a PLC address with a data type, and the address selector lists only the address classes whose documented type matches that tag. CLICK's memory map puts the counter current values CTD1 through CTD250 in the Double Word Integer class, while single-word integer cells such as TD1 through TD500 are 16-bit signed and span -32,768 to +32,767. A down counter can legitimately count past zero, which is why a signed type is the documented fit for the CTD class.

The deeper rule is that 32 bits carry no meaning on their own: the signed reading gives the top bit to the sign, the unsigned reading treats all 32 bits as magnitude, and the two ends must agree or the number is wrong before it looks wrong. The same agreement failure is why an HMI counter display jumps from 9 to 16 under a mismatched preset tag, and why an HMI writes the wrong PLC value above 9 when the tag type does not match the data.

One habit to drop: typing a CTD address into a tag whose selector will not offer it. An address the driver does not list for a given type can be rejected outright or read under the wrong interpretation, so match the type first and pick the address from the list.

Expose the CTD address with a signed tag #

Direct display is the first fix because it needs no ladder change and proves the communications path in one move.

  • Open the tag behind the numeric display and select the CLICK device it reads.
  • Set the tag data type to Signed Integer 32.
  • Reopen the address selector: the CTD current values now appear where the list previously offered only DD addresses.
  • Pick the counter current value, bind the tag to the numeric object, and send the project to the panel.
  • Run the counter through its normal sequence and compare the screen number against the live value in the PLC programming software.

Leave the ladder untouched during this test. The counter instruction can be perfectly healthy while the tag misreads it, and editing working logic before the display path is proven only adds variables to chase.

Remove the minus sign with a DD transfer register #

With the signed tag in place, the reported setup showed the remaining annoyance: once the down counter ran past zero, the screen printed a minus in front of the number. That minus is a correct reading of a negative count. If the sequence guarantees the value stays at or above zero and operators should never see a sign, move the display to a register:

  • Add one copy instruction to the CLICK program with the CTD current value as the source and DD1 as the destination, the register used in the reported fix.
  • Put the instruction on a rung that executes every scan, so DD1 tracks the counter instead of freezing between events.
  • Create the HMI tag for DD1, set it to Unsigned Integer 32, and bind it to the numeric display.
  • Dedicate DD1 to this display: no other rung, recipe or screen writes it, and the project notes say so, because two writers make the number look intermittently wrong.

Formatting on the screen decides when a sign prints, not what the bits mean, and hiding a sign on a misread value only disguises the fault. On a WinCC-based screen, the display-side rule that prints the minus only for genuinely negative numbers is covered in WinCC I/O field guide to showing the minus sign only for negative values.

The decision comes down to one question: can the raw count go below zero? If it can, keep Signed Integer 32, because the unsigned register prints a wrapped number instead of the true negative count — the arithmetic is in the next section. If it cannot, both tags print identical numbers from 0 through 2,147,483,647 counts and the register gives a sign-free screen.

Worked example: a down counter at -3 counts read as Unsigned Integer 32 #

Inputs. A CLICK down counter is loaded with a preset of 12 counts and receives 15 count pulses, so it passes zero by 3 and its raw current value is -3 counts; the preset, the pulse count and the -3 are this example's illustrative inputs, confirmed against the live value in the PLC software before any display is judged. The value sits in CTD1, which the CLICK memory map types as Double Word Integer (32 bits). The direct tag reads CTD1 as Signed Integer 32; the register tag reads DD1, copied from CTD1 every scan, as Unsigned Integer 32.

Rule. A 32-bit two's-complement value spans -2,147,483,648 to +2,147,483,647 when read signed and 0 to 4,294,967,295 when read unsigned. Any negative signed value v, read as unsigned, displays as v + 2^32.

Arithmetic. 2^32 = 4,294,967,296 counts, so the unsigned read is -3 + 4,294,967,296 = 4,294,967,293 counts. Cross-check from the top of the range: -1 is all 32 bits set and reads 4,294,967,295, and each further count down subtracts one, so -2 reads 4,294,967,294 and -3 reads 4,294,967,293.

Result. The direct signed tag shows -3; the register tag shows 4,294,967,293 for the same counter at the same moment.

Decision. The crossover is zero counts. While the current value stays at or above 0, both tags agree digit for digit; the first count below 0 separates them, and the gap is enormous — a 3-count overshoot reads as 4.3 billion. Keep Signed Integer 32 on any counter that can undershoot zero. Fit the DD register only where the sequence holds the count at or above zero; if operators must never see a negative number, gate the count input so the counter stops at zero rather than dressing up the display.

Verify the display path end to end #

Prove the whole path with three numbers visible at once: the live CTD current value in the PLC software, DD1 if you use the register, and the HMI display.

  • Record a known start value, trigger one count event, and confirm the CTD value steps by exactly one count.
  • Confirm DD1 follows without waiting for an unrelated machine state; if it stalls, the copy rung is not executing, so move it onto a rung that runs unconditionally.
  • Compare at the extremes the process uses: 0, the preset, the largest count in the sequence, and one deliberate run past zero if the sequence allows it.
  • Split any fault by where the numbers diverge: PLC correct with DD1 wrong points at the copy instruction; DD1 correct with the HMI wrong points at the tag, so recheck the data type, the address and the object binding before suspecting wiring.
  • After a project restore or a panel swap, recheck the tag type first, because communications can look healthy while one tag still points at the wrong address class.

Run these checks with the machine in a state where count pulses can be applied safely and nothing starts moving because of the test.

Questions asked

Why does my counter display turn negative near 32,768?

The tag is probably a 16-bit signed integer reading only the low word of the 32-bit counter value. A 16-bit signed word tops out at 32,767; the next count, 32,768, sets the top bit of the low word and a signed read shows -32,768. The CLICK CTD current values are 32-bit double words, so the tag must be a 32-bit type, and above 65,535 a 16-bit read is wrong even in unsigned form because the upper word is never looked at.

Does changing the tag type affect the counter logic?

No. The counter instruction keeps its own current value inside the PLC, and the tag only decides how the HMI driver interprets the bits it reads over the link. Moving a tag between Signed Integer 32 and Unsigned Integer 32 changes nothing in the ladder program and requires no PLC download; only the HMI project is edited and sent to the panel.

How quickly does the display track the counter?

The panel reads a copy of the value at its polling rate, not within the PLC scan, so a fast count can settle a screen update or two behind the PLC value. Verify against the live value in the PLC programming software, and judge the display only after the count has held steady long enough for at least one full update cycle.

Can several screens read the same transfer register?

Yes. Any number of tags and objects can read DD1 at the same time; the rule is that exactly one ladder instruction writes it. A second writer, whether another rung, a recipe, or a different screen, makes the number alternate between values and look intermittently faulty. Note the register as display-only in the project documentation so later edits do not reuse it.

Keep reading

  • Troubleshooting

    Diagnosing intermittent HMI to PLC Ethernet comms hangs

    Stop changing the topology. Put one packet capture where it can see the PLC-to-HMI unicast exchange — a mirror port or a tap, not a spare switch port — run it through at least three hangs with device logs on the same clock, set every panel update cycle to 1000 ms, and confirm the three devices hold unique IP addresses. Whether panel requests stop or PLC responses disappear decides which side you repair.

    HMI and touchscreens

  • Troubleshooting

    Displaying a PLC Real Value Over Modbus on an HMI

    An INTEGER display that reads the register proves the link, station and address, so a blank REAL display is a 32-bit mapping fault. Declare the HMI variable as a 32-bit float on the register pair (40064/40065), set the device double-word order to Low Word First to match the PLC, and give the numeric field six integer digits for 628402.0.

    HMI and touchscreens

  • How-to

    How to Scale a PLC Integer Into an HMI Display Value

    Divide the raw integer by 100 in an expression on the HMI variable and set the numeric field format to two decimal places: a register value of 4998 then displays as 49.98. The scaling tab rounds because its result stays an integer, which cannot carry a fraction; the expression evaluates the division as a real value before the field renders it.

    HMI and touchscreens