帮忙看下程序,这个是按键程序,嵌套有没问题

2019-03-24 19:09发布

 switch(key())
         {
                     case 0x06:flag++;if(flag==1){write_12864com(0x0f);write_12864com(0x90);}if(flag==2){write_12864com(0X90+5);}
                                                 if(flag==3){write_12864com(0x88);}if(flag==4){write_12864com(0x88+5);}
                                                 if(flag==5){write_12864com(0x98);}if(flag==6){TR0=1;write_12864com(0x0c);flag=0;}break;
                    case 0x05:if(flag==1)            {
                                                                init();write_12864com(0x01);dispay1();//initt0();
                                                                switch(key())
                                                                       {
                                                                           case 0x03:{init();write_12864com(0x0f);initt0();} break;
                                                                       }
                                                                  }
         }uint8 key()
{
    uint8 huoqu;
    rd=0;
    P3|=0x07;    if((P3&0x07)==0x07){huoqu=0xff;return(huoqu);}
    delay(20);
    P3|=0x07;    if((P3&0x07)==0x07){huoqu=0xff;return(huoqu);}
     huoqu=P3&0x07;
    while((P3&0x07)!=0X07)
    {   
    }
    return huoqu;
}我想说switch里面不能嵌套switch吗?可以的话,为什么我按下0x03这个件不能实现呢 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。