找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

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

請問這個單片機C語言程序有什么問題嗎為什么顯示重復(fù)定義呢?

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:1013408 發(fā)表于 2022-3-27 11:01 來自觸屏版 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
頭文件是#include<reg52.h>
以及前期有一個數(shù)碼管位選的定義,是這兩者沖突了嗎

5([[AZ${V$C_R%0@AZOOY6W(1).png (33.19 KB, 下載次數(shù): 24)

5([[AZ${V$C_R%0@AZOOY6W(1).png

N[FIP51hei~JG4ASV1)9`_S9[9(1).png (175.06 KB, 下載次數(shù): 34)

N[FIP51hei~JG4ASV1)9`_S9[9(1).png
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

沙發(fā)
ID:161164 發(fā)表于 2022-3-27 12:33 | 只看該作者
應(yīng)該是前面有錯字/錯符號/半型符號
你不發(fā)全部代就自己檢查
回復(fù)

使用道具 舉報

板凳
ID:883242 發(fā)表于 2022-3-27 18:57 | 只看該作者
前面定義smg_we4那部分貼出來。
回復(fù)

使用道具 舉報

地板
ID:121859 發(fā)表于 2022-3-27 19:06 | 只看該作者
smg_we4重復(fù)定義了,應(yīng)該有至少兩個地方定義了這個變量。
回復(fù)

使用道具 舉報

5#
ID:1013408 發(fā)表于 2022-3-29 17:38 | 只看該作者
lkc8210 發(fā)表于 2022-3-27 12:33
應(yīng)該是前面有錯字/錯符號/半型符號
你不發(fā)全部代就自己檢查

好的謝謝
回復(fù)

使用道具 舉報

6#
ID:1013408 發(fā)表于 2022-3-29 17:40 | 只看該作者
#include<reg52.h>                  //#define uchar unsigned char   //#define unit unsigned int        // ////uchar smg_du[] = {0x40, 0x75, 0x0c, 0x14, 0x31, 0x12, 0x02, 0x74, 0x00, 0x10,  //                                                                           0x20, 0x03, 0x4a, 0x05, 0x0a, 0x2a, 0xff};  //uchar dis_smg[8] = {0xc0, 0xfa, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8};uchar smg_i = 4;     //uchar flag_che;       ////sbit smg_we1 = P2^0;      //sbit smg_we2 = P2^1;  sbit smg_we3= P3^6;  sbit smg_we4= P3^7;  char dx_s = 0;                       //sbit dx_red = P2^4;              //sbit dx_green = P2^3;          //sbit dx_yellow = P2^2;         //sbit nb_red = P2^7;              //sbit nb_green = P2^6;          //sbit nb_yellow = P2^5;         //sbit nb_che = P3^3;           //sbit dx_che = P3^4;           //uint ;nb_che_value;uint  ;dx_che_value;uchar xdata nb[30];uchar xdata dx[30];uchar flag_jtd_mode;        //bit flag_1s = 0;bit flag_500ms;bit flag_dx_nb = 0;uchar flag_5m_value;uchar i;uchar flag_alarm;              //uchar dx_time = 30, nb_time = 20;    //uchar flag_jdgz;                  //uchar miao, miao 1;  /....................................................                 ............................................../void smg_we_switch(uchar i){      switch (i)             {                          case 0: smg_we1= 0;   smg_we2 = 1;   smg_we3 = 1;  smg_we4 =1;   break;                             case 1: smg_we1= 1;   smg_we2 = 0;   smg_we3 = 1;  smg_we4 =1;   break;                             case 2: smg_we1= 1;   smg_we2 = 1;   smg_we3 = 0;  smg_we4 =1;   break;                              case 3: smg_we1= 1;   smg_we2 = 1;   smg_we3 = 1;  smg_we4 =0;   break;                  }}#include<reg52.h>                  //#define uchar unsigned char   //#define unit unsigned int        // ////uchar smg_du[] = {0x40, 0x75, 0x0c, 0x14, 0x31, 0x12, 0x02, 0x74, 0x00, 0x10,  //                                                                           0x20, 0x03, 0x4a, 0x05, 0x0a, 0x2a, 0xff};  //uchar dis_smg[8] = {0xc0, 0xfa, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8};uchar smg_i = 4;     //uchar flag_che;       ////sbit smg_we1 = P2^0;      //sbit smg_we2 = P2^1;  sbit smg_we3= P3^6;  sbit smg_we4= P3^7;  char dx_s = 0;                       //sbit dx_red = P2^4;              //sbit dx_green = P2^3;          //sbit dx_yellow = P2^2;         //sbit nb_red = P2^7;              //sbit nb_green = P2^6;          //sbit nb_yellow = P2^5;         //sbit nb_che = P3^3;           //sbit dx_che = P3^4;           //uint ;nb_che_value;uint  ;dx_che_value;uchar xdata nb[30];uchar xdata dx[30];uchar flag_jtd_mode;        //bit flag_1s = 0;bit flag_500ms;bit flag_dx_nb = 0;uchar flag_5m_value;uchar i;uchar flag_alarm;              //uchar dx_time = 30, nb_time = 20;    //uchar flag_jdgz;                  //uchar miao, miao 1;  /....................................................                 ............................................../void smg_we_switch(uchar i){      switch (i)             {                          case 0: smg_we1= 0;   smg_we2 = 1;   smg_we3 = 1;  smg_we4 =1;   break;                             case 1: smg_we1= 1;   smg_we2 = 0;   smg_we3 = 1;  smg_we4 =1;   break;                             case 2: smg_we1= 1;   smg_we2 = 1;   smg_we3 = 0;  smg_we4 =1;   break;                              case 3: smg_we1= 1;   smg_we2 = 1;   smg_we3 = 1;  smg_we4 =0;   break;                  }}
回復(fù)

使用道具 舉報

7#
ID:1013408 發(fā)表于 2022-3-29 17:44 | 只看該作者
zhxiufan 發(fā)表于 2022-3-27 19:06
smg_we4重復(fù)定義了,應(yīng)該有至少兩個地方定義了這個變量。

emmm好的謝謝
回復(fù)

使用道具 舉報

8#
ID:1013408 發(fā)表于 2022-3-29 17:46 | 只看該作者
Hephaestus 發(fā)表于 2022-3-27 18:57
前面定義smg_we4那部分貼出來。

emmm好的謝謝!代碼有些長,從快速回復(fù)那里粘貼了代碼不知道是否可行
回復(fù)

使用道具 舉報

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

本版積分規(guī)則

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

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

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