Keil Logo

System Tick Timer

The System Tick Timer (SYSTICK Timer) is a simple 24-bit down counter. The timer can be started and configured with an automatic reload value. If the timer is running and it's IRQ is enabled, it generates periodic interrupts. The System Tick Timer can use the internal clock (FCLK, the free running clock signal on the Cortex-M processor) or the external clock (the STCLK signal on the Cortex-M processor). The System Tick Timer is often used by the RTOS.

When used with CMSIS, the System Tick timer is started and setup with the following function:

SysTick_Config (numberOfTicks);

The following code can be used as a template for further applications.

/******************************************************************************
 * @file:    main.c
 * @purpose: Systick Timer usage with CMSIS for Cortex-M microcontroller
 *
******************************************************************************/
#include "stm32f10x_cl.h"

volatile uint32_t msTicks;                  // Counts 1ms timeTicks

/*-----------------------------------------------------------------------------
  SysTick_Handler
*----------------------------------------------------------------------------*/
void SysTick_Handler (void)  {
  msTicks++;                                // Increment counter
}

/*-----------------------------------------------------------------------------
  MAIN function
*----------------------------------------------------------------------------*/
int main (void)  {

  SystemInit ();                            // Initialize clocks
  SysTick_Config (SystemFrequency/1000);    // Configure the SYSTICK

  while (1)  {
    ...
  }

}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.