初始化
SysTick->CNTL0 =0;
SysTick->CNTL1 =0;
SysTick->CNTL2 =0;
SysTick->CNTL3 =0;
SysTick->CNTH0 =0;
SysTick->CNTH1 =0;
SysTick->CNTH2 =0;
SysTick->CNTH3 =0;
i=FSYS/8/4;
SysTick->CMPLR0 = (u8)(i & 0xFF);
SysTick->CMPLR1 = (u8)(i >> 8);
SysTick->CMPLR2 = (u8)(i >> 16);
SysTick->CMPLR3 = (u8)(i >> 24);
SysTick->CMPHR0 =0;
SysTick->CMPHR1 =0;
SysTick->CMPHR2 =0;
SysTick->CMPHR3 =0;
SysTick->CTLR=1;
NVIC_EnableIRQ(SysTicK_IRQn);
中断程序翻PB8闪灯:
GPIOB->OUTDR^=1<<8;
SysTick->CNTL0 =0;
SysTick->CNTL1 =0;
SysTick->CNTL2 =0;
SysTick->CNTL3 =0;
SysTick->CNTH0 =0;
SysTick->CNTH1 =0;
SysTick->CNTH2 =0;
SysTick->CNTH3 =0;
单独这样跑没有问题,
随便增加USART1发送一字节,就不闪了,CPU没有死,读systick值,CNT在增加,就是不进中断