Convert a seconds counter to minutes and seconds on an HMI

7 min read · Published November 10, 2026

Divide a seconds counter's accumulated count by 60 with an integer divide: the quotient is minutes and the remainder, which stays between 0 and 59, is seconds. Dividing by 600 fits a tenths-of-a-second count base, not a one-second pulse like SP4, and it leaves 0 to 599 in the seconds field. The rung is five instructions: LD CTA10, DIV K60, OUT to the minutes word, POP, OUT to the seconds word.

A seconds counter becomes minutes and seconds with one integer divide: divide the accumulated count by 60 and the quotient is the minutes, while the remainder is the seconds. Dividing by 600 is the tenths-of-a-second habit carried over from timer presets; on a count that advances once per second it steps the minutes once every 10 minutes and leaves a three-digit value in the seconds field. This article takes one counter pulsed once per second, converts it into a minutes word and a seconds word in five instructions, and checks the result at the first minute boundary.

How do you convert a seconds counter into minutes and seconds?

Divide the accumulated count by 60 with an integer divide: the quotient is whole minutes and the remainder is seconds, which the math holds between 0 and 59, so the rung is LD CTA10, DIV K60, OUT minutes, POP, OUT seconds.

The divisor follows the count's time base: a count that advances once per second divides by 60, the number of those counts in one minute. The example project behind the numbers here runs counter CT10 from SP4, the special relay that closes once each second, so its accumulated word counts seconds. The rung loads that word as CTA10, the same value is visible in V1010, and the HMI minutes field already points at V2242. Getting the raw count onto a screen in the first place is its own job, covered in how to display a PLC counter value where operators can see it.

What does one counter increment actually represent?

Confirm the count's time base before you pick the divisor: SP4 in this example is the special relay that pulses once each second, so the counter gains one count per second and one count equals one second.

Verify it before editing anything. Watch V1010 run for 10 seconds: a one-second pulse adds about 10 counts. The rule that picks the constant is counts per minute. One count per second means 60 counts per minute, so the constant is K60. One count per tenth of a second means 600 counts per minute, so the constant is K600. The wrong constant on otherwise correct math still returns a quotient and a remainder, which is why a bad time base can look half-plausible: with K600 on a seconds count the quotient moves only once every 600 counts, so 10 real minutes pass before the minutes digit ticks.

What do you need before you edit the rung?

You need three addresses confirmed: the word that holds the live count, the minutes word the HMI already points at (V2242 in this example), and a separate word for the seconds result.

Confirm them in this order:

  1. The live count word. Load CTA10 and watch the value; it must step about once per second while the pulse relay runs, and it must match the V1010 value the display side reads. If the rung input and the watched word disagree, fix the addressing first: a correct divide cannot repair a stale source.
  2. The minutes destination. V2242 in this project, already mapped to the HMI minutes field.
  3. A separate seconds word. Pick an unused word, map the HMI seconds field to it, and write the two results to two words; the seconds store overwrites the minutes if they share one.

Fix the conversion in the PLC, not in the HMI number format: a display format cannot turn a wrong remainder into a right one.

How do you enter the divide and remainder rung?

Enter the five instructions in this order: load the counter's accumulated value with LD CTA10, divide by K60, store the quotient to the minutes word, run POP to pick up the remainder, and store it to the seconds word.

Enter it as one rung:

LD   CTA10      ; the counter's accumulated count in seconds
DIV  K60        ; quotient = whole minutes, remainder = seconds
OUT  minutes    ; V2242 in the example project
POP             ; remainder left by the divide, 0 to 59
OUT  seconds    ; a separate word mapped to the HMI seconds field
  1. LD CTA10 loads the accumulated count; use the operand your own project proved in the section above.
  2. DIV K60 divides by the constant 60, and the quotient is the minutes.
  3. OUT minutes stores the quotient in V2242.
  4. POP retrieves the remainder the divide left behind.
  5. OUT seconds stores that remainder in the seconds word.

Keep POP immediately after DIV K60, as the rung shows; that order is what puts the remainder, and nothing else, in the seconds word. If the controller rejects the syntax or the registers misbehave, read the instruction reference for the installed controller instead of guessing at variants: not every instruction set uses a stack. On some families the integer divide leaves the quotient in the destination word and the remainder in the math register immediately after it, and a knowledgebase page on capturing a DIV quotient and remainder from the math registers walks through that layout.

Recommendation: divide by K60 and take the remainder with POP whenever the counter is pulsed once per second, as SP4 pulses here; keep K600 only for a count base of tenths of a second, and then divide its remainder by 10 again, with SHFR K4 on a BCD word, before the value reaches the seconds field.

What happens if you divide by 600 instead of 60?

K600 treats every count as a tenth of a second: on a count that advances once per second, the quotient steps once every 600 counts, which is 10 minutes of real time, and POP returns 0 to 599, the three-digit value in the seconds field.

