1024手机基地看电影,午夜福利视频导航,国产精品福利在线一区,亚洲欧美日韩另类成人,在线观看午夜日本理论片,成年超爽免费网站,国产精品成人免费,精品动作一级毛片,成人免费观看网站,97精品伊人久久大香蕉

標題: 幫我看看我的程序那里錯了 [打印本頁]

作者: wuiq    時間: 2012-10-4 10:23
標題: 幫我看看我的程序那里錯了
#define uint unsigned int #define uchar unsigned char uchar temp; void delay(); void main() { while(1) temp=0xfe; P1=temp; { temp= _crol_ (temp,1); delay(); P1=temp; } } void delay() { uint x,y; for(x=100;x>0;x--) for(y=100;y>0;y--); }
作者: wuiq    時間: 2012-10-4 10:23
#define uint unsigned int
#define uchar unsigned char
uchar temp;
void delay();
void main()
{
 while(1)
  temp=0xfe;
  P1=temp;
  {
   temp= _crol_ (temp,1);
   delay();
   P1=temp; 
  }
}
void delay()
{
 uint x,y;
 for(x=100;x>0;x--)
  for(y=100;y>0;y--);
}

作者: wuiq    時間: 2012-10-4 14:38

我就不知道自己錯在哪里這么回事呀!!!

希望大師傅們教我!!!

#define uint unsigned int
#define uchar unsigned char
uchar temp;
void delay();
void main()
{
 while(1)
  temp=0xfe;
  P1=temp;
  {
   temp= _crol_ (temp,1);
   delay();
   P1=temp; 
  }
}
void delay()
{
 uint x,y;
 for(x=100;x>0;x--)
  for(y=100;y>0;y--);
}


作者: chenpinghan    時間: 2012-10-4 15:21

你是要做跑馬燈吧

我在你的程序上修改了下:

#include<intrins.h>

#define uint unsigned int
#define uchar unsigned char
uchar temp;
void delay();
void main()
{
 
  temp=0xfe;
  P1=temp;
  while(1)
  {
   temp= _crol_ (temp,1);
   delay();
   P1=temp;
  }
}
void delay()
{
 uint x,y;
 for(x=100;x>0;x--)
  for(y=100;y>0;y--);
}
運行過的,可以用的。


作者: chenpinghan    時間: 2012-10-4 15:23

#include<reg51.h>

少了上面這個頭文件!


作者: wuiq    時間: 2012-10-5 09:01

非常感謝,我是初學單片機很多地方都不是很明白。希望能和各位師傅們常交流!!!


作者: ace11133    時間: 2012-10-13 10:48
while錯了,你這樣寫是個死循環。




歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1