#includereg51.hunsignedcharcodeSelect[]={0x01,0x02};unsignedcharcodeLed_Codes[]={0xc0,0xf9,0xa4,0xb0,0x99,//0-40x92,0x82,0xf8,0x80,0x90,//5-90x88,0x83,0xc6,0xa1,0x86,//A,b,C,d,E0x8e,0xff,0x0c,0x89,0x7f,0xbf//F,空格,P,H,.,-};voidmain(){chari=0;longintj;while(1){P2=0;P1=Led_Codes;P2=Select;for(j=3000;j0;j--);i;if(i1)i=0;}连线方法:P1为段选,由P1.0到P1.7分别通过保护电阻连接到阴极数码管的a-g、dp,P2为位选,连接1、2。单片机另接晶振、电源即可。显示字符和延时时间可根据需要改变 |