|
#include<reg52.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar byte;
sbit io=P2^6;
sbit clk=P2^7;
void deply(uchar z);
uchar table[]={ 0x3f , 0x06 , 0x5b , 0x4f ,
0x66 , 0x6d , 0x7d , 0x07 ,
0x7f , 0x6f , 0x77 , 0x7c ,
0x39 , 0x5e , 0x79 , 0x71 };
void sendbyte(byte)
{
uchar num,c;
num=table[byte];
for(c=0;c<16;c++)
{
clk=0;
io=num&0x01;
clk=1;
num=_cror_(num,1);
P0=table[num];
deply(1000);
}
}
void main()
{
io=0;
P0=1^0;
io=1;
while(1)
{
sendbyte(1);
deply(1000);
}
}
void deply(uchar z)
{
uchar i,j;
for(i=z;i>0;i--)
for(j=500;j>0;j--);
} |
|