#include<reg52.h>
#include <absacc.h>
#define uchar unsigned char
#define uint unsigned int
uchar data buf[9]={10,10,10,10,10,8,0,5,1};
uchar code regcode[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x00,0x7c,0x39,0x5e,0x79,0x71};
sbit duan=P2^6;
sbit wei=P2^7;
void delay(uint x)
{
uint i,j;
for(i=x;i>0;i--)
for(j=110;j>0;j--);
}
void display (uchar data *p)
{
uchar i,k;
k=0xfe;
for(i=0;i<6;i++)
{
duan=1;
P0=regcode[*p];
duan=0;
P0=0xff;
wei=1;
P0=k;
wei=0;
delay(4);
p++;
k=(k<<1)|0x01;
}
}
void tiaozheng()
{
uchar i,j;
j=buf[i];
for(i=0;i<5;i++)
{
buf[i]=buf[i+1];
buf[4]=j;
}
}
void main()
{
uint i;
while(1)
{
for(i=0;i<50;i++)
{
display(buf+5);
tiaozheng();
}
}
}
无法实现流动,求助大虾,再此表示感谢 |