#include<reg51.h>
#include<intrins.h>
unsigned char code tab[10]={
0xC0,/*0*/
0xF9,/*1*/
0xA4,/*2*/
0xB0,/*3*/
0x99,/*4*/
0x92,/*5*/
0x82,/*6*/
0xF8,/*7*/
0x80,/*8*/
0x90,/*9*/};
unsigned char a,b;
void delay10ms(int);
void main()
{
while(1)
{
b=0x01;
for(a=0;a<8;a++)
{
P2=b;
P0=tab[a];
b=_crol_(b,1);
delay10ms(1);
P2=00;
}
}
}
void delay10ms(int t)
{
unsigned char c,d;
for(;t>0;t--)
for(c=38;c>0;c--)
for(d=30;d>0;d--);
} |