51单片机8*8点阵,字幕移动十分缓慢,程序如下
#include<reg52.h>#include<intrins.h>#defineucharunsignedcharucharcodeshulie[]={0x00,0...
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
uchar code shulie[]={0x00,0x4A,0x2A,0x1E,0x2A,0x4A,0x00,0x00,0x4A,0x2A,0x1E,0x2A,0x4A,0x00,0x40,0x2A,0x1E,0x0A,0x7E,0x0A,0x00,0x0C,0x1E,0x3E,0x7C,0xF8,0x7C,0x3E,0x1E,0x0C,0x00,0x00};//列字母编码“天天开心”
sbit lie=P2^5;
sbit hang=P2^6;
uchar num=0,i,a,b;
delay(uchar x)
{
uchar y,z;
for(y=0;y<5;y++)
for(z=0;z<x;z++);
}
void main()
{
lie=0;
hang=0;
EA=1;
ET1=1;
TMOD=0x10;
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
TR1=1;
while(1)
{
a=0xfe;
for(i=0;i<8;i++)
{
hang=1;
P0=0xff;
hang=0;
lie=1;
P0=shulie[num+i];
lie=0;
hang=1;
P0=a;
hang=0;
a=_crol_(a,1);
delay(3);
}
}
}
void time() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
b++;
if(b==10)
{
num++;
}
if(num==24)
{
num=0;
}
}
点阵阳极阴极都接P0口,分别是hang,lie来控制,
行 ,列为2个锁存器 展开
#include<intrins.h>
#define uchar unsigned char
uchar code shulie[]={0x00,0x4A,0x2A,0x1E,0x2A,0x4A,0x00,0x00,0x4A,0x2A,0x1E,0x2A,0x4A,0x00,0x40,0x2A,0x1E,0x0A,0x7E,0x0A,0x00,0x0C,0x1E,0x3E,0x7C,0xF8,0x7C,0x3E,0x1E,0x0C,0x00,0x00};//列字母编码“天天开心”
sbit lie=P2^5;
sbit hang=P2^6;
uchar num=0,i,a,b;
delay(uchar x)
{
uchar y,z;
for(y=0;y<5;y++)
for(z=0;z<x;z++);
}
void main()
{
lie=0;
hang=0;
EA=1;
ET1=1;
TMOD=0x10;
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
TR1=1;
while(1)
{
a=0xfe;
for(i=0;i<8;i++)
{
hang=1;
P0=0xff;
hang=0;
lie=1;
P0=shulie[num+i];
lie=0;
hang=1;
P0=a;
hang=0;
a=_crol_(a,1);
delay(3);
}
}
}
void time() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
b++;
if(b==10)
{
num++;
}
if(num==24)
{
num=0;
}
}
点阵阳极阴极都接P0口,分别是hang,lie来控制,
行 ,列为2个锁存器 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询