熱門: 51單片機(jī) | 24小時(shí)必答區(qū) | 單片機(jī)教程 | 單片機(jī)DIY制作 | STM32 | Cortex M3 | 模數(shù)電子 | 電子DIY制作 | 音響/功放 | 拆機(jī)樂園 | Arduino | 嵌入式OS | 程序設(shè)計(jì)
![]() |
發(fā)布時(shí)間: 2022-3-27 11:01
正文摘要:頭文件是#include<reg52.h> 以及前期有一個(gè)數(shù)碼管位選的定義,是這兩者沖突了嗎 |
Hephaestus 發(fā)表于 2022-3-27 18:57 emmm好的謝謝!代碼有些長(zhǎng),從快速回復(fù)那里粘貼了代碼不知道是否可行 |
zhxiufan 發(fā)表于 2022-3-27 19:06 emmm好的謝謝 |
#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; }} |
lkc8210 發(fā)表于 2022-3-27 12:33 好的謝謝 |
smg_we4重復(fù)定義了,應(yīng)該有至少兩個(gè)地方定義了這個(gè)變量。 |
前面定義smg_we4那部分貼出來。 |
應(yīng)該是前面有錯(cuò)字/錯(cuò)符號(hào)/半型符號(hào) 你不發(fā)全部代就自己檢查 |
Powered by 單片機(jī)教程網(wǎng)