分类：电脑/网络-硬件
问题：单片机程序改错#include&lt;reg51.h&gt;#i 
#include <reg51.h>#include <intrins.h>#define har unsigned char#define uint unsigned intuchar code Table_OF_Digits[]={0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,//0  0x00,0x08,0x38,0x08,0x08,0x08,0x3E,0x00,//1  0x00,0x3C,0x42,0x04,0x08,0x32,0x7E,0x00,//2  0x0#include <reg51.h>#include <intrins.h>#define har unsigned char#define uint unsigned intuchar code Table_OF_Digits[]={0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,//0  0x00,0x08,0x38,0x08,0x08,0x08,0x3E,0x00,//1  0x00,0x3C,0x42,0x04,0x08,0x32,0x7E,0x00,//2  0x00,0x3C,0x42,0x1C,0x02,0x42,0x3C,0x00,//3  0x00,0x0C,0x14,0x24,0x44,0x3C,0x0C,0x00,//4  0x00,0x7E,0x40,0x7C,0x02,0x42,0x3C,0x00,//5  0x00,0x3C,0x40,0x7C,0x42,0x42,0x3C,0x00,//6  0x00,0x7E,0x44,0x08,0x10,0x10,0x10,0x00,//7  0x00,0x3C,0x42,0x24,0x5C,0x42,0x3C,0x00,//8  0x00,0x38,0x46,0x42,0x3E,0x06,0x3C,0x00,//9};uint r = 0;char offset = 0;uchar Current_Level = 1,Dest_Level = 1,x = 0,t = 0;void main(){P3 = 0x80;Current_Level = 1;Dest_Level = 1;TMOD = 0x01;TH0 = - 4000 / 256;TL0 = - 4000 & 256;TR0 = 1;IE = 0x82;while(1);}////T0中断//void LED_Screen_Display() interrupt 1{uchar i;if(p1 !=0xFF && Current_Level == Dest_Level){if (p1 == 0xFE) Dest_Level=5;if (p1 == 0xFD) Dest_Level=4;if (p1 == 0xFB) Dest_Level=3;if (p1 == 0xF7) Dest_Level=2;if (p1 == 0xEF) Dest_Level=1;}TH0 = - 4000 / 256;TL0 = - 4000 & 256;P3 = _crol_(P3 , 1);i=Current_level * 8 + r + offset;P0= ~Table_OF_Digits[i];//上升if (Current_Level < Dest_Level){if( ++r == 8){r = 0;if( ++x == 4){x = 0;if (++offset == 8){offset = 0;Current_Level++;}}}}//下降显示elseif(Current_Level > Dest_Level){if( ++r == 8){r=0;if(++x == 4){x=0;if(--offset == -8){offset=0;Current_Leven--;}}}}//停止滚动，保持稳定的刷新显示else{if( ++r == 8) r = 0; }}编译结果TEXT2.C(44): error C202: 'p1': undefined identifierTEXT2.C(45): error C202: 'p1': undefined identifierTEXT2.C(46): error C202: 'p1': undefined identifierTEXT2.C(52): error C202: 'Current_level': undefined identifierTEXT2.C(84): error C202: 'Current_Leven': undefined identifierTarget not created
回答：前面定义的是Current_Level后面引用了Current_Leven，Current_Leven未定义，把Current_Leven全改为Current_Level就好了