标题: 用指今执行时要消耗时间的特性来实现延时(软件延时) [打印本页]

作者: xiulindao    时间: 2016-4-4 12:40
标题: 用指今执行时要消耗时间的特性来实现延时(软件延时)
请大神帮忙看看下面程序(此程序是工作频率从5KHZ~500HZ)为什么程序编译不正确不能通过#include <reg52.h>
sbit P2_3=P2^3;
void delay (unsigned int t)
{   unsigned int i;
    i=t;
    while(i--);
}
void main( )
{
   while(1)
  {
    P2_3=0;
    a=3;
    delay(a);


    P2_3=1;
    a=3;
    delay(a);
    for(a,a<33.a++);
   }
}






欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1