标题: c51的编程,玩家2的灯在p2口没有向右移,求帮忙看看 [打印本页]

作者: 杨风feeling    时间: 2016-5-22 10:50
标题: c51的编程,玩家2的灯在p2口没有向右移,求帮忙看看
  if(key1==0)                //玩家1,灯左移
                 {
                   delay(5);
                   if(key1==0)
                   {
                      while(!key1);
                          if(temp1==0xff)                 //灯在P2口上

                         {
                            if(temp2==0xfe)                        
                           {
                                   temp2=0xff;
                               P2=temp2;
                                   temp1=0x7f;
                                   P0=temp1;
                             }
                                     if(temp2!=0xff)
                                   {
                                     temp2=_cror_(temp2,1);
                                     P2=temp2;
                                   }
                             }
                                 else                                        //灯在p0口

                                 {


                                 temp1=_cror_(temp1,1);
                                 P0=temp1;
                                 }
                                 a=1;                        //用于跳出P0==OXfe的循环
                           }
                         }

                if(key2==0)                                 //玩家2,灯右移
          {
                  delay(5);
                if(key2==0)
          {
                          while(!key2);
                  if(temp2==0xff)
              {
                         if(P0==0x7f)
                           {
                                   temp1=0xff;
                                   P0=temp1;
                                        temp2=0xfe;
                                   P2=temp2;
                         }
                         if(temp1!=0xff)
                   {
                    temp1=_crol_(temp1,1);
                         P0=temp1;
                   }
                 }
                 else
                 {
                    temp2=_crol_(temp2,1);
                 P2=temp2;
                 }
                 b=1;                                        //用于跳出P2==oxbf的循环
                   }
                  }
          }
        c51的编程,玩家2的灯在p2口没有向右移,求帮忙看看




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