標題:
視頻:單片機數(shù)碼管滾動顯示“I Love You”程序源代碼
[打印本頁]
作者:
niujia
時間:
2015-7-15 23:20
標題:
視頻:單片機數(shù)碼管滾動顯示“I Love You”程序源代碼
視頻演示:
http://player.youku.com/player.php/sid/XMzMzNTE3OTg4/v.swf
數(shù)碼管顯示部分的原理圖(只看顯示部分):
http://www.torrancerestoration.com/f/51hei-5.pdf
程序源代碼:
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit wela=P2^7;
sbit dula=P2^6;
uchar code duanma[]={0x06,0x00,0x38,0x3f,0x3e,0x79,0x00,0x6e,0x3f,0xbe,0x00};
uchar code weima[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar smg_change[11];
void display(uchar f,uchar n )
{
static uchar i;
P0=0X00;
dula=1;dula=0;
P0=weima[f+i];
wela=1;wela=0;
P0=smg_change[i];
dula=1;dula=0;
i++;
if(i==n)
i=0;
}
void jiaohuan()
{
uchar i,dd;
for(i=0;i<10;i++)
{
dd=smg_change[i];
smg_change[i]=smg_change[i+1];
smg_change[i+1]=dd;
}
}
void main()
{
uchar y,i;
uint t;
for(i=0;i<11;i++)
{
smg_change[i]=duanma[i];
}
while(1)
{
display(y,6);
t++;
if(t==10000)
{ t=0;
jiaohuan();
}
}
}
復(fù)制代碼
作者:
騰飛的龍
時間:
2015-7-23 14:36
感謝分享,很好的創(chuàng)意!
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1