標(biāo)題: 求高手解答 [打印本頁(yè)]

作者: 黃忠毅    時(shí)間: 2012-2-11 22:34
標(biāo)題: 求高手解答
 #include<reg52.h>
#include<intrins.h>
#define uint unsigned int  
#define uchar unsigned char
uchar temp;
uint a,b;

void main()
{
 a=7;
 TMOD=0x01;
 TH0=(65536-50000)/256;
 TL0=(65536-50000)%256;
 EA=1;
 ET0=1;
 TR0=1;
 temp=0xfe;
 P0=temp;
 while(1)
 {  
  
    while(a--)
   {
     if(b==20)
      {  
         b=0; 
       
         temp=_crol_(temp,1);                     
         P0=temp;
      }
    }

    a=7;
  while(a--)
  { 
          if(b==20)
           {
              b=0;     
              temp=_cror_(temp,1);                     
              P0=temp;
           }
   } 
  }
 }
void time0() interrupt 1
{
 TH0=(65536-50000)/256;
 TL0=(65536-50000)%256;
 b++;
}

 

求高手,用定時(shí)器去控制,延時(shí)一秒,8個(gè)led燈來(lái)回的閃爍,編譯沒(méi)有問(wèn)題,但是只能實(shí)現(xiàn)左移,一直找不到問(wèn)題。






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