找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3009|回復(fù): 3
打印 上一主題 下一主題
收起左側(cè)

基于單片機(jī)的倉庫溫濕度源程序錯誤有大神幫忙改么

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:325334 發(fā)表于 2018-5-8 20:02 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
200黑幣
本人用的是keil4,源程序如下:
  1. #include<reg51.h>
  2. #include"key_contrl.h"
  3. #include"lcd1602.h"
  4. #define LCM_Data P1
  5. #define Busy 0x80 //用于檢測LCM狀態(tài)字中的Busy標(biāo)識
  6. extern int temp_value,humi_value;
  7. extern int flag;
  8. extern int temp;
  9. sbit red=P2^6;
  10. sbit blue=P2^7;
  11. sbit LCM_RW= P2^4; //定義引腳
  12. sbit LCM_RS= P2^5;
  13. sbit LCM_E= P2^3;
  14. sbit beep = P0^6;//beep = 0時候發(fā)聲
  15. extern inttemph,templ,disp_mode,huih,huil;
  16. extern chartel,teh,hh,hl;
  17. //寫數(shù)據(jù)
  18. void alarm()
  19. {
  20.        beep=0;
  21.        Delay5Ms();
  22.        Delay5Ms();
  23.        beep=1;
  24.        Delay5Ms();
  25.        Delay5Ms();
  26. }
  27. voidWriteDataLCM(unsigned char WDLCM)
  28. {
  29. ReadStatusLCM(); //檢測忙
  30. LCM_Data = WDLCM;
  31. LCM_RS = 1;
  32. LCM_RW = 0;
  33. LCM_E = 0; //若晶振速度太高可以在這后加小的延時
  34. LCM_E = 0; //延時
  35. LCM_E = 1;
  36. }
  37. //寫指令
  38. voidWriteCommandLCM(unsigned char WCLCM,BuysC) //BuysC為0時忽略忙檢測
  39. {
  40. if (BuysC)ReadStatusLCM(); //根據(jù)需要檢測忙
  41. LCM_Data = WCLCM;
  42. LCM_RS = 0;
  43. LCM_RW = 0;
  44. LCM_E = 0;
  45. LCM_E = 0;
  46. LCM_E = 1;
  47. }
  48. //讀數(shù)據(jù)
  49. unsigned charReadDataLCM(void)
  50. {
  51. LCM_RS = 1;
  52. LCM_RW = 1;
  53. LCM_E = 0;
  54. LCM_E = 0;
  55. LCM_E = 1;
  56. return(LCM_Data);
  57. }
  58. //讀狀態(tài)
  59. unsigned charReadStatusLCM(void)
  60. {
  61. LCM_Data = 0xFF;
  62. LCM_RS = 0;
  63. LCM_RW = 1;
  64. LCM_E = 0;
  65. LCM_E = 0;
  66. LCM_E = 1;
  67. while (LCM_Data &Busy); //檢測忙信號
  68. return(LCM_Data);
  69. }
  70. void LCMInit(void)//LCM初始化
  71. {
  72. LCM_Data = 0;
  73. WriteCommandLCM(0x38,0);//三次顯示模式設(shè)置,不檢測忙信號
  74. Delay5Ms();
  75. WriteCommandLCM(0x38,0);
  76. Delay5Ms();
  77. WriteCommandLCM(0x38,0);
  78. Delay5Ms();
  79. WriteCommandLCM(0x38,1);//顯示模式設(shè)置,開始要求每次檢測忙信號
  80. WriteCommandLCM(0x08,1);//關(guān)閉顯示
  81. WriteCommandLCM(0x01,1);//顯示清屏
  82. WriteCommandLCM(0x06,1);// 顯示光標(biāo)移動設(shè)置
  83. WriteCommandLCM(0x0C,1);// 顯示開及光標(biāo)設(shè)置
  84. }
  85. //按指定位置顯示一個字符
  86. voidDisplayOneChar(unsigned char X, unsigned char Y, unsigned char DData)
  87. {
  88. Y &= 0x1;
  89. X &= 0xF; //限制X不能大于15,Y不能大于1
  90. if (Y) X |= 0x40; //當(dāng)要顯示第二行時地址碼 0x40;
  91. X |= 0x80; // 算出指令碼
  92. WriteCommandLCM(X, 0);//這里不檢測忙信號,發(fā)送地址碼
  93. WriteDataLCM(DData);
  94. }
  95. //按指定位置顯示一串字符
  96. voidDisplayListChar(unsigned char X, unsigned char Y, unsigned char code *DData)
  97. {
  98. unsigned charListLength;
  99. ListLength = 0;
  100. Y &= 0x1;
  101. X &= 0xF; //限制X不能大于15,Y不能大于1
  102. while(DData[ListLength]>0x20) //若到達(dá)字串尾則退出
  103. {
  104. if (X <= 0xF) //X坐標(biāo)應(yīng)小于0xF
  105. {
  106. DisplayOneChar(X, Y,DData[ListLength]); //顯示單個字符
  107. ListLength++;
  108. X++;
  109. }
  110. }
  111. }
  112. //5ms延時
  113. void Delay5Ms(void)
  114. {
  115. unsigned int TempCyc =5552;
  116. while(TempCyc--);
  117. }
  118. /*voidDelay_xMs(unsigned int x)
  119. {
  120.     unsigned int i,j;
  121.     for( i =0;i < x;i++ )
  122.     {
  123.         for( j =0;j<500;j++ );
  124.     }
  125. }
  126. */
  127. void display_temp(void)
  128. {
  129.        DisplayOneChar(0,0,' ');
  130.        DisplayOneChar(1,0,' ');
  131.        DisplayOneChar(2,0,'T');
  132.        DisplayOneChar(3,0,'e');
  133.        DisplayOneChar(4,0,'m');
  134.        DisplayOneChar(5,0,'p');
  135.        DisplayOneChar(6,0,':');
  136.        DisplayOneChar(10,0,'C');
  137.        DisplayOneChar(9,0,0xdf);
  138.        DisplayOneChar(7,0,temp_value/100+0x30);
  139.        DisplayOneChar(8,0,(temp_value/10)-(temp_value/100)*10+0x30);
  140.        DisplayOneChar(11,0,' ');
  141.        DisplayOneChar(12,0,' ');
  142.        DisplayOneChar(13,0,' ');
  143.        DisplayOneChar(14,0,' ');
  144.        DisplayOneChar(15,0,' ');
  145.        DisplayOneChar(0,1,' ');
  146.        DisplayOneChar(1,1,' ');
  147.        DisplayOneChar(2,1,'H');
  148.        DisplayOneChar(3,1,'u');
  149.        DisplayOneChar(4,1,'m');
  150.        DisplayOneChar(5,1,'i');
  151.        DisplayOneChar(6,1,'d');
  152.        DisplayOneChar(7,1,'i');
  153.        DisplayOneChar(8,1,'t');
  154.               DisplayOneChar(9,1,'y');
  155.        DisplayOneChar(10,1,':');
  156.        DisplayOneChar(11,1,humi_value/100+0x30);
  157.        DisplayOneChar(12,1,(humi_value/10)-(humi_value/100)*10+0x30);
  158.        DisplayOneChar(13,1,'%');
  159.        DisplayOneChar(14,1,' ');
  160.        DisplayOneChar(15,1,' ');
  161. }     
  162. voiddisplay_temp1(void)
  163. {
  164.        DisplayOneChar(0,0,' ');
  165.        DisplayOneChar(1,0,'T');
  166.        DisplayOneChar(2,0,'h');
  167.        DisplayOneChar(3,0,':');
  168.        if(flag&teh)
  169.        {
  170.        DisplayOneChar(4,0,0x20);
  171.        DisplayOneChar(5,0,0x20);
  172.        }
  173.        else
  174.        {
  175.        DisplayOneChar(4,0,temph/10+0x30);
  176.        DisplayOneChar(5,0,temph%10+0x30);
  177.        }
  178.        DisplayOneChar(6,0,0xdf);
  179.        DisplayOneChar(7,0,'C');
  180.        DisplayOneChar(8,0,' ');
  181.        DisplayOneChar(9,0,'T');
  182.        DisplayOneChar(10,0,'h');
  183.        DisplayOneChar(11,0,':');
  184.        if(flag&tel)
  185.        {
  186.        DisplayOneChar(12,0,0x20);
  187.        DisplayOneChar(13,0,0x20);
  188.        }
  189.        else
  190.        {
  191.        DisplayOneChar(12,0,templ/10+0x30);
  192.        DisplayOneChar(13,0,templ%10+0x30);
  193.        }
  194.        DisplayOneChar(14,0,0xdf);
  195.        DisplayOneChar(15,0,'C');
  196.               DisplayOneChar(0,1,' ');
  197.        DisplayOneChar(1,1,'H');
  198.        DisplayOneChar(2,1,'h');
  199.        DisplayOneChar(3,1,':');
  200.               if(flag&hh)
  201.        {
  202.        DisplayOneChar(4,1,0x20);
  203.        DisplayOneChar(5,1,0x20);
  204.        }
  205.        else
  206.        {
  207.        DisplayOneChar(4,1,huih/10+0x30);
  208.        DisplayOneChar(5,1,huih%10+0x30);
  209.        }
  210.        DisplayOneChar(6,1,'%');
  211.        DisplayOneChar(7,1,' ');
  212.        DisplayOneChar(8,1,' ');
  213.        DisplayOneChar(9,1,'H');
  214.        DisplayOneChar(10,1,'l');
  215.        DisplayOneChar(11,1,':');
  216.               if(flag&hl)
  217.        {
  218.        DisplayOneChar(12,1,0x20);
  219.        DisplayOneChar(13,1,0x20);
  220.        }
  221.        else
  222.        {
  223.        DisplayOneChar(12,1,huil/10+0x30);
  224.        DisplayOneChar(13,1,huil%10+0x30);
  225.        }
  226.        DisplayOneChar(14,1,'%');
  227.        DisplayOneChar(15,1,' ');
  228. }     
  229. void displayfun1()
  230. {
  231.        display_temp();
  232. }
  233. void displayfun2()
  234. {
  235.        display_temp1();      
  236. }
  237. void display()
  238. {
  239.               if((((temp_value/10)%100)<templ)||(((humi_value/10)%100)<huil))
  240.               {beep=0;red=0;}                //溫度低于下限值,報警
  241.              elseif(((temp_value/10)%100)>=temph || ((humi_value/10)%100)>=huih)
  242.                      {beep=0;blue=0;}      //溫度高于或等于上限值,報警
  243.              else{beep=1;red=1;blue=1;}
  244. //            if(((humi_value/10)%100)<huil){beep=0;led=0;}               //溫度低于下限值,報警
  245. //          elseif(((humi_value/10)%100)>=huih)beep=0;     //溫度高于或等于上限值,報警
  246. //          else{beep=1;led=1;}
  247.         if(!disp_mode)
  248.              displayfun1(); //顯示正常
  249.         else
  250.               displayfun2(); //設(shè)置界面
  251. }
  252. #include"dht11.h"
  253. #include<reg52.h>
  254. //請根據(jù)自己的dht11接的IO 口來改動位定義
  255. sbit dht11 = P3^0;
  256. //防止在與硬件通信時發(fā)生死循環(huán)的計數(shù)范圍
  257. #define NUMBER 20
  258. #define SIZE 5
  259. static unsigned charstatus;
  260. //存放五字節(jié)數(shù)據(jù)的數(shù)組
  261. static unsigned charvalue_array[SIZE];
  262. /*可在其他的文件引用溫濕度值,實際是溫度的整數(shù)的10 倍
  263. 如dht11 讀回的溫度是26,則temp_value = 260, 濕度同理*/
  264. int temp_value,humi_value;
  265. static unsigned charReadValue(void);
  266. void Delay_1ms(unsignedint ms)
  267. {
  268.        unsigned int x, y;
  269.        for(x = ms; x > 0; x--)
  270.        {
  271.               for(y = 124; y > 0; y--);
  272.        }
  273. }
  274. static voidDHT11_Delay_10us(void)
  275. {
  276.        unsigned char i;
  277.        i--;
  278.        i--;
  279.        i--;
  280.        i--;
  281.        i--;
  282.        i--;
  283. }
  284. /*讀一個字節(jié)的數(shù)據(jù)*/
  285. static unsigned charDHT11_ReadValue(void)
  286. {
  287.        unsigned char count, value = 0, i;
  288.        status = OK; //設(shè)定標(biāo)志為正常狀態(tài)
  289.        for(i = 8; i > 0; i--)
  290.        {
  291.               //高位在先
  292.               value <<= 1;
  293.               count = 0;
  294.               //每一位數(shù)據(jù)前會有一個50us 的低電平時間.等待50us低電平結(jié)束
  295.               while(dht11 == 0 && count++ < NUMBER);
  296.               if(count >= NUMBER)
  297.                      {
  298.                      status = ERROR; //設(shè)定錯誤標(biāo)志
  299.                      return 0; //函數(shù)執(zhí)行過程發(fā)生錯誤就退出函數(shù)
  300.                      }
  301.               //26-28us 的高電平表示該位是0,為70us高電平表該位1
  302.               DHT11_Delay_10us();
  303.               DHT11_Delay_10us();
  304.               DHT11_Delay_10us();
  305.               //延時30us 后檢測數(shù)據(jù)線是否還是高電平
  306.               if(dht11 != 0)
  307.               {
  308.               //進(jìn)入這里表示該位是1
  309.                      value++;
  310.               //等待剩余(約40us)的高電平結(jié)束
  311.                      while(dht11 != 0 && count++ < NUMBER)
  312.                      {
  313.                             dht11 = 1;
  314.                      }
  315.                      if(count >= NUMBER)
  316.                      {
  317.                             status = ERROR; //設(shè)定錯誤標(biāo)志
  318.                             return 0;
  319.                      }
  320.               }
  321.        }
  322.        return (value);
  323. }
  324. //讀溫度和濕度函數(shù),讀一次的數(shù)據(jù),共五字節(jié),讀出成功函數(shù)返回OK, 錯誤返回ERROR
  325. unsigned charDHT11_ReadTempAndHumi(void)
  326. {
  327.        unsigned char i = 0, check_value = 0,count = 0;
  328.        EA = 0;
  329.        dht11 = 0; //拉低數(shù)據(jù)線大于18ms 發(fā)送開始信號
  330.        Delay_1ms(20); //需大于18 毫秒
  331.        dht11 = 1; //釋放數(shù)據(jù)線,用于檢測低電平的應(yīng)答信號
  332.        //延時20-40us,等待一段時間后檢測應(yīng)答信號,應(yīng)答信號是從機(jī)拉低數(shù)據(jù)線80us
  333.        DHT11_Delay_10us();
  334.        DHT11_Delay_10us();
  335.        DHT11_Delay_10us();
  336.        DHT11_Delay_10us();
  337.        if(dht11 != 0) //檢測應(yīng)答信號,應(yīng)答信號是低電平
  338.        {
  339.               //沒應(yīng)答信號
  340.               EA = 1;
  341.               return ERROR;
  342.        }
  343.        else
  344.        {
  345.               //有應(yīng)答信號
  346.               while(dht11 == 0 && count++ < NUMBER); //等待應(yīng)答信號結(jié)束
  347.               if(count >= NUMBER) //檢測計數(shù)器是否超過了設(shè)定的范圍
  348.               {
  349.                      dht11 = 1;
  350.                      EA = 1;
  351.                      return ERROR; //讀數(shù)據(jù)出錯,退出函數(shù)
  352.               }
  353.               count = 0;
  354.               dht11 = 1;//釋放數(shù)據(jù)線
  355.               //應(yīng)答信號后會有一個80us 的高電平,等待高電平結(jié)束
  356.               while(dht11 != 0 && count++ < NUMBER);
  357.               if(count >= NUMBER)
  358.               {
  359.                      dht11 = 1;
  360.                      EA = 1;
  361.                      return ERROR; //退出函數(shù)
  362.               }
  363.               //讀出濕.溫度值
  364.               for(i = 0; i < SIZE; i++)
  365.               {
  366.                      value_array[ i] = DHT11_ReadValue();
  367.                      if(status == ERROR)//調(diào)用ReadValue()讀數(shù)據(jù)出錯會設(shè)定status 為ERROR
  368.                      {
  369.                             dht11 = 1;
  370.                             EA = 1;
  371.                             return ERROR;
  372.                      }
  373.                      //讀出的最后一個值是校驗值不需加上去
  374.                      if(i != SIZE - 1)
  375.                      {
  376.                             //讀出的五字節(jié)數(shù)據(jù)中的前四字節(jié)數(shù)據(jù)和等于第五字節(jié)數(shù)據(jù)表示成功
  377.                             check_value += value_array[ i];
  378.                      }
  379.               }//end for
  380.                      //在沒用發(fā)生函數(shù)調(diào)用失敗時進(jìn)行校驗
  381.               if(check_value == value_array[SIZE - 1])
  382.               {
  383.                      //將溫濕度擴(kuò)大10 倍方便分離出每一位
  384.                      humi_value = value_array[0] * 10;
  385.                      temp_value = value_array[2] * 10;
  386.                      dht11 = 1;
  387.                      EA = 1;
  388.                      return OK; //正確的讀出dht11 輸出的數(shù)據(jù)
  389.               }
  390.               else
  391.               {
  392.                      //校驗數(shù)據(jù)出錯
  393.                      EA = 1;
  394.                      return ERROR;
  395.               }
  396.        }
  397. }
  398. #include"lcd1602.h"

  399. #include"key_contrl.h"
  400. #include"dht11.h"


  401. #include<reg52.h>


  402. int temp;

  403. int temph = 40;                    //初始上限值
  404. int templ = 10;                                     //初始下限值
  405. int huih = 90;
  406. int huil =10;

  407. inttimecount,flag=0,number=0,count=0;



  408. void t0(void) interrupt1 using 0   
  409. {   TH0=(65535-50000)/256; //50ms定時
  410.      TL0=(65535-50000)%256;  
  411.      timecount++;//re_disp++;
  412.      if(timecount>9){timecount=0;flag=~flag;}                             //50ms到了則反顯
  413.        //if(re_disp>200){re_disp=0;if(id)id=0;}  //10秒到了則由調(diào)整模式自動進(jìn)入正常顯示模式
  414. }

  415. void t1(void) interrupt 3 using 0
  416. {
  417.        TH1=(65535-50000)/256;//50ms定時
  418.        TL1=(65535-50000)%256;
  419.        number++;
  420.        if(number>2)
  421.        {
  422.               number=0;
  423.               count++;

  424.               //beep=0;
  425.        }
  426. }


  427. void main(void)
  428. {
  429.               TMOD=0x11;                                 //初始化定時器t0方式1
  430.             TH0=(65535-50000)/256;
  431.             TL0=(65535-50000)%256;
  432.               TH1=(65535-50000)/256;
  433.               TL1=(65535-50000)%256;     

  434.             EA=1;
  435.             ET0=1;

  436.          ET1=1;
  437.               TR0=1;
  438.              TR1=1;
  439.               LCMInit(); //LCM初始化
  440.               Delay5Ms(); //延時片刻
  441.               

  442.        while(1)
  443.        {
  444.               if(count==2)
  445.                      {
  446.                             DHT11_ReadTempAndHumi();
  447.                             count=0;
  448.                      }
  449.               delay_LCM(300);
  450.               Scan_Key();
  451.        }
  452.       
  453. }
