新闻中心

EEPW首页>嵌入式系统>设计应用> 51单片机驱动16*16点阵显示生日快乐程序

51单片机驱动16*16点阵显示生日快乐程序

作者: 时间:2016-11-30 来源:网络 收藏

Delayms(uint c)
{
uint a,b;
for(a=0;a for(b=0;b<120;b++);
}
void write(uchar com,uchar da)
{
uchar temp,i,j;
load=0;
clk=0;
for(i=0;i<8;i++)
{ temp=com;
if((temp&(0x80>>i))!=0)
din=1;
else din=0;
clk=1;
for(j=0;j<5;j++);
clk=0;
}
for(i=0;i<8;i++)
{ temp=da;
if((temp&(0x80>>i))!=0)
din=1;
else din=0;
clk=1;
for(j=0;j<5;j++);
clk=0;
}
load=1;

本文引用地址://m.amcfsurvey.com/article/201611/323745.htm

}

void main()

{

csh();
write(0x0c,0x01);//正常工作状态,关断模式
write(0x09,0x00);//译码选择,非BCD码
write(0x0a,0x0a);//亮度调节
write(0x0b,0x07);//显示位数
Initial_DS1302();
while(1)
{
DS1302_GetTime(&time1);
buf[7]=(time1.Second)%10;
buf[6]=(time1.Second)/10;
buf[4]=(time1.Minute)%10;
buf[3]=(time1.Minute)/10;
buf[1]=(time1.Hour)%10;
buf[0]=(time1.Hour)/10;
write(0x08,dispcode[buf[7]]);
write(0x07,dispcode[buf[6]]);
write(0x06,dispcode[10]);
write(0x05,dispcode[buf[4]]);
write(0x04,dispcode[buf[3]]);
write(0x03,dispcode[10]);
write(0x02,dispcode[buf[1]]);
write(0x01,dispcode[buf[0]]);
// Delayms(200);
num++;
if(num==137)
num=0;
for(r=0;r<105;r++)
for(j=q;j<32+q;j++)
{
P1=tab2[t];
KAI=1;
P2=0X00;
P2=tab1[j];
KAI=0;
j++;
KAI2=1;
P2=0X00;
P2=tab1[j];
KAI2=0;
P0=tab3[num];
delay(40);
t++;
if(t==16)
t=0;
}
q=q+32;
if(q==256)
q=0;
}
}
void delay(uint time)
{
uint linger;
for(linger=0;linger }


上一页 1 2 下一页

评论


技术专区

关闭