void us_delay(Uint16 i){
Uint16 j=0;
for(;i>0;i--){
for(j=0;j<=150;j++){}
}
}
void ms_delay(Uint16 i){
Uint16 j=0;
for(;i>0;i--){
for(j=0;j<=1000;j++){
us_delay(1);
}
}
}
void s_delay(Uint16 i){
Uint16 j=0;
for(;i>0;i--){
for(j=0;j<=10000;j++){
us_delay(1);
}
}
}
请问以上延时程序在150M运行的时候,在没有中断干扰的情况下跟理想延时差多远。谢谢啦
此帖出自
小平头技术问答
for(;;){
if(GpioDataRegs.GPFDAT.all&BIT8){
ms_delay(5);
if(GpioDataRegs.GPFDAT.all&BIT8){
if(run==0){
run=1;
GpioDataRegs.GPFSET.bit.GPIOF12 = 1;
GpioDataRegs.GPFCLEAR.bit.GPIOF11 = 1;
ms_delay(6500);
GpioDataRegs.GPFSET.bit.GPIOF10 = 1;
}else{
GpioDataRegs.GPFCLEAR.bit.GPIOF12 = 1;
GpioDataRegs.GPFCLEAR.bit.GPIOF10 = 1;
run=0;
}
}
}
ms_delay(100);
GpioDataRegs.GPFTOGGLE.bit.GPIOF11 = 1;
}
一周热门 更多>