非常简单的8*8LED点阵c51源代码
/* 实验目的:学会8*8点阵动态扫描方法. */
/* 实验现象:8*8点阵光柱先从0-9每隔一定的时间动态显示。 */
/*Copyright(C)铁牛 All Rights Reserved */
/*此程序仅用于学习与参考,引用请注明版权和作者信息!*/
/*************************************************************/
#includereg52.h>
#includeintrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar code row[] ={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//行扫描数组row0--row7.硬件定义为P1口。
uchar code word[][8]={
{0xC7,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xC7},//硬件定义为P0口。'0'
{0xEF,0x8F,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF},//硬件定义为P0口。'1'
{0xC7,0xBB,0xBB,0xF7,0xEF,0xDF,0xBF,0x83},//硬件定义为P0口。'2'
{0xC7,0xBB,0xFB,0xC7,0xFB,0xFB,0xBB,0xC7},//硬件定义为P0口。'3'
{0xE7,0xE7,0xD7,0xD7,0xB7,0x83,0xF7,0xF7},//硬件定义为P0口。'4'
{0x83,0xBF,0xBF,0x87,0xFB,0xFB,0xBB,0xC7},//硬件定义为P0口。'5'
{0xC7,0xBB,0xBF,0x87,0xBB,0xBB,0xBB,0xC7},//硬件定义为P0口。'6'
{0x83,0xFB,0xF7,0xF7,0xF7,0xEF,0xEF,0xEF},//硬件定义为P0口。'7'
{0xC7,0xBB,0xBB,0xC7,0xBB,0xBB,0xBB,0xC7},//硬件定义为P0口。'8'
{0xC7,0xBB,0xBB,0xBB,0xC3,0xFB,0xBB,0xC7},//硬件定义为P0口。'9'
};
void display(uchar);
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=100;b>0;b--);
}
void main()
{
uint i=1000;
uchar dis_num;
dis_num=0;
while(1)
{
for(i=100;i>0;i--)
{
if(dis_num==10)
dis_num=0;
display(dis_num);
}
dis_num++;
}
}
void display(uchar word_num)
{
uchar i;
for(i=0;i8;i++)
{
P1=row[i];
P0=word[word_num][i];
delay(1);
P1=0xff;
P0=0xff;
}
}
- 8*8点阵字移动显示程序(11-30)
- 51单片机+8*8点阵实现的贪食蛇源代码(11-30)
- 8*8点阵流水显示I 爱心“U”(11-29)
- 8*8LED点阵显示0-9(11-29)
- 8*8的点阵驱动程序(11-26)
- 51单片机—8*8LED点阵—09—①(11-25)