Using systick for delays - So here we have the systick register. the systick current counts continually up to the value of the reload register at which point it sets bit 16 of the control register. if you are in a while loop waiting for this bit to be set - you get your delay. bit 16 is cleared when you write to current #define NVIC_ST_CTRL_R (*((volatile unsigned long *)0xE000E010)) #define NVIC_ST_RELOAD_R (*((volatile unsigned long *)0xE000E014)) #define NVIC_ST_CURRENT_R (*((volatile unsigned long *)0xE000E018)) void SysTick_Init(void){ NVIC_ST_CTRL_R = 0; // disable SysTick during setup NVIC_ST_CTRL_R = 0x00000005; // enable SysTick with core clock } // The delay parameter is in units of the 80 MHz core clock. (12.5 ns) void SysTick_Wait(unsigned long delay){ NVIC_ST_RELOAD_R = delay-1; // number of counts to wait NVIC_ST_CURRENT_R = 0; // any value written to CURRENT clears while((NVIC_ST_CTRL_R&0x00010000)==0){ // wait for count flag } } // 800000*12.5ns equals 10ms void SysTick_Wait10ms(unsigned long delay){ unsigned long i; for(i=0; i