我写了一个程序想要让数码管显示1234.2345.3456.4567.5678.6789.789a.89ab.9abc.abcd.bcde.cdef.这样循环显示前面已经改得差不多了,但是我要它不停的循环,也就是说当它显示到cdef后又要显示1234我怎么写.我到这里就卡壳了,高手指点一下 #include <AT89X51.H>//声明 unsigned char LedT0; unsigned char Led1; unsigned char Led2; unsigned char Led3; unsigned char Led4; unsigned int i; const unsigned char table[16]={0x28,0xEB,0x32,0xA2,0xE1,0xA4,0x24,0xEA,0x20,0xA0,0x60,0x25,0x3c,0x23,0x34,0x74};
void int1() interrupt 1 using 1 { TF0 = 0; //清定时0中断标志 TH0 = 0xF6; //2.5MS TL0 = 0x3D; P2 |= 0xF0; //对P2口的高四位置1,关数码管
switch(LedT0) { case 0: P0 = table[Led1]; P2_4 = 0; LedT0 = 1; break; case 1: P0 = table[Led2]; P2_5 = 0; LedT0 = 2; break; case 2: P0 = table[Led3]; P2_6 = 0; LedT0 = 3; break; case 3: P0 = table[Led4]; P2_7 = 0; LedT0 = 0; break; default://语句d LedT0 = 0; break; } } void main(void) //主程序 { TMOD = 0x01; //设定T0为十六位定时模式。 TH0 = 0xF6; TL0 = 0x3D; //2MS TR0 = 1; //开定时器0 ET0 = 1; //致能定时0中断 TF0 = 0; //清定时0中断标志 EA = 1; //开总中断 LedT0 = 0; Led1 = 1; Led2 = 2; Led3 = 3; Led4 = 4; for(i=0;i<60000;i++); for(LedT0=0;LedT0<12;LedT0++)循环 { LedT0+=1; Led1+=1; Led2+=1; Led3+=1; Led4+=1; for(i=0;i<60000;i++);} } |