CMSIS-Core (Cortex-M)  
CMSIS-Core support for Cortex-M processor-based devices
 
Loading...
Searching...
No Matches
Systick Timer (SYSTICK)

Initialize and start the SysTick timer. More...

Functions

uint32_t SysTick_Config (uint32_t ticks)
 System Tick Timer Configuration.
 

Description

Initialize and start the SysTick timer.

The System Tick Time (SysTick) generates interrupt requests on a regular basis. This allows an OS to carry out context switching to support multiple tasking. For applications that do not require an OS, the SysTick can be used for time keeping, time measurement, or as an interrupt source for tasks that need to be executed regularly.

Code Example <br>

The code below shows the usage of the function SysTick_Config() with an LPC1700.

#include "LPC17xx.h"
volatile uint32_t msTicks = 0; /* Variable to store millisecond ticks */
void SysTick_Handler(void) { /* SysTick interrupt Handler. */
msTicks++; /* See startup file startup_LPC17xx.s for SysTick vector */
}
int main (void) {
uint32_t returnCode;
returnCode = SysTick_Config(SystemCoreClock / 1000); /* Configure SysTick to generate an interrupt every millisecond */
if (returnCode != 0) { /* Check return code for errors */
// Error Handling
}
while(1);
}
uint32_t SysTick_Config(uint32_t ticks)
System Tick Timer Configuration.
uint32_t SystemCoreClock
Variable to hold the system core clock value.
Definition: ref_system_init.txt:68

Function Documentation

◆ SysTick_Config()

uint32_t SysTick_Config ( uint32_t  ticks)

System Tick Timer Configuration.

Initialises and starts the System Tick Timer and its interrupt. After this call, the SysTick timer creates interrupts with the specified time interval. Counter is in free running mode to generate periodical interrupts.

Parameters
[in]ticksNumber of ticks between two interrupts
Returns
0 - success
1 - failure
Note
When __Vendor_SysTickConfig is defined to 1, the standard function SysTick_Config is excluded. In this case, the Device Header File <Device.h> must contain a vendor specific implementation of this function.