#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar x[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
sbit SHCP=P1^1;
sbit STCP=P1^3;
sbit DS=P1^0;
sbit OE=P3^1;
void delay(uchar temp)
{
int i=0;
for(i =0;i<120;i++)
{
while(temp--);
}
}
void hc595(uchar temp)
{
uchar i;
CY=0;
for(i=0;i<8;i++)
{
temp=temp<<1;
SHCP=0;
DS=CY;
SHCP=1;
}
OE=0;
STCP=1;
delay(5);
STCP=0;
delay(200);
}
void main()
{
uchar i;
for(i=0;i<10;i++)
{
hc595(x[i]);
delay(200);
}
}