復(fù)制代碼


這里是出現(xiàn)的各種各樣的問題
Build target '目標(biāo) 1'
compiling 1.c...
1.c(3): warning C318: can't open file 'key_contrl.h'
1.c(4): warning C318: can't open file 'lcd1602.h'
1.C(34): warning C206: 'Delay5Ms': missing function-prototype
1.C(46): warning C206: 'ReadStatusLCM': missing function-prototype
1.C(77): error C231: 'ReadStatusLCM': redefinition
1.C(86): error C231: 'ReadStatusLCM': redefinition
1.C(131): error C231: 'Delay5Ms': redefinition
1.C(134): error C231: 'Delay5Ms': redefinition
1.c(296): warning C318: can't open file 'dht11.h'
D:\禿驢爹\C51\INC\REG52.H(13): error C231: 'P0': redefinition
D:\禿驢爹\C51\INC\REG52.H(14): error C231: 'P1': redefinition
D:\禿驢爹\C51\INC\REG52.H(15): error C231: 'P2': redefinition
D:\禿驢爹\C51\INC\REG52.H(16): error C231: 'P3': redefinition
D:\禿驢爹\C51\INC\REG52.H(17): error C231: 'PSW': redefinition
D:\禿驢爹\C51\INC\REG52.H(18): error C231: 'ACC': redefinition
D:\禿驢爹\C51\INC\REG52.H(19): error C231: 'B': redefinition
D:\禿驢爹\C51\INC\REG52.H(20): error C231: 'SP': redefinition
D:\禿驢爹\C51\INC\REG52.H(21): error C231: 'DPL': redefinition
D:\禿驢爹\C51\INC\REG52.H(22): error C231: 'DPH': redefinition
D:\禿驢爹\C51\INC\REG52.H(23): error C231: 'PCON': redefinition
D:\禿驢爹\C51\INC\REG52.H(24): error C231: 'TCON': redefinition
D:\禿驢爹\C51\INC\REG52.H(25): error C231: 'TMOD': redefinition
D:\禿驢爹\C51\INC\REG52.H(26): error C231: 'TL0': redefinition
D:\禿驢爹\C51\INC\REG52.H(27): error C231: 'TL1': redefinition
D:\禿驢爹\C51\INC\REG52.H(28): error C231: 'TH0': redefinition
D:\禿驢爹\C51\INC\REG52.H(29): error C231: 'TH1': redefinition
D:\禿驢爹\C51\INC\REG52.H(30): error C231: 'IE': redefinition
D:\禿驢爹\C51\INC\REG52.H(31): error C231: 'IP': redefinition
D:\禿驢爹\C51\INC\REG52.H(32): error C231: 'SCON': redefinition
D:\禿驢爹\C51\INC\REG52.H(33): error C231: 'SBUF': redefinition
D:\禿驢爹\C51\INC\REG52.H(45): error C231: 'CY': redefinition
D:\禿驢爹\C51\INC\REG52.H(46): error C231: 'AC': redefinition
D:\禿驢爹\C51\INC\REG52.H(47): error C231: 'F0': redefinition
D:\禿驢爹\C51\INC\REG52.H(48): error C231: 'RS1': redefinition
D:\禿驢爹\C51\INC\REG52.H(49): error C231: 'RS0': redefinition
D:\禿驢爹\C51\INC\REG52.H(50): error C231: 'OV': redefinition
D:\禿驢爹\C51\INC\REG52.H(51): error C231: 'P': redefinition
D:\禿驢爹\C51\INC\REG52.H(54): error C231: 'TF1': redefinition
D:\禿驢爹\C51\INC\REG52.H(55): error C231: 'TR1': redefinition
D:\禿驢爹\C51\INC\REG52.H(56): error C231: 'TF0': redefinition
D:\禿驢爹\C51\INC\REG52.H(57): error C231: 'TR0': redefinition
D:\禿驢爹\C51\INC\REG52.H(58): error C231: 'IE1': redefinition
D:\禿驢爹\C51\INC\REG52.H(59): error C231: 'IT1': redefinition
D:\禿驢爹\C51\INC\REG52.H(60): error C231: 'IE0': redefinition
D:\禿驢爹\C51\INC\REG52.H(61): error C231: 'IT0': redefinition
D:\禿驢爹\C51\INC\REG52.H(64): error C231: 'EA': redefinition
D:\禿驢爹\C51\INC\REG52.H(66): error C231: 'ES': redefinition
D:\禿驢爹\C51\INC\REG52.H(67): error C231: 'ET1': redefinition
D:\禿驢爹\C51\INC\REG52.H(68): error C231: 'EX1': redefinition
D:\禿驢爹\C51\INC\REG52.H(69): error C231: 'ET0': redefinition
D:\禿驢爹\C51\INC\REG52.H(70): error C231: 'EX0': redefinition
D:\禿驢爹\C51\INC\REG52.H(74): error C231: 'PS': redefinition
D:\禿驢爹\C51\INC\REG52.H(75): error C231: 'PT1': redefinition
D:\禿驢爹\C51\INC\REG52.H(76): error C231: 'PX1': redefinition
D:\禿驢爹\C51\INC\REG52.H(77): error C231: 'PT0': redefinition
D:\禿驢爹\C51\INC\REG52.H(78): error C231: 'PX0': redefinition
D:\禿驢爹\C51\INC\REG52.H(81): error C231: 'RD': redefinition
D:\禿驢爹\C51\INC\REG52.H(82): error C231: 'WR': redefinition
D:\禿驢爹\C51\INC\REG52.H(83): error C231: 'T1': redefinition
D:\禿驢爹\C51\INC\REG52.H(84): error C231: 'T0': redefinition
D:\禿驢爹\C51\INC\REG52.H(85): error C231: 'INT1': redefinition
D:\禿驢爹\C51\INC\REG52.H(86): error C231: 'INT0': redefinition
D:\禿驢爹\C51\INC\REG52.H(87): error C231: 'TXD': redefinition
D:\禿驢爹\C51\INC\REG52.H(88): error C231: 'RXD': redefinition
D:\禿驢爹\C51\INC\REG52.H(91): error C231: 'SM0': redefinition
D:\禿驢爹\C51\INC\REG52.H(92): error C231: 'SM1': redefinition
D:\禿驢爹\C51\INC\REG52.H(93): error C231: 'SM2': redefinition
D:\禿驢爹\C51\INC\REG52.H(94): error C231: 'REN': redefinition
D:\禿驢爹\C51\INC\REG52.H(95): error C231: 'TB8': redefinition
D:\禿驢爹\C51\INC\REG52.H(96): error C231: 'RB8': redefinition
D:\禿驢爹\C51\INC\REG52.H(97): error C231: 'TI': redefinition
D:\禿驢爹\C51\INC\REG52.H(98): error C231: 'RI': redefinition
1.C(345): error C202: 'OK': undefined identifier
1.C(355): error C202: 'ERROR': undefined identifier
1.C(374): error C202: 'ERROR': undefined identifier
1.C(398): error C202: 'ERROR': undefined identifier
1.C(408): error C202: 'ERROR': undefined identifier
1.C(418): error C202: 'ERROR': undefined identifier
1.C(424): error C202: 'ERROR': undefined identifier
1.C(428): error C202: 'ERROR': undefined identifier
1.C(445): error C202: 'OK': undefined identifier
1.C(451): error C202: 'ERROR': undefined identifier
1.c(455): warning C318: can't open file 'lcd1602.h'
1.c(457): warning C318: can't open file 'key_contrl.h'
1.c(458): warning C318: can't open file 'dht11.h'
目標(biāo)未創(chuàng)建

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

