【实例简介】8*8*8光立方
【实例截图】

【核心代码】
void sinter()
{
IE=0x82;
TCON=0x01;
TH0=0xc0;
TL0=0;
TR0=1;
}
void delay5us(void) //误差 -0.026765046296us STC 1T 22.1184Mhz
{
unsigned char a,b;
for(b=7;b>0;b--)
for(a=2;a>0;a--);
}
void delay(uint i)
{
while (i--){
delay5us();}//12t的mcu 注释这个延时即可
}
/*To judge the num bit*/
uchar judgebit(uchar num,uchar b)
{
char n;
num=num&(1<<b);
if (num)
n=1;
else
n=0;
return n;
}
/*To figure out the round number*/
uchar abs(uchar a)
{
uchar b;
b=a/10;
a=a-b*10;
if (a>=5)
b ;
return b;
}
/*To figure out the absolute value*/
uchar abss(char a)
{
if (a<0)
a=-a;
return a;
}
/*The function can comparat the character.
And remove the big one to the back.*/
void max(uchar *a,uchar *b)
{
uchar t;
if ((*a)>(*b))
{
t=(*a);
(*a)=(*b);
(*b)=t;
}
}
/*The function is to figure out the max number and return it.*/
uchar maxt(uchar a,uchar b,uchar c)
{
if (a<b)
a=b;
if (a<c)
a=c;
return a;
}
void clear(char le)
{
uchar i,j;
for (j=0;j<8;j )
{
for (i=0;i<8;i )
display[j][i]=le;
}
}
void trailler(uint speed)
{
char i,j;
for (i=6;i>=-3;i--)
{
if (i>=0)
{
for (j=0;j<8;j )
display[j][i]=display[j][i 1];
}
if (i<4)
{
for (j=0;j<8;j )
display[j][i 4]=0;
}
delay(speed);
}
}
void point(uchar x,uchar y,uchar z,uchar le)
{
uchar ch1,ch0;
ch1=1<<x;
ch0=~ch1;
if (le)
display[z][y]=display[z][y]|ch1;
else
display[z][y]=display[z][y]&ch0;
}
void type(uchar cha,uchar y)
{
uchar xx;
for (xx=0;xx<8;xx )
{
display[xx][y]=table_cha[cha][xx];
}
}
网友评论
我要评论