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

標題: 單片機程序求解答,哪里錯了 [打印本頁]

作者: 學單片機小學生    時間: 2018-9-6 14:25
標題: 單片機程序求解答,哪里錯了
#include <reg51.h>
#include <stdio.h>
sbit LED=P1^0;
void delay( unsigned int );
void main( void )
{
    while(1){                    //???
        P1_0=0;                //P1.0??LED??
        delay( 500 );            //??????
        P1_0 = 1;                //P1.0??LED??
        delay( 500 );            //??????
    }
}
void delay( unsigned int n )    //??????
{
    unsignedint x, y;
    for( x = 0; x < n; x ++ ){
        for( y = 0; y < 121; y ++ ){
            ;
        }
    }
}



作者: 1123212143255    時間: 2018-9-6 17:04
倒數第四個括號方向不對,改后還需處理處理其他括號,參考吧。
作者: wulin    時間: 2018-9-6 17:32
P1_0=0;           P1_0沒有定義
unsignedint x, y;少了空格unsigned int x, y;
作者: zha    時間: 2018-9-6 17:37
unsignedint 改為unsigned int
作者: le51    時間: 2018-9-6 18:03
1.在你編寫完程序,點擊編譯按鍵之后,編譯器的最下面的對話框中會出現你寫的程序的()error ()warning,如果編譯有錯誤的話,鼠標點擊下error:。。。。。。諸如此類的語句,編譯器就會提示錯誤在哪一行有什么錯誤。如果看不懂英文的話可以翻譯或者直接copy百度。
2.要搞明白自己的每一條語句的目的是什么,比如你上面開始的時候位定義了LED=P1^0,那么以后的對P1^0口的操作就可以用LED代替了,然而你下面還寫的P1_0...
作者: sxhwdz    時間: 2018-9-6 18:09
#include <reg51.h>
#include <stdio.h>
sbit LED=P1^0;
void delay( unsigned int );
void main( void )
{
    while(1){                    //???
        LED = 0;                //P1.0??LED??
        delay( 500 );            //??????
        LED = 1;                //P1.0??LED??
        delay( 500 );            //??????
    }
}
void delay( unsigned int n )    //??????
{
     unsigned int x, y;
    for( x = 0; x < n; x ++ ){
        for( y = 0; y < 121; y ++ ){
            ;
        }
    }
}

倒數第7行  ,unsignedint x, y; 少空格, 正確為  unsigned  int x, y;
作者: zhaoyinlo    時間: 2018-9-6 19:05
void delay( unsigned int );  //聲明時沒有參數名 下面 定義時有了參數名
unsignedint x, y;  //  unsigned  int  是分開的。
希望能幫到你




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