#include <REG52.H>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar display[8][8];
/*rank:Z,H,B,I,T,I,心,U*/
uchar code table_cha[8][8]={0x7E, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x7E,
0x66, 0x66, 0x66, 0x7E, 0x7E, 0x66, 0x66, 0x66,
0x3E, 0x66, 0x66, 0x7E, 0x7E, 0x66, 0x66, 0x3E,
0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C,
0x7E, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C,
0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, 0x18,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x3C};
/*学号:100401021023*/
uchar code xuehao[12][8]={0x18, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, //1
0x3C, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x3C, //0
0x3C, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x3C, //0
0x30, 0x38, 0x34, 0x32, 0x7F, 0x7F, 0x30, 0x30, //4
0x3C, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x3C, //0
0x18, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, //1
0x3C, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x3C, //0
0x18, 0x24, 0x42, 0x20, 0x10, 0x08, 0x04, 0x7E, //2
0x18, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, //1
0x3C, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x3C, //0
0x18, 0x24, 0x42, 0x20, 0x10, 0x08, 0x04, 0x7E, //2
0x3E, 0x7E, 0x60, 0x7E, 0x7E, 0x60, 0x7E, 0x3E}; //3
/*滚动型*/
uchar code table_id[160]={0x00, 0xC1, 0xA1, 0x91, 0x89, 0x85, 0x83, 0x00, //Z
0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, //H
0x00, 0xFF, 0x99, 0x99, 0x99, 0x99, 0x7E, 0x00, //B
0x00, 0x00, 0x81, 0xFF, 0xFF, 0x81, 0x00, 0x00, //I
0x00, 0x03, 0x03, 0xFF, 0xFF, 0x03, 0x03, 0x00, //T
0x00, 0x00, 0x82, 0xFF, 0xFF, 0x80, 0x00, 0x00, //1
0x00, 0x7E, 0xFF, 0xC3, 0xC3, 0xFF, 0x7E, 0x00, //0
0x00, 0x7E, 0xFF, 0xC3, 0xC3, 0xFF, 0x7E, 0x00, //0
0x70, 0x78, 0x6C, 0x66, 0xFF, 0xFF, 0x60, 0x00, //4
0x00, 0x7E, 0xFF, 0xC3, 0xC3, 0xFF, 0x7E, 0x00, //0
0x00, 0x00, 0x82, 0xFF, 0xFF, 0x80, 0x00, 0x00, //1
0x00, 0x7E, 0xFF, 0xC3, 0xC3, 0xFF, 0x7E, 0x00, //0
0x00, 0x84, 0xC2, 0xA1, 0x91, 0x8A, 0x84, 0x00, //2
0x00, 0x00, 0x82, 0xFF, 0xFF, 0x80, 0x00, 0x00, //1
0x00, 0x7E, 0xFF, 0xC3, 0xC3, 0xFF, 0x7E, 0x00, //0
0x00, 0x84, 0xC2, 0xA1, 0x91, 0x8A, 0x84, 0x00, //2
0x00, 0xDB, 0xDB, 0xDB, 0xDB, 0xFF, 0x7E, 0x00};//3
/*railway*/
uchar code dat[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};
/*railway 2*/
uchar code dat2[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};
/*railway 3*/
uchar code dat3[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};
/*3p char*/
uchar code table_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
That is to initialize the program .
It is write to set the timer in c52 mcu.
So the program can renovate the led_3d_cube in fixed time use the interrupt function.*/
void sinter()
{
IE=0x82;
TCON=0x01;
TH0=0xc0;
TL0=0;
TR0=1;
}
void delay5us(void) //误差 -0.026765046296us STC 1T 22.1184Mhz
{
unsigned char 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];
}
}
void type2(uchar cha,uchar y)
{
uchar xx;
for (xx=0;xx<8;xx++)
{
display[xx][y]=xuehao[cha][xx];
}
}
/*The first variable is the distance from the midpoint.
The second is the layer.
the third is the flash speed of the time between each two point.
The forth is the enable io,it controls weather draw or claen.*/
void cirp(char cpp,uchar dir,uchar le)
{
uchar a,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);
}
}
void line(uchar x1,uchar y1,uchar z1,uchar x2,uchar y2,uchar z2,uchar le)
{
char t,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<t;i++)
{
point(abs(a),abs(b),abs(c),le);
a+=a1;
b+=b1;
c+=c1;
}
point(x2,y2,z2,le);
}
void box(uchar x1,uchar y1,uchar z1,uchar x2,uchar y2,uchar z2,uchar fill,uchar le)
{
uchar i,j,t=0;
max(&x1,&x2);
max(&y1,&y2);
max(&z1,&z2);
for (i=x1;i<=x2;i++)
t|=1<<i;
小张要努力111
- 粉丝: 0
- 资源: 0
最新资源
- Socket tcp服务器端通信框架,服务器端部分,这是从一个商业级的物联网项目分离出来的核心代码,让你绕过最难写的Socket管理,内置两个Socket,有两个数据缓冲队列,,仅一个DLL文件,调用
- moubus下位机+上位机
- 三菱FX3U系列13伺服焊接系统程序,本人以前工程项目亲自编写,比系统包括了PLC之间通讯,伺服定位,模拟量高级应用 PLC程序,触摸屏程序,原理图全部包含 需要软件者送软件 送FX3U编程资料
- cocosCreator 实时高斯模糊套餐
- SecureJS目标网站链接采集工具
- 西门子1500plc,杀菌机功能比较齐整,程序灵活度很高,通过一级代码和二级代码,步骤和每步的动作都可在屏上更改,输出输入屏上灵活操作
- SM2、SM3、SM4加密解密源程序
- 信捷XDPLC和两台变频器通讯程序,已经实机量产运行 实时读取变频器频率,故障代码,多段速度通讯实时动态更新 基本上各品牌变频器都可以控制参照用 最大可控32台 走串口485.MODBUS R
- DSP28035 Bootloader CAN在线升级程序DSP Bootloader TMS320F28035、TMS320F28335 UART、SPI、TCP、CAN在线升级程序,提供Bootl
- CIBV6.0.24.apk
- 2ASK调制解调通信链路matlab误码率仿真【包括程序,中文注释,程序操作和讲解视频】
- 内网穿透介绍 于如何实现远程管理或让局域网的服务可以被公网访问到.比如: 微信公众号小程序开发调试 公网访问本地 web 项目 异地远程处理公司服务问题
- EverydayTechNews(每日科技新闻)每天自动发送科技新闻到邮箱
- 微信小程序开发入门教程:从注册账号到首屏‘Hello World’的完整流程指导
- HiToolsDeliverySetup_CN_1736978428458.zip
- 730528018599182MarkDown教程.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