2、3PO.TMP?RP1:nU27«LBCK#include#defineuintunsignedint#defineucharunsignedcharinta,num;sbitA0=P2A0;sbitAl=P2Al;sbitA3=P2A2;voidinit();ucharcodetable[]={Ox3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,Ox77,0x7c,0x39,0x5e,0x79,0x71};voidmain(){init();num
3、=0;PO=table[O];while(l)A0=0;A1=0;A3=0;if(a==20)a=0;num++;if(num==10)num=0;PO=table[num];}}}voidtimerO()interruptl{TH0=(65536-50000)/256;TL0=(65536-50000)%256;a++;voidinit(){TMOD=0x01;TH0=(65536-50000)/256;TL0=(65536-50000)%256;EA=1;ET(上l;TRO=1;2、让YO所对应的数码管显示“0
4、”,Yl显示“1”,Y2显示“2”以此类推最后Y7显示“7”,间隔1秒PZ2*A1OPZ3TA11PZ>il3r1P03A>7PO3At3PO.MA»«rDAA»5rojacAicRO.T#defineuintunsignedint#defineucharunsignedcharinta,num;sbitA0
5、=P2A0;sbitAl=P2Al;sbitA2=P2A2;voidinit();ucharcodetable[l={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};voidmain(){init();num=0;P0=table[()];whilc(l){if(a==20){a=();num++;if(num==8)num=0;}switch(num)//位选,选择点亮的数码管,{case(0):A0
6、=0;A1=0;A2=0;break;case(l):A0=l;Al=0;A2=0;break;casc(2):A0=0;Al=l;A2=0;break;case(3):A0=l;Al=l;A2=0;break;case(4):A0=0;Al=0;A2=l;break;case(5):A0=l;Al=0;A2=l;break;case(6):A()=();A1=1;A2=1;break;casc(7):AO=1;A1=1;A2=1;break;PO=tablc[num];voidtimer()()interrupt
7、1{TH0=(65536-50000)/256;TL0=(65536-50000)%256;a++;voidinit(){TMOD=OxO1;TH0=(65536-50000)/256;TL0=(65536-50000)%256;EA=1;ET0=1;TR0=1;3、让YO所対应的数码管显示“0”,Y1显示“1”,Y2显示“2”以此类推最后Y7显示“7",间隔4毫秒,注意观察现象,和实验2有何区别0IE3HS&PBCDEFGDP12345678-FfFrraa-AtorawFOS'AtSra.FO?OK>Ti
8、4»fA0»X価1a2•■5J»■仔斥・0€7»aF2Z*10FZ3A11•Z40U2F2Sr*l3F70AU»zrmi»F3DUX0FXIffX»P335I5raarMT?nvroFayri9XCAMR”rIFCl#include#defineuintunsignedint#defineucharunsignedcharinta,num;