下面关于点阵的程序,不知道哪里出了问题,点阵显示混乱!这是一个关于循环显示数字的程序!
求大神帮忙找到问题!
#include "reg51.h"
#include "intrins.h"
#define uchar unsigned char
#define uint unsigned int
uchar code tableb[]=
{
0x00,0x3e,0x41,0x41,0x41,0x3e,0x00,0x00,
0x00,0x00,0x00,0x21,0x7f,0x01,0x00,0x00,
0x00,0x4f,0x89,0x89,0x89,0x71,0x00,0x00,
0x00,0x22,0x49,0x49,0x49,0x36,0x00,0x00,
0x00,0x0c,0x14,0x24,0x7f,0x04,0x00,0x00,
0x00,0x72,0x51,0x51,0x51,0x4e,0x00,0x00,
0x00,0x3e,0x49,0x49,0x49,0x26,0x00,0x00,
0x00,0x40,0x40,0x40,0x4f,0x70,0x00,0x00,
0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00,
0x00,0x32,0x49,0x49,0x49,0x3e,0x00,0x00
};
uchar i=0;
uchar dis_num=0;
uint t=0;
void main(void)
{
P0=0xfe;
TMOD=0x01;
TH0=0xff;
TL0=0x00;
EA=1;
ET0=1;
TR0=1;
while(1);
}
void Timer0(void) interrupt 1
{
TH0=0xff;
TL0=0x00;
P0=_crol_(P0,1);
P2=tableb[dis_num*8+i];
if(++i==10) i=0;
if(++t==1500)
{
t=0;
if(++dis_num==8) dis_num=0;
}
一周热门 更多>