#include <reg51.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
sbit SH=P2^0;
sbit DS=P2^1;
sbit ST=P2^2;
uchar tab[6][8]={{0x00,0x18,0x24,0x24,0x24,0x24,0x18,0x00},
{0x00,0x10,0x18,0x10,0x10,0x10,0x38,0x00},
{0x00,0x18,0x24,0x20,0x10,0x08,0x3C,0x00},
{0x00,0x18,0x24,0x20,0x10,0x20,0x24,0x18},
{0x00,0x10,0x18,0x14,0x3C,0x10,0x10,0x00},
{0x00,0x38,0x08,0x18,0x20,0x20,0x18,0x00}};
void delay(uchar i)
{
uchar j;
for(j=100;j>0;j--)
{
for(;i>0;i--)
;
}
}
void main()
{
uchar n,i,j,k,t;
//SH=0;
while(1)
{
// n=0x00;
n=0;
for (i=0;i<8;i++)
{
ST=0;
P0=i;
// for(j=0;j<8;j++)
{
for(k=0;k<5;k++)
{
t=tab[5][n];
for(j=0;j<8;j++)
{
SH=0;
_nop_();
if(t&0x80)
DS=1;
else
DS=0;
SH=1;
t<<=1;
_nop_();
}
//n++ ;
}
}
ST=1;
delay(10);
n++;
}
}
} |