void delay(void) { SysTick->LOAD = 15999; SysTick->CTRL = 0x5; /*Enable the timer and choose cclk as the clock source */ while((SysTick->CTRL & 0x10000) == 0) /*wait until the Count flag is set */ { } SysTick->CTRL = 0; /*Stop the timer (Enable = 0) */ }