沙發(fā)
ID:325334 發(fā)表于 2018-5-8 20:04 | 只看該作者
剛剛?cè)腴T的樓主 希望大家給予詳細(xì)解答
回復(fù)

使用道具 舉報

板凳
ID:269211 發(fā)表于 2018-5-10 10:37 | 只看該作者
你這里不是沒有把頭文件放在工程的文件夾里?你的主函數(shù)用了#include<reg51.h>,你的頭文件應(yīng)該是用了#include<reg52.h>。所以肯定有很多錯誤了,你再修改一下。你還有一些函數(shù)沒定義,仔細(xì)查一下。
回復(fù)

使用道具 舉報

地板
ID:325334 發(fā)表于 2018-5-10 18:27 | 只看該作者
這里是改完以后出現(xiàn)的問題,請問該怎么修改
1.c(3): warning C318: can't open file 'key_contrl.h'
1.c(4): warning C318: can't open file 'lcd1602.h'
1.C(34): warning C206: 'Delay5Ms': missing function-prototype
1.C(46): warning C206: 'ReadStatusLCM': missing function-prototype
1.C(131): error C231: 'Delay5Ms': redefinition
1.C(134): error C231: 'Delay5Ms': redefinition
1.c(296): warning C318: can't open file 'dht11.h'
1.C(345): error C202: 'OK': undefined identifier
1.C(355): error C202: 'ERROR': undefined identifier
1.C(374): error C202: 'ERROR': undefined identifier
1.C(398): error C202: 'ERROR': undefined identifier
1.C(408): error C202: 'ERROR': undefined identifier
1.C(418): error C202: 'ERROR': undefined identifier
1.C(424): error C202: 'ERROR': undefined identifier
1.C(428): error C202: 'ERROR': undefined identifier
1.C(445): error C202: 'OK': undefined identifier
1.C(451): error C202: 'ERROR': undefined identifier
1.c(455): warning C318: can't open file 'lcd1602.h'
1.c(457): warning C318: can't open file 'key_contrl.h'
1.c(458): warning C318: can't open file 'dht11.h'
1.c - 12 Error(s), 8 Warning(s).
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表