单片机16*16的点阵滚动显示汇编程序,发我下吧,我想学学,谢谢 397907940@qq.com
1个回答
展开全部
序清单:
//4* 8X8 LED点阵流动显示 0~9
//2011 12 16 E:\DPJ_C\点阵DIY\4X8X8\4X8X8_C.c
#include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit SH_CP=P2^0;
sbit DS=P2^1;
sbit ST_CP=P2^2;
uchar code tab[ ]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x07,0xF0,0x1F,0xFC,0x3F,0xFE,0x38,0x0E,0x70,0x07,0x60,0x03,0x60,0x03,
0x60,0x03,0x60,0x03,0x60,0x03,0x70,0x07,0x38,0x0E,0x3F,0xFE,0x1F,0xFC,0x07,0xF0,/*"0",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x1C,0x00,
0x18,0x00,0x3F,0xFF,0x7F,0xFF,0x7F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"1",1*/
0x00,0x03,0x08,0x07,0x18,0x07,0x38,0x0F,0x30,0x0F,0x60,0x1B,0x60,0x13,0x60,0x33,
0x60,0x23,0x60,0x63,0x60,0x43,0x60,0xC3,0x71,0x83,0x3F,0x83,0x3F,0x03,0x1E,0x03,/*"2",2*/
0x00,0x00,0x08,0x08,0x18,0x0C,0x38,0x0E,0x30,0x06,0x60,0x03,0x60,0x03,0x61,0x83,
0x61,0x83,0x61,0x83,0x61,0x83,0x73,0xC7,0x3F,0xC6,0x3E,0xFE,0x1C,0x7C,0x00,0x38,/*"3",3*/
0x00,0x00,0x00,0x30,0x00,0x70,0x00,0xF0,0x01,0xB0,0x03,0x30,0x06,0x30,0x0C,0x30,
0x18,0x30,0x30,0x30,0x7F,0xFF,0x7F,0xFF,0x7F,0xFF,0x00,0x30,0x00,0x30,0x00,0x30,/*"4",4*/
0x00,0x00,0x00,0x08,0x07,0x8C,0x7F,0x8E,0x7F,0x86,0x79,0x03,0x63,0x03,0x63,0x03,
0x63,0x03,0x63,0x03,0x63,0x03,0x63,0x87,0x61,0x8E,0x61,0xFE,0x60,0xFC,0x00,0x78,/*"5",5*/
0x00,0x00,0x03,0xF0,0x0F,0xFC,0x1F,0xFE,0x3D,0x8E,0x31,0x87,0x73,0x03,0x63,0x03,
0x63,0x03,0x63,0x03,0x63,0x03,0x63,0x87,0x71,0x8E,0x39,0xFE,0x38,0xFC,0x08,0x78,/*"6",6*/
0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x01,0x60,0x03,0x60,0x0F,0x60,0x1F,
0x60,0x7C,0x60,0xF8,0x63,0xE0,0x6F,0x80,0x7F,0x00,0x7C,0x00,0x78,0x00,0x60,0x00,/*"7",7*/
0x00,0x00,0x00,0x38,0x1C,0x7C,0x3E,0x7E,0x3E,0xE6,0x73,0xC7,0x63,0xC3,0x61,0x83,
0x61,0x83,0x61,0x83,0x63,0xC3,0x73,0xC7,0x3E,0xE6,0x3E,0x7E,0x1C,0x7C,0x00,0x38,/*"8",8*/
0x00,0x00,0x0F,0x08,0x1F,0x8E,0x3F,0xCE,0x30,0xC7,0x70,0xE3,0x60,0x63,0x60,0x63,
0x60,0x63,0x60,0x63,0x60,0x67,0x70,0xC6,0x38,0xDE,0x3F,0xFC,0x1F,0xF8,0x07,0xE0,/*"9",9*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
};
//顺向、逐列、阴码 MICROSOFT SANS SERIF 字宽32 字高25 MATRIX-8X8-GREEN 右旋90度 左右翻转
// MATRIX-8X8-RED 左旋90度 上下翻转
void delay_ms(unsigned int ms)
{
uchar j;
while(ms--)
for(j=0;j<123;j++);
}
void WriteByte(uchar dat)
{
uchar k;
for(k=0;k<8;k++)
{
dat=dat>>1;
DS=CY;
SH_CP=0;
SH_CP=1;
}
}
void main()
{
uchar num,temp,n,m;
while(1)
{
for(n=0;n<176;n++) //
for(m=0;m<8;m++) //重复显示8次
{
temp=0;// 不加此条,流动飞快
for(num=n;num<16+n;num++)
{
//WriteByte(tab[2*num+2*16+1]);
//WriteByte(tab[2*num+2*16]);
WriteByte(tab[2*num+1]);
WriteByte(tab[2*num+0]);
P1=temp;
ST_CP=0;
ST_CP=1;
delay_ms(1);
temp++;
if(temp==16)
temp=0;
}
}
}
}
//4* 8X8 LED点阵流动显示 0~9
//2011 12 16 E:\DPJ_C\点阵DIY\4X8X8\4X8X8_C.c
#include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit SH_CP=P2^0;
sbit DS=P2^1;
sbit ST_CP=P2^2;
uchar code tab[ ]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x07,0xF0,0x1F,0xFC,0x3F,0xFE,0x38,0x0E,0x70,0x07,0x60,0x03,0x60,0x03,
0x60,0x03,0x60,0x03,0x60,0x03,0x70,0x07,0x38,0x0E,0x3F,0xFE,0x1F,0xFC,0x07,0xF0,/*"0",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x1C,0x00,
0x18,0x00,0x3F,0xFF,0x7F,0xFF,0x7F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"1",1*/
0x00,0x03,0x08,0x07,0x18,0x07,0x38,0x0F,0x30,0x0F,0x60,0x1B,0x60,0x13,0x60,0x33,
0x60,0x23,0x60,0x63,0x60,0x43,0x60,0xC3,0x71,0x83,0x3F,0x83,0x3F,0x03,0x1E,0x03,/*"2",2*/
0x00,0x00,0x08,0x08,0x18,0x0C,0x38,0x0E,0x30,0x06,0x60,0x03,0x60,0x03,0x61,0x83,
0x61,0x83,0x61,0x83,0x61,0x83,0x73,0xC7,0x3F,0xC6,0x3E,0xFE,0x1C,0x7C,0x00,0x38,/*"3",3*/
0x00,0x00,0x00,0x30,0x00,0x70,0x00,0xF0,0x01,0xB0,0x03,0x30,0x06,0x30,0x0C,0x30,
0x18,0x30,0x30,0x30,0x7F,0xFF,0x7F,0xFF,0x7F,0xFF,0x00,0x30,0x00,0x30,0x00,0x30,/*"4",4*/
0x00,0x00,0x00,0x08,0x07,0x8C,0x7F,0x8E,0x7F,0x86,0x79,0x03,0x63,0x03,0x63,0x03,
0x63,0x03,0x63,0x03,0x63,0x03,0x63,0x87,0x61,0x8E,0x61,0xFE,0x60,0xFC,0x00,0x78,/*"5",5*/
0x00,0x00,0x03,0xF0,0x0F,0xFC,0x1F,0xFE,0x3D,0x8E,0x31,0x87,0x73,0x03,0x63,0x03,
0x63,0x03,0x63,0x03,0x63,0x03,0x63,0x87,0x71,0x8E,0x39,0xFE,0x38,0xFC,0x08,0x78,/*"6",6*/
0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x01,0x60,0x03,0x60,0x0F,0x60,0x1F,
0x60,0x7C,0x60,0xF8,0x63,0xE0,0x6F,0x80,0x7F,0x00,0x7C,0x00,0x78,0x00,0x60,0x00,/*"7",7*/
0x00,0x00,0x00,0x38,0x1C,0x7C,0x3E,0x7E,0x3E,0xE6,0x73,0xC7,0x63,0xC3,0x61,0x83,
0x61,0x83,0x61,0x83,0x63,0xC3,0x73,0xC7,0x3E,0xE6,0x3E,0x7E,0x1C,0x7C,0x00,0x38,/*"8",8*/
0x00,0x00,0x0F,0x08,0x1F,0x8E,0x3F,0xCE,0x30,0xC7,0x70,0xE3,0x60,0x63,0x60,0x63,
0x60,0x63,0x60,0x63,0x60,0x67,0x70,0xC6,0x38,0xDE,0x3F,0xFC,0x1F,0xF8,0x07,0xE0,/*"9",9*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
};
//顺向、逐列、阴码 MICROSOFT SANS SERIF 字宽32 字高25 MATRIX-8X8-GREEN 右旋90度 左右翻转
// MATRIX-8X8-RED 左旋90度 上下翻转
void delay_ms(unsigned int ms)
{
uchar j;
while(ms--)
for(j=0;j<123;j++);
}
void WriteByte(uchar dat)
{
uchar k;
for(k=0;k<8;k++)
{
dat=dat>>1;
DS=CY;
SH_CP=0;
SH_CP=1;
}
}
void main()
{
uchar num,temp,n,m;
while(1)
{
for(n=0;n<176;n++) //
for(m=0;m<8;m++) //重复显示8次
{
temp=0;// 不加此条,流动飞快
for(num=n;num<16+n;num++)
{
//WriteByte(tab[2*num+2*16+1]);
//WriteByte(tab[2*num+2*16]);
WriteByte(tab[2*num+1]);
WriteByte(tab[2*num+0]);
P1=temp;
ST_CP=0;
ST_CP=1;
delay_ms(1);
temp++;
if(temp==16)
temp=0;
}
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询