欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 單片機門鈴程序哪里有錯啊,找不出來 [打印本頁]

作者: 電工遭不住了    時間: 2020-6-15 18:45
標題: 單片機門鈴程序哪里有錯啊,找不出來
#include<AT89X51.H>
unsigned char t5hz;
unsigned char t7hz;
unsigned int tcnt;
bit stop;
bit flag;
void main(void)
{
        unsigned char i,j;
        TMOD=0x02;
        TH0=0x06;
        ET0=1;
        EA=1;
        while(1)
        {
                if(P3_7==0)
                {
                        for(i=10;i>0;i--)
                        for(j=248;j>0;j--)
                        if(P3_7==0)
                        {
                                t5hz=0;
                                t7hz=0;
                                tcnt=0;
                                flag=0;
                                stop=0;
                                TR0=1;
                                while(stop==0);
                        }
                 }
         }
  }
  void t0(void) interrupt 1 using 0
  {
          tcnt++;
        if(tcnt==2000)
          {
                tcnt=0;
                if(flag==0)
                {
                        flag=~flag;
                }
                else
                {
                         stop=1;
                         TR0=0;
                }
        }
        if(flag==0)
        t7hz++;
        if(t7hz==3)
        {
                t7hz=0;
                P1_0=~P1_0;
        }
  }
  else
  {
          t5hz++;
        if(t5hz==4)
        {
                t5hz=0;
                P1_0=~P1_0;
        }
  }


作者: 電工遭不住了    時間: 2020-6-15 18:58
編譯提示說有兩個警告,找不出來
作者: xianfajushi    時間: 2020-6-15 19:06
P3_7在哪里定義按鍵?P1_0在哪里定義蜂鳴器?
作者: taotie    時間: 2020-6-15 20:03
第二個else語句下花括弧取消。在程序最后添加右花括弧
作者: c00156155    時間: 2020-6-15 20:26
else
  {
          t5hz++;
        if(t5hz==4)
        {
                t5hz=0;
                P1_0=~P1_0;
        }
  }

你把上面這個去掉就沒告警了呀,是由于你的else前面沒有相應的IF的呀
作者: epson009    時間: 2020-6-15 22:10
else前面的 } 位置不對。
作者: TTQ001    時間: 2020-6-16 08:01
那兩個ELSE沒有與它之前IF配對。 重組花括號符號以將IF與ELSE配對。
作者: 電工遭不住了    時間: 2020-6-17 15:26
謝謝各位大哥,改好啦
作者: 草草111111    時間: 2020-7-21 15:32
引腳沒有定義




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