ClearTimer

Syntax:

    ClearTimer TimerNo

Command Availability:

Available on all Microchip PIC and Atmel AVR microcontrollers with built in timer modules.

Explanation:

ClearTimer is used to clear the specified timer to a value of 0.

Cleartimer can be used on-the-fly if desired, so there is no requirement to stop the timer first.

Example:

    .....
    'Clear timer 1
    ClearTimer 1          ' <<< the ClearTimer instruction
    .....

Key line: ClearTimer 1 — resets Timer 1’s count to 0 immediately, whether or not the timer is currently running.

See Also:

  • InitTimer1 — a full worked example that uses ClearTimer before timing an event
  • StartTimer / StopTimer — starting and stopping the timer being cleared
  • Settimer — setting a timer to a specific value instead of clearing it to 0