新聞中心

8x8 LED 矩陣顯示

作者: 時間:2016-11-17 來源:網(wǎng)絡(luò) 收藏
C代碼:

#include
unsigned char code taba[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code tabb[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
void delay(void)
{
unsigned char i,j;
for(i=10;i>0;i--)
for(j=248;j>0;j--);
}
void delay1(void)
{
unsigned char i,j,k;
for(k=10;k>0;k--)
for(i=20;i>0;i--)
for(j=248;j>0;j--);
}
void main(void)
{
unsigned char i,j;
while(1)
{
for(j=0;j<3;j++) //from left to right 3 time
{
for(i=0;i<8;i++)
{
P0=taba[i];
P3=0xff;
delay1();
}

本文引用地址:http://butianyuan.cn/article/201611/315524.htm

}
for(j=0;j<3;j++) //from right to left 3 time
{
for(i=0;i<8;i++)
{
P0=taba[7-i];
P3=0xff;
delay1();
}
}
for(j=0;j<3;j++) //from top to bottom 3 time
{
for(i=0;i<8;i++)
{
P0=0x00;
P3=tabb[7-i];
delay1();
}
}
for(j=0;j<3;j++) //from bottom to top 3 time
{
for(i=0;i<8;i++)
{ P0=0x00;
P3=tabb[i];
delay1();
}
}
}
}
仿真原理圖:



關(guān)鍵詞: 8x8LED矩陣顯

評論


技術(shù)專區(qū)

關(guān)閉