888光立方程序.docx
- 文档编号:2915636
- 上传时间:2022-11-16
- 格式:DOCX
- 页数:39
- 大小:19.39KB
888光立方程序.docx
《888光立方程序.docx》由会员分享,可在线阅读,更多相关《888光立方程序.docx(39页珍藏版)》请在冰豆网上搜索。
888光立方程序
#include
#include
#defineucharunsignedchar
#defineuintunsignedint
uchardisplay[8][8];
/*rank:
A,1,2,3,4,I,心,U*/
ucharcodetable_cha[8][8]={0x51,0x51,0x51,0x4a,0x4a,0x4a,0x44,0x44,0x18,0x1c,0x18,0x18,0x18,0x18,0x18,0x3c,0x3c,0x66,0x66,0x30,0x18,0xc,0x6,0xf6,0x3c,0x66,0x60,0x38,0x60,0x60,0x66,0x3c,0x30,0x38,0x3c,0x3e,0x36,0x7e,0x30,0x30,0x3c,0x3c,0x18,0x18,0x18,0x18,0x3c,0x3c,0x66,0xff,0xff,0xff,0x7e,0x3c,0x18,0x18,0x66,0x66,0x66,0x66,0x66,0x66,0x7e,0x3c};
/*the"ideasoft"*/
ucharcodetable_id[40]={0x81,0xff,0x81,0x00,0xff,0x81,0x81,0x7e,0x00,0xff,0x89,0x89,0x00,0xf8,0x27,0x27,0xf8,0x00,0x8f,0x89,0x89,0xf9,0x00,0xff,0x81,0x81,0xff,0x00,0xff,0x09,0x09,0x09,0x01,0x0,0x01,0x01,0xff,0x01,0x01,0x00};
/*railway*/
ucharcodedat[128]={0x0,0x20,0x40,0x60,0x80,0xa0,0xc0,0xe0,0xe4,0xe8,0xec,0xf0,0xf4,0xf8,0xfc,0xdc,0xbc,0x9c,0x7c,0x5c,0x3c,0x1c,0x18,0x14,0x10,0xc,0x8,0x4,0x25,0x45,0x65,0x85,0xa5,0xc5,0xc9,0xcd,0xd1,0xd5,0xd9,0xb9,0x99,0x79,0x59,0x39,0x35,0x31,0x2d,0x29,0x4a,0x6a,0x8a,0xaa,0xae,0xb2,0xb6,0x96,0x76,0x56,0x52,0x4e,0x6f,0x8f,0x93,0x73,0x6f,0x8f,0x93,0x73,0x4a,0x6a,0x8a,0xaa,0xae,0xb2,0xb6,0x96,0x76,0x56,0x52,0x4e,0x25,0x45,0x65,0x85,0xa5,0xc5,0xc9,0xcd,0xd1,0xd5,0xd9,0xb9,0x99,0x79,0x59,0x39,0x35,0x31,0x2d,0x29,0x0,0x20,0x40,0x60,0x80,0xa0,0xc0,0xe0,0xe4,0xe8,0xec,0xf0,0xf4,0xf8,0xfc,0xdc,0xbc,0x9c,0x7c,0x5c,0x3c,0x1c,0x18,0x14,0x10,0xc,0x8,0x4};
/*railway2*/
ucharcodedat2[28]={0x0,0x20,0x40,0x60,0x80,0xa0,0xc0,0xe0,0xe4,0xe8,0xec,0xf0,0xf4,0xf8,0xfc,0xdc,0xbc,0x9c,0x7c,0x5c,0x3c,0x1c,0x18,0x14,0x10,0xc,0x8,0x4};
/*railway3*/
ucharcodedat3[24]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x16,0x26,0x36,0x46,0x56,0x66,0x65,0x64,0x63,0x62,0x61,0x60,0x50,0x40,0x30,0x20,0x10};
/*3pchar*/
ucharcodetable_3p[3][8]={0xff,0x89,0xf5,0x93,0x93,0xf5,0x89,0xff,0x0e,0x1f,0x3f,0x7e,0x7e,0x3f,0x1f,0x0e,0x18,0x3c,0x7e,0xff,0x18,0x18,0x18,0x18};
/*initializtion
Thatistoinitializetheprogram.
Itiswritetosetthetimerinc52mcu.
Sotheprogramcanrenovatetheled_3d_cubeinfixedtimeusetheinterruptfunction.*/
voidsinter()
{
IE=0x82;
TCON=0x01;
TH0=0xc0;
TL0=0;
TR0=1;
}
voiddelay5us(void)//误差-0.026765046296usSTC1T22.1184Mhz
{
unsignedchara,b;
for(b=7;b>0;b--)
for(a=2;a>0;a--);
}
voiddelay(uinti)
{
while(i--){
delay5us();}//12t的mcu注释这个延时即可
}
/*Tojudgethenumbit*/
ucharjudgebit(ucharnum,ucharb)
{
charn;
num=num&(1<
if(num)
n=1;
else
n=0;
returnn;
}
/*Tofigureouttheroundnumber*/
ucharabs(uchara)
{
ucharb;
b=a/10;
a=a-b*10;
if(a>=5)
b++;
returnb;
}
/*Tofigureouttheabsolutevalue*/
ucharabss(chara)
{
if(a<0)
a=-a;
returna;
}
/*Thefunctioncancomparatthecharacter.
Andremovethebigonetotheback.*/
voidmax(uchar*a,uchar*b)
{
uchart;
if((*a)>(*b))
{
t=(*a);
(*a)=(*b);
(*b)=t;
}
}
/*Thefunctionistofigureoutthemaxnumberandreturnit.*/
ucharmaxt(uchara,ucharb,ucharc)
{
if(a
a=b;
if(a a=c; returna; } voidclear(charle) { uchari,j; for(j=0;j<8;j++) { for(i=0;i<8;i++) display[j][i]=le; } } voidtrailler(uintspeed) { chari,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); } } voidpoint(ucharx,uchary,ucharz,ucharle) { ucharch1,ch0; ch1=1< ch0=~ch1; if(le) display[z][y]=display[z][y]|ch1; else display[z][y]=display[z][y]&ch0; } voidtype(ucharcha,uchary) { ucharxx; for(xx=0;xx<8;xx++) { display[xx][y]=table_cha[cha][xx]; } } /*Thefirstvariableisthedistancefromthemidpoint. Thesecondisthelayer. thethirdistheflashspeedofthetimebetweeneachtwopoint. Theforthistheenableio,itcontrolsweatherdraworclaen.*/ voidcirp(charcpp,uchardir,ucharle) { uchara,b,c,cp; if((cpp<128)&(cpp>=0)) { if(dir) cp=127-cpp; else cp=cpp; a=(dat[cp]>>5)&0x07; b=(dat[cp]>>2)&0x07; c=dat[cp]&0x03; if(cpp>63) c=7-c; point(a,b,c,le); } } voidline(ucharx1,uchary1,ucharz1,ucharx2,uchary2,ucharz2,ucharle) { chart,a,b,c,a1,b1,c1,i; a1=x2-x1; b1=y2-y1; c1=z2-z1; t=maxt(abss(a1),abss(b1),abss(c1)); a=x1*10; b=y1*10; c=z1*10; a1=a1*10/t; b1=b1*10/t; c1=c1*10/t; for(i=0;i { point(abs(a),abs(b),abs(c),le); a+=a1; b+=b1; c+=c1; } point(x2,y2,z2,le); } voidbox(ucharx1,uchary1,ucharz1,ucharx2,uchary2,ucharz2,ucharfill,ucharle) { uchari,j,t=0; max(&x1,&x2); max(&y1,&y2); max(&z1,&z2); for(i=x1;i<=x2;i++) t|=1< if(! le) t=~t; if(fill) { if(le) { for(i=z1;i<=z2;i++) { for(j=y1;j<=y2;j++) display[j][i]|=t; } } else { for(i=z1;i<=z2;i++) { for(j=y1;j<=y2;j++) display[j][i]&=t; } } } else { if(le) { display[y1][z1]|=t
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 888 立方 程序