本帖最后由 master183 于 2013-2-26 10:19 编辑
#include<reg52.h>
#define DataPort P0
sbit LATCH1=P2^2;
sbit LATCH2=P2^3;
unsigned char code dofly_DuanMa[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
unsigned char code dofly_WeiMa[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void Delay(unsigned int t);
main()
{
unsigned char i=0,num;
unsigned int j;
while(1)
{
DataPort=dofly_WeiMa;
LATCH2=1;
LATCH2=0;
DataPort=dofly_DuanMa[num+i]; 这里为什么是num+i?
LATCH1=1;
LATCH1=0;
Delay(200);
i++;j++;
if(8==i)
i=0;
if(j==500)
{
j=0;
num++;
if(num==9)
num=0;
}
}
}
void Delay(unsigned int t)
{
while(--t);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>