#include <REGX51.H>
unsigned char mang[]={0x3f,0x06....,};
unsigned int i,k;
#sbit data =P3^0;
#sbit sck= P3^1;
#sbit scl = P3^2;
void delay(unsigned short d)
{while(d>0,d--);
}
void quet( unsigned char x)
{int i;
for(i=0;i<8;i++)
{data=(x&0x80);
x<<=1;
sck=0;
sck=1;
}
scl=0;
scl=1;
}
void hienthi(unsigned char so1,unisgned char so2)
{
P1_0=1;
quet(mang[so1])delay(100);
P1_0=0;
{P1_1=1;
quet(mang[so2]);delay(100);
}}
void main()
{
while(1)
{
for(i=0;i<100;i++)
hienthi(i/10,i%10);
{quet(mang[i]);delay(10);
}}}
unsigned char mang[]={0x3f,0x06....,};
unsigned int i,k;
#sbit data =P3^0;
#sbit sck= P3^1;
#sbit scl = P3^2;
void delay(unsigned short d)
{while(d>0,d--);
}
void quet( unsigned char x)
{int i;
for(i=0;i<8;i++)
{data=(x&0x80);
x<<=1;
sck=0;
sck=1;
}
scl=0;
scl=1;
}
void hienthi(unsigned char so1,unisgned char so2)
{
P1_0=1;
quet(mang[so1])delay(100);
P1_0=0;
{P1_1=1;
quet(mang[so2]);delay(100);
}}
void main()
{
while(1)
{
for(i=0;i<100;i++)
hienthi(i/10,i%10);
{quet(mang[i]);delay(10);
}}}
Comment