这是一款,使用AT89C51单片机,16*16点阵屏驱动使用了两片74HC154集成电路,整个电路非常简洁,使用的元件比较少,方便布线。压缩文件中附上了16*16点阵字模取模软件及使用示例图片,同时给出了仿真文件,方便使用学习。
#include
#define u8 unsigned char
#define u16 unsigned int
***it a=P2^4; //154芯片使能
***it b=P2^5;
u8 code led[][32]={
{0x02,0x02,0xFA,0x4A,0x4A,0x4A,0x4A,0xFE,0x4A,0x4A,0x4A,0x4A,0xFE,0x0B,0x02,0x00,
0x80,0x80,0x87,0x42,0x46,0x2A,0x12,0x2F,0x22,0x42,0x42,0x42,0x87,0x80,0x80,0x00,},// 更
{0x00,0x00,0x20,0x10,0x98,0xA4,0x47,0x24,0xE4,0x14,0x0C,0x04,0x00,0x00,0x00,0x00,
0x00,0x81,0x91,0x89,0x44,0x44,0x4A,0x31,0x11,0x11,0x09,0x05,0x03,0x01,0x00,0x00,},// 多
{0x00,0x00,0xF8,0x49,0x4A,0x4C,0x48,0xF8,0x48,0x4C,0x4A,0x49,0xFC,0x08,0x00,0x00,
0x10,0x10,0x17,0x12,0x12,0x12,0x12,0xFF,0x12,0x12,0x12,0x12,0x13,0x18,0x10,0x00,},//单
{0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x20,0x00,
0x80,0x40,0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,},//片
{0x10,0x10,0xD0,0xFF,0x90,0x10,0x00,0xFC,0x04,0x04,0x04,0xFE,0x04,0x00,0x00,0x00,
0x04,0x03,0x00,0xFF,0x80,0x41,0x20,0x1F,0x00,0x00,0x00,0x3F,0x40,0x40,0x70,0x00,},//机
{0x24,0x24,0xA4,0xFE,0xA3,0x22,0x20,0x7E,0x42,0x42,0x42,0x42,0x42,0x7F,0x02,0x00,
0x08,0x06,0x01,0xFF,0x00,0x43,0x41,0x49,0x49,0x49,0x7F,0x49,0x4D,0x69,0x41,0x00,},//程
{0x00,0x00,0xFC,0x04,0x14,0x14,0x14,0x55,0x96,0x54,0x34,0x14,0x16,0x04,0x00,0x00,
0x40,0x30,0x0F,0x00,0x01,0x01,0x41,0x81,0x7F,0x01,0x01,0x05,0x03,0x01,0x00,0x00,},//序
{0x80,0x40,0x20,0xF8,0x07,0x10,0x10,0x10,0xF1,0x96,0x90,0x90,0xD0,0x98,0x10,0x00,
0x00,0x00,0x00,0xFF,0x00,0x80,0x40,0x30,0x0F,0x40,0x80,0x40,0x3F,0x00,0x00,0x00,},//仿
{0x00,0x04,0x04,0xF4,0x54,0x54,0x54,0x5F,0x54,0x54,0x54,0xFC,0x16,0x04,0x00,0x00,
0x10,0x10,0x90,0x5F,0x35,0x15,0x15,0x15,0x15,0x15,0x35,0x5F,0xD0,0x18,0x10,0x00,},//真
{0x20,0x22,0xEC,0x00,0x20,0x22,0xAA,0xAA,0xAA,0xBF,0xAA,0xAA,0xEB,0xA2,0x20,0x00,
0x00,0x00,0x7F,0x20,0x10,0x00,0xFF,0x0A,0x0A,0x0A,0x4A,0x8A,0x7F,0x00,0x00,0x00,},//请
{0x00,0x62,0x52,0x4A,0xC6,0x42,0x52,0x63,0xC2,0x00,0xF8,0x00,0x00,0xFF,0x00,0x00,
0x40,0x42,0x42,0x42,0x7F,0x22,0x23,0x22,0x20,0x00,0x0F,0x40,0x80,0x7F,0x00,0x00,},//到
{0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xFC,0x08,0x00,0x00,0x00,
0x00,0x07,0x02,0x02,0x02,0x02,0x3F,0x42,0x42,0x42,0x42,0x47,0x40,0x70,0x00,0x00,},//电
{0x80,0x80,0x82,0x82,0x82,0x82,0x82,0xE2,0xA2,0x92,0x8A,0x86,0x80,0xC0,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,},//子
{0x00,0x80,0xC0,0xBC,0x84,0x84,0x84,0xF4,0x82,0x82,0x83,0x82,0x80,0xC0,0x80,0x00,
0x00,0x40,0x20,0x10,0x0C,0x40,0x80,0x7F,0x00,0x00,0x04,0x08,0x30,0x60,0x00,0x00,},//乐
{0x00,0x00,0xFE,0x0A,0x2A,0x2A,0xAA,0x6A,0x2A,0x2A,0xAA,0x2A,0x2F,0x22,0x00,0x00,
0x40,0x30,0x4F,0x48,0x48,0x49,0x49,0x49,0x7F,0x49,0x49,0x49,0x4C,0x68,0x40,0x00,},//屋
};
void delay(u16 ms)
{
u8 s=0;
while(--ms)
{
for(s=0;s<88;s++);
}
}
u8 K=0;
void LedScan(u8 x)
{
static u8 i = 0;
for(i=0;i<16;i++) //上半屏显示
{a=0;
b=1;
P2 = (P2 & 0xf0) | i;
P0=led[x];
delay(2);
}
for(i=0;i<16;i++) //下半屏显示
{
a=1;
b=0;
P2 = (P2 & 0xf0) | i;
P0=led[x][i+16];
delay(2);
}
}
void main()
{
a=1;
b=1;
TMOD = 0x01;
TH0 = 0x0D8;
TL0 = 0x0F0;
EA = 1;
ET0 = 1;
TR0 = 1;
while(1)
{
LedScan(K);
}
}
void Timer0Interrupt(void) interrupt 1
{
static u16 dd=0;
TH0 = 0x0D8;
TL0 = 0x0F0;
dd++;
if(dd==50)
{ dd=0;
K++;
if(K==15)//显示的字数个数
{K=0;}
}
}
5
|
|
|
|