求助大神,我想要在8*8LED矩阵上面显示学号,程序是下面这样,但是我现在只能输出4个数字,后面的显示不出来了,求助一下
#include <reg52.h>
typedef unsigned char uint8;
typedef unsigned int uint16;
sbit acon=P1^0;
sbit bcon=P1^1;
sbit ccon=P1^2;
sbit en=P1^7;
uint8 j=0,k=0;
uint16 i=0;
code uint8 ledcode[]={ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xC3,0xBD,0xFD,0xC3,0xBF,0xBD,0xC3,
0xFF,0xC3,0xBD,0xBD,0xBD,0xBD,0xC3,0xFF,
0xFF,0xFB,0xFB,0xFB,0xFB,0xFB,0xFB,0xFF,
0xFF,0xC3,0xBD,0xFD,0xC3,0xFD,0xC3,0xFF,
0xFF,0xFB,0xFB,0xFB,0xFB,0xFB,0xFB,0xFF,
0xFF,0xC3,0xBD,0xFD,0xC3,0xFD,0xC3,0xFF,
0XFF,0XC3,0XBD,0XBD,0XBD,0XBD,0XC3,0XFF,
0XFF,0XC3,0XBD,0XBF,0XC3,0XBD,0XBD,0XC3,
0xFF,0xC3,0xBD,0xBD,0xBD,0xBD,0xC3,0xFF,
0xFF,0xC3,0xBD,0xBD,0xBD,0xBD,0xC3,0xFF,
0XFF,0XEB,0XCB,0XFB,0XFB,0XFB,0XFB,0XFF
};
void timer1_init()
{
TMOD|=0x10;
TMOD&=0xef;
TH1=0xfc; //1ms
TL1=0x66;
TR1=1;
}
void inter_init()
{
ET1=1;
EA=1;
}
void frush()
{
switch(j)
{
case 0:acon=0;bcon=0;ccon=0;break;
case 1:acon=1;bcon=0;ccon=0;break;
case 2:acon=0;bcon=1;ccon=0;break;
case 3:acon=1;bcon=1;ccon=0;break;
case 4:acon=0;bcon=0;ccon=1;break;
case 5:acon=1;bcon=0;ccon=1;break;
case 6:acon=0;bcon=1;ccon=1;break;
case 7:acon=1;bcon=1;ccon=1;break;
}
P2=ledcode[k+j];
if(j==7)j=0;
j++;
}
main()
{
en=1;
P2=0xff;
timer1_init();
inter_init();
while(1);
}
void timer1_interrupt() interrupt 3
{
TH1=0xfc;
TL1=0x66;
i++;
frush();
if(i==500)
{
i=0;
if(k==32)k=0;
k++;
}
}