#include<reg51.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
sbit SER=P1^5;
sbit RCK=P1^6;
sbit SCK=P1^7;
uchar temp;
uchar code table[]={0x41 ,0xf9, 0x83, 0xa1 ,0x39 ,0x25, 0x05, 0xf1
,0x01 ,0x21, 0x11, 0x0d ,0x47, 0x89, 0x07, 0x17
};
void Delay(uint x)
{
uchar i;
while(x--)
{
for(i=0;i<120;i++);
}
}
void In_595(uchar temp)
{
uchar i;
for(i=0;i<8;i++)
{
SER=temp&0x01;
SCK= 0;
_nop_();
_nop_();
SCK= 1;
temp=temp>>1;
}
}
void Out_595()
{
RCK=0;
//nop_();
RCK=1;
//nop_();
RCK=0;
}
void main()
{ {
uchar i;
while(1)
{
for(i=0;i<16;i++)
{
temp =table[i];
In_595(temp);
Out_595();
Delay(1000);
}
}
}}