本文包含原理图、PCB、源代码、封装库、中英文PDF等资源
您需要 登录 才可以下载或查看,没有账号?注册会员
×
这是一个数码管动态显示的数据,目的是8个数码管先显示01234567然后12345678.....最后89abcdef
但结果跳的好快,延时没有作用是我delay放得位置不对吗。各位大大帮忙看看,小弟谢过了
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit LATCH1=P2^2;
sbit LATCH2=P2^3;
uchar code weima[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar code duanma[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void delay(uint);
void main()
{
uchar i,j;
j=0;
while(1)
{
if(j==8)
j=0;
else
{for(i=0;i<8;i++)
{
P0=weima[i];
LATCH2=1;
LATCH2=0;
P0=duanma[i+j];
LATCH1=1;
LATCH1=0;
delay(200);
}
delay(60000); }
j++;
}
}
void delay(uint z)
{
while(z--);
} |
|