1us
//适配主频为120MHz的单片机
void Delay_us(int16_t nus)
{
int32_t temp;
SysTick->LOAD = nus*15; //120MHz
SysTick->VAL=0X00;
SysTick->CTRL=0X01;
do
{
temp=SysTick->CTRL;
}
while((temp&0x01)&&(!(temp&(1<<16))));
SysTick->CTRL=0x00;
SysTick->VAL =0X00;
}
1ms
void Delay_ms(int16_t t)
{
unsigned long a;
a = t;
while(a--)
{
Delay_us(1000);
}
}