关于LED点阵显示的问题,会的大神希望您能帮着解答下啊!
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table1[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
uchar code table2[]={0xf7,0xf7,0xf7,0xc1,0xd5,0xc1,0xf7,0xf7};
uchar num,temp,BL;
sbit wela=P2^5;
sbit dula=P2^6;
void delay(uint);
void main()
{
int num;
while(1)
{
for(num=0;num<8;num++)
{
wela=1;
P0=0x80;
wela=0;
P0=table1[num];
delay(1);
dula=1;
P0=table2[num];
dula=0;
delay(1);
}
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=50;y>0;y--);
}
这是我写的程序,大家帮忙改一下,谢谢了,哦,对了,我的那个点阵模块是用两个74HC573控制的,也就是一个控制行,一个控制列。
uchar code table2[]={0xf7,0xf7,0xf7,0xc1,0xd5,0xc1,0xf7,0xf7};
请问你这个是在扫描么,好像有错哦
我是通过从下往上逐行进行扫描的额,就是先给最后一行写1嘛,然后点亮最后一行所需要亮的灯,然后再对第二行进行点亮,这样快速的点亮应该会显示啊
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table1[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
uchar code table2[]={0xf7,0xf7,0xf7,0xc1,0xd5,0xc1,0xf7,0xf7};
uchar num,temp,BL;
sbit wela=P2^5;
sbit dula=P2^6;
void delay(uint);
void main()
{
int num;
while(1)
{
for(num=0;num<8;num++)
{
wela=1;
P0=table1[num];
wela=0;
delay(1);
dula=1;
P0=table2[num];
dula=0;
delay(1);
dula=1;
P0=0xff;
dula=0;
}
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=50;y>0;y--);
}
试试
uchar code table1[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
是扫描。
uchar code table2[]={0xf7,0xf7,0xf7,0xc1,0xd5,0xc1,0xf7,0xf7};
是“中”吗?