#include
#define uchar unsigned char
#define uint unsigned int
uchar code DSY_CODE[]=
{
0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff
};
uchar code dis_bet[]={7,3,1,4};
uchar code dis_pos[]={0x01,0x02,0x04,0x08};
void DelayMS(uint ms)
{
uchar t;
while(ms--)
{
for(t=0;t<120;t++);
}
}
void main()
{
uchar i;
for(i=0;i<4;i++)
{
P3=~dis_pos[i];
P2=~DSY_CODE[dis_bet[i]];
DelayMS(5);
}
}