找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索

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

查看數(shù): 1808 | 評論數(shù): 7 | 收藏 0
關(guān)燈 | 提示:支持鍵盤翻頁<-左 右->
    組圖打開中,請稍候......
發(fā)布時間: 2022-3-27 11:01

正文摘要:

頭文件是#include<reg52.h> 以及前期有一個數(shù)碼管位選的定義,是這兩者沖突了嗎

回復(fù)

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

emmm好的謝謝!代碼有些長,從快速回復(fù)那里粘貼了代碼不知道是否可行
ID:1013408 發(fā)表于 2022-3-29 17:44
zhxiufan 發(fā)表于 2022-3-27 19:06
smg_we4重復(fù)定義了,應(yīng)該有至少兩個地方定義了這個變量。

emmm好的謝謝
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;                  }}
ID:1013408 發(fā)表于 2022-3-29 17:38
lkc8210 發(fā)表于 2022-3-27 12:33
應(yīng)該是前面有錯字/錯符號/半型符號
你不發(fā)全部代就自己檢查

好的謝謝
ID:121859 發(fā)表于 2022-3-27 19:06
smg_we4重復(fù)定義了,應(yīng)該有至少兩個地方定義了這個變量。
ID:883242 發(fā)表于 2022-3-27 18:57
前面定義smg_we4那部分貼出來。
ID:161164 發(fā)表于 2022-3-27 12:33
應(yīng)該是前面有錯字/錯符號/半型符號
你不發(fā)全部代就自己檢查

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

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

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