Question
[newbie] how to use systick?
Posted on March 05, 2014 at 00:23
Hi all,
I saw many examples using systick interrupt handler to generate the accurate delay time (like the example below). My question would be pretty simple here: why does ''(
/ 1000)
'' generate a 1 millisecond delay? I need to examine the execution time of each section of my code in my project, which might reach to microsecond level, so I'm trying to understand the systick time calculation.#include ''LPC17xx.h''
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 =
( / 1000);/* Configure SysTick to generate an interrupt every millisecond */
if
(returnCode != 0) {/* Check return code for errors */
// Error Handling
}
while
(1);}
I'm using STM32L. Thanks a lot!!~S