{
TIM2_Cmd(ENABLE);
而(((TIM2→CNTRL)|((TIM2→CNTRL)以下为原文
void delay_us(unsigned int d)
{
TIM2_Cmd(ENABLE);
while( ((TIM2->CNTRL)|((TIM2->CNTRL)<<8))<=d);
TIM2_Cmd(DISABLE);
TIM2->CNTRL=0;
TIM2->CNTRH=0;
}void delay_ms(unsigned int d)
{
while(d){d--;delay_us(1000);}
}I've written this code for my delay functions but they do not work.
The timer CNT counts each 1 us.