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