|
这是我做的8*8显示点阵;采用51单片机的P1口,P3口控制
下面是代码
#include<reg51.h>
#define uchar unsigned char
//延时函数
void delay(uchar x)
{
uchar y;
for(;x>0;x--)
for(y=112;y>0;y--);
}
void main()
{
uchar i;
uchar table[]={0x0E,0x1E,0x3E,0x7C,0x7C,0x3E,0x1E,0x0E};//显示字符串
uchar tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
while(1)
{
for(i=0;i<=7;i++)//阵列循环扫描
{
P3=tab[i];
P1=table[i];
delay(10);//延时10Ms
}
}
}
源程序及仿真图见附件
|
|