The tell is the three-digit remainder: a remainder from a divide by 60 is capped at 59, so a value up to 599 names the divisor as the fault. The habit comes from timer presets, which many controllers run on a tenth-of-a-second base; entering minutes and seconds into an HMI timer preset covers that side. K600 does have a real use: on a count that advances ten times per second it is the correct divisor, and its remainder is tenths of a second, so one more divide by 10, or SHFR K4 on a BCD value in this syntax, produces whole seconds. The trap sits at a count of 600: K600 returns 1 remainder 0, which looks exactly right, but that 1 arrived after 10 real minutes.

Why must the seconds result stay between 0 and 59?

A remainder from division by 60 is mathematically capped at 59, so a seconds field showing 100 or more names the fault at a glance: wrong divisor, wrong count base, or a missing POP.

Three readings tell the three faults apart:

  • Seconds above 59: the divisor is wrong or POP never ran. Check the constant on the DIV line and that POP sits between the divide and the seconds store.
  • Minutes wrong while the seconds read 0 to 59: the input word is not the live count, or the quotient landed in the wrong word. Watch V1010 against the displayed minutes for 10 seconds.
  • Both fields frozen while the line runs: the counter is not being pulsed. Watch V1010 for 10 seconds; no stepping means the pulse relay or the counter rung is the problem, and the conversion is innocent.

The field can also police itself: one integer tag can drive several color states on an HMI, so map the seconds word to an object that turns red above 59; showing multiple color states on an HMI from one integer tag sets that up.

How does the example convert a count of 185 into 3:05?

With 185 accumulated in the count word, DIV K60 returns a quotient of 3 and a remainder of 5, because 3 × 60 = 180 and 185 - 180 = 5, so the minutes word V2242 holds 3 and the seconds word holds 5.

At the same count the wrong divisor shows itself in one read: 185 ÷ 600 = 0 remainder 185, a minutes word of 0 and a seconds field of 185, which breaks the bound immediately. The table is the whole behavior of the rung at the counts worth checking:

Count (s) DIV K60 quotient Remainder Display
59 0 59 0:59
60 1 0 1:00
185 3 5 3:05
599 9 59 9:59
600 10 0 10:00

Every remainder in the column satisfies the division bound. If this counter feeds a shift or job total, the accumulation side, adding new minutes and seconds on top of a stored total, is handled in add minutes and seconds to a total time display on a PLC.

How do you check the display at a minute boundary?

Watch the count cross the next multiple of 60: the seconds word must rise to 59, then return to 0 on the same pulse that adds 1 to the minutes word, with the raw count in V1010 stepping once per second the whole time.

Let it run one full minute with the HMI visible and check three things:

  • The PLC words are right even if the screen is not: when V2242 and the seconds word hold correct numbers but the fields show something else, the HMI fields are mapped to the wrong words, and that is a screen configuration job.
  • Seconds land inside the valid range on every read: anything else sends you back to the bound check in the section above.
  • Minutes hold until the boundary: minutes creeping early means the input word is not the count you think it is.

The pair this rung produces is whole minutes and whole seconds; the raw count in V1010 stays available for anything finer. Decision, case by case: a one-second pulse takes DIV K60 with POP; a tenths-of-a-second base takes DIV K600 plus one divide by 10 on the remainder; an unmeasured base gets one minute of watching first, and the count you see in that minute is the divisor.

Questions

Does this conversion keep tenths of a second?

No. The quotient and remainder carry whole seconds only, so any fraction below one second is dropped. When the sign needs tenths, show the raw accumulated count in its own HMI field next to the minutes:seconds pair, or move the conversion to a count base ten times faster and convert twice. Keep the tenths arithmetic in the PLC so the displayed pair and the raw count can never disagree.

What happens when a 16-bit BCD seconds counter passes 9999?

A 16-bit BCD word holds 0 to 9999, so a seconds count rolls over to 0 after 9999 seconds, which is 2 hours 46 minutes 39 seconds. The display then restarts from 0:00 and the elapsed total is short by whole wrap periods. For runtimes longer than one wrap, run the count in a 32-bit double-word counter, or reset the counter at a known point in the cycle.

Can the same divide-and-remainder method show hours?

Yes. Divide the total by 3600, the seconds in one hour, to get hours, then run the same K60 conversion on the remainder: quotient is minutes, remainder is seconds. At 7272 seconds the first divide gives 2 hours with 72 left, and 72 divided by 60 gives 1 minute and 12 seconds, so the display reads 2:01:12. Each stage needs its own word, and each remainder stays inside its own bound.

The example loads CTA10 but my program shows the count in a different word. What do I use?

Use the operand your own program proves: load the address whose value steps once per second alongside the pulse, and feed that same address to the divide. In the example project counter CT10's accumulated word is loaded as CTA10 and read as V1010 elsewhere; other projects map counters differently. Match the rung input to the live count you verified, never to the example's address.

Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.

Keep reading

Build your signAsk for a quote