標(biāo)題:
模擬花樣廣告燈顯示實(shí)驗(yàn)
[打印本頁(yè)]
作者:
liuda
時(shí)間:
2015-1-21 23:10
標(biāo)題:
模擬花樣廣告燈顯示實(shí)驗(yàn)
是用51hei單片機(jī)開(kāi)發(fā)板 電路圖詳見(jiàn):
http://www.torrancerestoration.com/f/51hei-5.pdf
p1口上面接8個(gè)燈.
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code LED1[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
uchar code LED2[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar code LED3[]={0x7e,0xbd,0xdb,0xe7,0xe7,0xdb,0xbd,0x7e};
uchar code LED4[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};
uchar code LED5[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};
//============
void delay(unsigned int k)
{
unsigned int i,j;
for(i=0;i<k;i++){
for(j=0;j<121;j++)
{;}}
}
//====================
void main(void)
{uchar cnt;
while(1)
{
for(cnt=0;cnt<8;cnt++)
{P1=LED1[cnt];
delay(200);}
//=======
for(cnt=0;cnt<8;cnt++)
{P1=LED2[cnt];
delay(200);}
//===========
for(cnt=0;cnt<8;cnt++)
{P1=LED3[cnt];
delay(200);}
//==========
for(cnt=0;cnt<8;cnt++)
{P1=LED4[cnt];
delay(200);}
//=========
for(cnt=0;cnt<8;cnt++)
{P1=LED5[cnt];
delay(200);}
}
}
復(fù)制代碼
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1