Skip to content

Main content

Microcontroller: Timer Counter Inclusive Period Tool

Compute an ideal up-counter period for inclusive counts zero through TOP with an explicitly supplied tick duration; excludes center-aligned modes.

Loading tool…

Description

Count top + 1 ticks for a counter visiting zero through top inclusively.

Timer formulas depend on whether endpoints are inclusive, the count direction, prescaling, and wrap behavior. A counter reading alone cannot reveal an arbitrary number of elapsed wraps.

Count top + 1 ticks for a counter visiting zero through top inclusively.

When to use this tool

Use Microcontroller: Timer Counter Inclusive Period when you need a timer period, wrap delta, or explicit count-budget term.

How to use the tool and how it works

  1. Enter top, tickSeconds. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Count top + 1 ticks for a counter visiting zero through top inclusively. Multiply by positive tickSeconds for periodSeconds.1

Input fieldMeaning and unitsAccepted input
topTopRequired. Safe integer.
tickSecondsTick SecondsRequired. Finite number.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.ticksPerPeriodTicks Per PeriodCalculated result member: number.
result.periodSecondsPeriod SecondsCalculated result member: number.
json
{
  "input": {
    "top": 9,
    "tickSeconds": 0.01
  },
  "output": {
    "result": {
      "ticksPerPeriod": 10,
      "periodSeconds": 0.1
    }
  }
}

Limitations and assumptions

  • This assumes an inclusive up-counter model; alternate counting modes and hardware event timing are not inferred.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Check the timer mode and register semantics in the device documentation, including synchronization and latency.

References

  1. Calculation and input contract: microcontroller/timer-counter-inclusive-period — tool.io

Similar or alternative tools