标题: 单片机新手求助!循环那里怎么改? [打印本页]

作者: 2901005274    时间: 2021-10-31 15:48
标题: 单片机新手求助!循环那里怎么改?
DS1302.c(183): error C141: syntax error near '}', expected ';'
DS1302.c(197): error C141: syntax error near '}', expected ';'
DS1302.c(212): error C141: syntax error near '}', expected ';'
为啥呀?


void keypros()
{
        if(s6==0)
        {
                delay(10);
          if(s6==0)
           {
                   select_function++;
                   if(select_function==4)select_function=0;
                   if(select_function!=0)TRO=0;
           }while(!s6);
          if(select_function==0)TRO=1;
   }
        /**********************************************************/
        if(select_function==1)
        {
                if(s5==0)
                {
                        time1++;
                        if(time1>=60)time1=0
                        }while(!s5);
                if(s4==0)
                {
                        if(time1==0)time1=60;
                        time1--;
                }while(!s4);
        }
        /**********************************************************/
if(select_function==2)
        {
                if(s5==0)
                {
                        time2++;
                        if(time2>=60)time2=0
                        }
while(!s5);
                if(s4==0)
                {
                        if(time2==0)time2=60;
                        time2--;
                }while(!s4);
        }
/**********************************************************/
        if(select_function==3)
        {
                if(s5==0)
                {
                        time3++;
                        if(time3>=24)time3=0
                        }while(!s5);
                if(s4==0)
                {
                        if(time3==0)time3=24;
                        time3--;
                }while(!s4);
        }
        LED1=time1%10;
        LED1=time1/10;
        
        LED2=time2%10;
        LED2=time2/10;
        
        LED3=time3%10;
        LED3=time3/10;
        
}


作者: 188610329    时间: 2021-10-31 16:37
                      time3++;
                        if(time3>=24)time3=0               <====  缺少分号 “;”
                        }while(!s5);

类似的地方很多,自己填上
作者: stycx    时间: 2021-10-31 16:39
检查一下 花括号{}是不是成对出现,里头有没有误输入全角的符号。

还不行的话就上传代码的源文件看看
作者: qinkang189    时间: 2021-10-31 17:51
前两个if后面的time后面没有分号
作者: 一片一城    时间: 2021-10-31 19:42
if......time1=0
if......time2=0
if......time3=0
这三条语句都缺了分号。

抄写代码是初学者都会经历的,重要的是必须一丝不苟。




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