关于单片机控制电梯显示的问题?
不知道为什么我的点阵显示那里的1字变粗了?下面这个才是我想要的样子:代码如下:#include<reg51.h>unsignedcharcodetable0[8]={0x...
不知道为什么我的点阵显示那里的1字变粗了?
下面这个才是我想要的样子:
代码如下:
#include<reg51.h>
unsigned char code table0[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code table1[15][8]={ {0x00,0x00,0x00,0x22,0x7e,0x02,0x00,0x00},
{0x00,0x00,0x00,0x44,0xfc,0x04,0x00,0x00},
{0x00,0x00,0x00,0x88,0xf8,0x08,0x00,0x00},
{0x00,0x00,0x00,0x10,0xf0,0x10,0x00,0x00},
{0x00,0x00,0x00,0x20,0xe0,0x20,0x00,0x00},
{0x00,0x00,0x00,0x40,0xc0,0x40,0x00,0x00},
{0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00},//1
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x04,0x2c,0x54,0x24,0x04,0x00},
{0x00,0x00,0x08,0x58,0x08,0x48,0x08,0x00},
{0x00,0x00,0x10,0xb0,0x50,0x90,0x10,0x00},
{0x00,0x00,0x20,0x60,0xa0,0x20,0x20,0x00},
{0x00,0x00,0x40,0xc0,0x40,0x40,0x40,0x00},
{0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} //2
};
void delay(int a)
{
while(a--);
}
void main()
{
int i,j=0,a;
while(1)
{
for(a= 0; a<300; a++ ) //两个字之间的扫描间隔时间
{
for(i=0;i<8;i++)
{
P0=table0[i];
P1=table1[j][i];
}
delay(40);
}
j++;
if(j == 14)
{
j = 0;
}
}
} 展开
下面这个才是我想要的样子:
代码如下:
#include<reg51.h>
unsigned char code table0[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code table1[15][8]={ {0x00,0x00,0x00,0x22,0x7e,0x02,0x00,0x00},
{0x00,0x00,0x00,0x44,0xfc,0x04,0x00,0x00},
{0x00,0x00,0x00,0x88,0xf8,0x08,0x00,0x00},
{0x00,0x00,0x00,0x10,0xf0,0x10,0x00,0x00},
{0x00,0x00,0x00,0x20,0xe0,0x20,0x00,0x00},
{0x00,0x00,0x00,0x40,0xc0,0x40,0x00,0x00},
{0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00},//1
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x04,0x2c,0x54,0x24,0x04,0x00},
{0x00,0x00,0x08,0x58,0x08,0x48,0x08,0x00},
{0x00,0x00,0x10,0xb0,0x50,0x90,0x10,0x00},
{0x00,0x00,0x20,0x60,0xa0,0x20,0x20,0x00},
{0x00,0x00,0x40,0xc0,0x40,0x40,0x40,0x00},
{0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} //2
};
void delay(int a)
{
while(a--);
}
void main()
{
int i,j=0,a;
while(1)
{
for(a= 0; a<300; a++ ) //两个字之间的扫描间隔时间
{
for(i=0;i<8;i++)
{
P0=table0[i];
P1=table1[j][i];
}
delay(40);
}
j++;
if(j == 14)
{
j = 0;
}
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询