基于单片机的光立方课程设计_第1页
基于单片机的光立方课程设计_第2页
基于单片机的光立方课程设计_第3页
基于单片机的光立方课程设计_第4页
基于单片机的光立方课程设计_第5页
已阅读5页,还剩58页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、单片机课程设计报告题 目 基于单片机的4*4*4光立方设计 系 别 计 算 机 科 学 系 专 业 计算机科学与技术 班 级 学 号 姓 名 指导教师 日 期 【摘要】当今社会,随着电子行业的不断发展,单片机的应用从根本上改变了传统的控制系统设计思想和设计方法,已广泛的应用在工业自动化、通信、自动检测、信息家电、电力电子航空航天等各个方面。成为现代生产和生活中不可缺少的一部分。我们学习单片机也一个学期了,此次单片机课程设计,我采用的是STC12C5A60S2系列的单片机,设计一个4*4*4模式的“光立方”。将LED灯分成4层,利用程序来编写各种不同的效果来控制LED的亮灭,最终使得整个立方体展

2、现不同的变换,美轮美奂,绚丽多彩。【关键词】单片机课程设计光立方1 绪论1.1 课题研究的背景“光立方”一词正逐渐引起了全国人民的关注,并得到了全球的高度肯定。所谓“光立方”:就是在平面LED基础上发展起来的新的显示技术,通过复杂的程序控制,在三维空间能够显示具有立体感的图形、动画等。由此,也掀起了光立方的设计与学习热潮,在原有的基础上不断增加难度,增加变换花样,吸引电子爱好者对其研究、创新。光立方是由LED灯组成,由于发光二级管质量比较稳定,使用寿命长,不用频繁地去更换,能减少成本,更节能。光立方作为一种特殊的显示资源,已用于一些广告行业、家庭、娱乐厅、会议室、大型演唱会、城市地标广场等场所

3、的布置和装饰,还可以用于更广泛方面,具有广阔的应用前景。1.2 课题研究的意义本次毕业设计一改传统的平面流水灯的风格,而是从平面向立体发展,通过更宽广的三维空间呈现出更加绚丽的效果,直接冲击着人们审美视觉,不在停留在乏味的平面成像。光立方主体部分由64个LED灯组成,在制作过程中锻炼学习动手焊接能力,并以低成本,智能化产品对实现经济利益、商业价值的形成具有积极的推动作用。光立方的研究极具创意和启发,而且可以低成本、高效益的研究未来的3D技术。2 总体设计2.1 设计目的    1进一步掌握单片机的原理及其功能。学会利用单片机做一些课外电子设计与制作。2.

4、熟悉LED点亮条件及其工作原理。3.熟悉光立方显示的原理及其相关的线路连接。4.通过此次的电路焊接和调试提高自己的动手及其分析问题的能力。2.2 工作原理光立方其功能相当于三维显示器,只不过光立方是由LED灯组成的三维的立方体。光立方显示的原理简单的说就是用单片机控制64个LED灯,在不同时刻点亮要显示图案位置所在的灯,利用人眼余辉效应,可以看到比较完整的显示图案或动画了。其原理如下: 光立方从下到上共4层,每一层16个LED的负极接到一起,第一层16个蓝色正极和16个红色正极分别单独引出,第二层的每个正极分别接到它对应第一层正极,第三层的正极接第二层的正极。就是竖着看是8个接到一个

5、正极上。连在一起的是阴极,这样焊接起来。光立方引出4层引出线加上16个正极引出线。3 系统硬件电路设计与实现3.1 元件清单PCB板*1,红蓝双色超高亮长脚LED*70,40P圆排母*4,5MMLED 间隔柱*5,5MM七彩LED*5,15MM铜柱*5,DC005线*1,DC005座*1,25V470UF电解电容*1,1K电阻*4,40P芯片底座*4,22P 瓷片电容*1,STC12C5A60S2芯片*1,11.0592M晶振*1,单芯导线*13.2 硬件电路设计本电路是由单片机STC12C5A60S2为控制核心,具有大容量程序存储器且是FLASH工艺的,具有串口烧写编程功能,低功耗;时钟源电

6、路有很多种,比如阻容低速时钟源、普通晶体时钟源、带缓冲放大的晶体时钟源等等,考虑到电路稳定及材料选购等方面,决定采用普通晶体时钟源,其中晶体用11.0592M的石英晶振。显示部份由显示部份由64个LED灯组成来进行显示。3.3 单片机最小系统单片机的最小系统就是让单片机能正常工作并发挥其功能时所必须的组成部分,也可理解为是用最少的元件组成的单片机可以工作的系统。对89C51单片机来说, 最小系统一般应该包括: 单片机、时钟电路、复位电路、输入/ 输出设备等。单片机的最小系统如下图所示:3.3 电路图设计通过电路图设计,方便搭建起光立方的架构。1. 电源设计电路图2. 时钟电路图3. 整体电路图

7、3.4 光立方搭建方法3.4.1 将LED从点到线的搭建首先接线下灯座的制作方法: 把40P圆排母用水口钳或者斜口钳剪成单针如下图所示把其余元器件焊接好后图:3.4.2 将LED从线到面的搭建进行八次上诉焊接后接下来就是将4束的LED焊接起来。在从点到线时是将所有LED的阴极连在一起,而这次则是将所有LED阳极弯折并依次连接,如图所示。注意:由于焊接过程中将产生静电容易将LED烧坏,因此本项工作完成后请认真检查每个灯的好坏,可以用万用笔等工具检测。同时检测灯与灯之间有没虚焊情况。3.4.3 将LED从面到体的搭建最后一个步骤是将已焊好的4个面进行焊接,其方法是将之前8个面上的阴极对应位置依次焊

8、接,最后留出的4个阴极与输出端进行连接。实物图如下图所示。 4. 系统软件设计4.1 主程序设计程序主函数运行流程框图如下图所示。4.2 软件测试光立方主要是通过程序来控制光立方体从而达到多种动画变化的效果。由于要形成多样的3D动画,在变成过程中也出现了不少的问题。最后经过多次的细心修改,顺利的完成了编程工作。4.3 结果分析本设计通过硬件设备和软件完美配合,总共呈现十一个连续的动画效果。经过多次的反复测试与分析,所呈现的动画与程序中预期的效果吻合,符合设计要求。在软硬件测试过程中让我们对原先设计的电路的原理及功能进一步熟悉,并对各电路模块和相关的芯片联合工作更加了解。在这个调试的过程中虽然挺

9、枯燥无味,但锻炼我们发现问题并解决问题的能力,对我们的专业知识起到了温故知新的作用。5 课程设计心得体会此次为期两个礼拜的课程设计,让我感受颇深。最终看到了绚丽多姿,变化多端的LED光立方的图案。在中,在很大程度上培养了自己的独立思考及其动手能力。学会了自己独立的发现问题、分析问题。老师在实验室指导我们的设计,在查阅资料仍找不到但答案的还可以请教老师。尽管此次设计过程中遇到些问题,但最终还是一步一个脚印过来了。此次设计在丁老师的指导下完成的,老师扎实的专业知识,让我觉得自己还有好多的知识需要去学习。在这大学的时间,要好好的提升自己的相关技能。程序代码#include <stc12c5a6

10、0s2.h>#include <intrins.h>#define uint unsigned int#define uchar unsigned char#define MAX_Delay 8#define MIN_Delay 1sbit S_1 = P1 1;sbit S_2 = P1 2;unsigned int pwm;unsigned char TimeDelay = 10;unsigned char Mode = 1;unsigned char code tabP2=0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F; /扫描uchar

11、 s=0;void DELAY_MS (uchar i)/unsigned int i;/while( -a != 0)/for(i = 0; i < 600; i+);/uchar x,j;for(j=0;j<i;j+)for(x=0;x<=148;x+);void Adc_Delay (uint a) uint i; while( -a != 0)for(i = 0; i < 600; i+);void Delay(uint z) uint x,y; for(x=80;x>0;x-) for(y=z;y>0;y-); void timer1_init()

12、TMOD |= 0x10;TH1 = 0;TL1 = 0;ET1 = 1;TR1 = 1;EA = 1;/* AD转换函数 */*/unsigned char Read (unsigned char CHA)unsigned char AD_FIN=0; /存储A/D转换标志 CHA &= 0x07; /选择ADC的8个接口中的一个(0000 0111 清0高5位) ADC_CONTR = 0x00;/ADC转换的速度(0XX0 0000 其中XX控制速度,请根据数据手册设置) _nop_(); ADC_CONTR |= CHA; /选择A/D当前通道 _nop_(); ADC_CON

13、TR |= 0x80; /启动A/D电源 Adc_Delay(1); /使输入电压达到稳定(1ms即可) ADC_CONTR |= 0x08; /启动A/D转换(0000 1000 令ADCS = 1)_nop_();_nop_();_nop_();_nop_(); while (AD_FIN =0) /等待A/D转换结束 AD_FIN = (ADC_CONTR & 0x10); /0001 0000测试A/D转换结束否 ADC_CONTR &= 0xE7; /1111 0111 清ADC_FLAG位, 关闭A/D转换, return (ADC_RES); /返回A/D转换结果

14、(8位)/* AD电容式触摸按键检测程序 */*/bit 1表示有感应物,0表示没有感应物 S1/*/bit S1(void)unsigned char R,mm=0,i,j,k;bit aa;j=0;k=0;for(i=0;i<10;i+) /一次采集数据的数量 Adc_Delay(3);R=Read(1); /读对应的口,触发对应的触摸按键if(R<0x2f) /此参数可调整感应灵敏度值在0x01到0x2Fk+;if(R = 0xFF) j+;if(k>1 && j>1)mm+;elsemm=0;if(mm>0)aa =1;elseaa=0;r

15、eturn(aa);/*/ S2/*/bit S2(void)unsigned char R,mm=0,i,j,k;bit aa;j=0;k=0;for(i=0;i<10;i+) /一次采集数据的数量Adc_Delay(3);R=Read(2);if(R<0x2F) /此参数可调整感应灵敏度值在0x01到0x2Fk+;if(R = 0xFF) j+;if(k>1 && j>1)mm+;elsemm=0;if(mm>0)aa =1;elseaa=0;return(aa); /结束呼吸灯专用uchar code table=0,0,1,2,3,4,5,

16、6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,10

17、5,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,;void PwmUp(uint a, uchar c)uchar i;if(c = 1)P3 = 0X00;else P0 = 0X00;P2 = 0X00;i = tablea;Delay(i);if(c = 1)P3 = 0XFF

18、;elseP0 = 0XFF;P2 = 0X00;Delay(150-i); void PwmDown(uint a,uchar c)uchar i;if(c = 1)P3 = 0XFF;else P0 = 0XFF;P2 = 0X00;i = tablea;Delay(i);if(c = 1)P3 = 0X00;elseP0 = 0X00;P2 = 0X00;Delay(150-i);void PwmAllon(uchar c)int i;for(i = 0; i < 150 ;i+)PwmDown(i,c);if(c = 1)P3 = 0X00;else P0 = 0X00;P2 =

19、 0X00;void PwmOff(uchar c)int i;/P3 = 0XFF;/P2 = 0X00;/Delay(100);for(i = 0; i < 150; i+) PwmUp(i,c);/P3 = 0X00; void Allfalloff(uchar c,uchar time) /由全亮到下落关闭只剩一排unsigned char code tabP058=0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x0

20、0,0xFF,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,;int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<5;j+)for(k=0;k<15;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP0=tabP0ji;

21、DELAY_MS(time);void Randomlight(uchar c,uchar time) /随机亮完unsigned char code tabP0388=0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x20,0x00,0x00,0x00,0x02,0x10,0x00,0x00,0x20,0x04,0x00,0x00,0x02,0x10,0x00,0x00,0xA0,0x04,0x00,0x00,0x02,0x10,0x00,0x00,0xA0,0x24,

22、0x10,0x00,0x02,0x10,0x00,0x40,0xA0,0x24,0x10,0x00,0x02,0x10,0x00,0x40,0xA0,0x24,0x10,0x20,0x02,0x10,0x00,0x40,0xA0,0x24,0x10,0x20,0x22,0x10,0x00,0x40,0xA0,0x24,0x10,0x20,0x22,0x14,0x42,0x40,0xA0,0x24,0x10,0x20,0x26,0x14,0x42,0x40,0xA0,0x25,0x10,0x20,0x26,0x14,0x42,0x44,0xA0,0x25,0x10,0x20,0x26,0x14,

23、0x42,0x44,0xA0,0x25,0x50,0x20,0x26,0x14,0x42,0x44,0xA0,0x25,0x50,0xA0,0x26,0x14,0x42,0x44,0xA0,0x25,0x50,0xA0,0x27,0x14,0x43,0x44,0xA0,0x25,0x50,0xA0,0x27,0x14,0x53,0x44,0xA0,0x65,0x50,0xA0,0x27,0x54,0x53,0x44,0xA0,0x65,0x50,0xA0,0xA7,0x54,0x53,0x44,0xA0,0x65,0x50,0xA8,0xA7,0x54,0x53,0x44,0xA0,0x65,

24、0x50,0xA8,0xA7,0x56,0x5B,0x46,0xA0,0x67,0x52,0xA8,0xA7,0x56,0x5B,0x46,0xA1,0x67,0x52,0xA8,0xA7,0x56,0x5B,0x46,0xB1,0x67,0x52,0xA8,0xA7,0x56,0x5B,0x46,0xB1,0x67,0x5A,0xA8,0xA7,0x56,0x5B,0x56,0xB1,0x67,0x5A,0xA8,0xA7,0x56,0x5B,0x56,0xB1,0x67,0x5A,0xA8,0xE7,0x56,0x5B,0x56,0xB1,0x67,0x5A,0xAA,0xE7,0x56,

25、0x5F,0x56,0xB1,0x67,0x5A,0xAA,0xE7,0x56,0x7F,0x56,0xF9,0x67,0x7A,0xAA,0xE7,0x56,0x7F,0x56,0xF9,0x67,0x7A,0xAE,0xE7,0x5E,0x7F,0x5E,0xFD,0x67,0x7B,0xAE,0xE7,0x5E,0x7F,0x5E,0xFD,0x67,0x7B,0xEE,0xE7,0xDE,0xFF,0xDE,0xFD,0xE7,0xFB,0xEF,0xE7,0xFF,0xFF,0xDE,0xFD,0xF7,0xFB,0xFF,0xF7,0xFF,0xFF,0xDE,0xFD,0xFF,

26、0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF; int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<38;j+)for(k=0;k<10;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP3 = tabP0ji;P0=tabP0ji;DELAY_MS(time

27、);void Randomoff(uchar c,uchar time) /随机灭完unsigned char code tabP0238=0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xDF,0xFF,0xFF,0xFF,0xFF,0xDF,0xFF,0xFF,0xDF,0xFF,0xFF,0xFF,0xED,0xDF,0xFF,0xF7,0xDD,0xFF,0xFF,0xFF,0xED,0xDF,0xFF,0xF7,0xDD,0xEF,0xFF,0xDF,0xED,0xDF,0xFF,0xF7,0x5D,0xAF,0xFD,0xDF,

28、0xED,0xDF,0xFF,0xF7,0x5C,0xAF,0xDD,0xDF,0xED,0xDF,0xFF,0xE7,0x5C,0xAF,0xDD,0xDF,0x6D,0xDD,0xFF,0xE7,0x5C,0x2F,0xDD,0xD7,0x6D,0x9D,0xFF,0xE5,0x5C,0x2F,0xDD,0xD7,0x69,0x9D,0xFF,0xA5,0x5C,0x2B,0xDD,0x57,0x69,0x9D,0xFF,0xA5,0x5C,0x29,0xDD,0x57,0x69,0x8D,0xBD,0x85,0x5C,0x29,0xDD,0x57,0x69,0x8D,0xBD,0x85,

29、0x54,0x29,0xDD,0x53,0x48,0x8D,0x9D,0x85,0x54,0x29,0xDD,0x53,0x08,0x8D,0x9D,0x81,0x54,0x09,0xDD,0x13,0x08,0x8D,0x95,0x81,0x54,0x09,0xDD,0x12,0x08,0x85,0x95,0x01,0x54,0x09,0xC9,0x12,0x08,0x85,0x95,0x01,0x54,0x01,0x89,0x12,0x08,0x84,0x95,0x01,0x40,0x01,0x89,0x02,0x08,0x80,0x95,0x00,0x40,0x01,0x88,0x02,

30、0x08,0x00,0x94,0x00,0x00,0x00,0x88,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,;int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<23;j+)for(k=0;k<10;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP0=tabP0ji;D

31、ELAY_MS(time);void Righttoleft(uchar c,uchar time)/右面平移到左面unsigned char code tabP048=0x00,0x00,0x00,0x00,0x0F,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0x00,0x00,0x00,0x00,0x0F,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00;int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P

32、3 = 0XFF;P0 = 0XFF;for(j=0;j<4;j+)for(k=0;k<10;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP0=tabP0ji;P3 = tabP0ji;DELAY_MS(time);void Lefttoright(uchar c,uchar time)/左面平移到右面unsigned char code tabP048=0x0F,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00,0xF0,0xF0

33、,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF0,0xF0,0xF0,0x00,0x00,0x00,0x00,0x0F,0x0F,0x0F,0x0F;int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<4;j+)for(k=0;k<10;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0

34、ji;elseP0=tabP0ji;DELAY_MS(time);void turnD(uchar c,uchar time) /从右面到下面unsigned char code tabP068=0x00,0x00,0x00,0x00,0xF0,0x0F,0x0F,0x0F,0xF0,0x00,0x00,0x00,0x00,0xF0,0x0F,0x0F,0x0F,0xF0,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0x0F,0xF0,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x0F,0xF0,0x00,0x00,0x00,0xFF,0x

35、00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF;int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<6;j+)for(k=0;k<10;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP0=tabP0ji;DELAY_MS(time);void Toptofollowing(uchar c,uchar time)

36、/上面平移到下面unsigned char code tabP048=0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,;int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<4;j+)for(k=0;k<

37、;10;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP0=tabP0ji;DELAY_MS(time);void Followingtotop(uchar c,uchar time) /下面平移到上面unsigned char code tabP048=0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x

38、FF,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,;int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<4;j+)for(k=0;k<10;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP0=tabP0ji;DELAY_MS(time);void Alllight(uchar c,uc

39、har time) /右到左全亮unsigned char code tabP048=0x00,0x00,0x00,0x00,0x0F,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xF0,0xF0,0xF0,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF;int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<4;j+)for(k

40、=0;k<10;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP0=tabP0ji;DELAY_MS(time);void Evel(uchar c,uchar time) / 斜面亮unsigned char code tabP078=0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF7,0x00,0x00,0x00,0xEC,0x00,0x00,0x00,0x73,0x00,0x00,0x00,0x4C,0x00,0x00,0x0

41、0,0x23,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x21,0x00,0x00,0x48,0x48,0x00,0x00,0x21,0x21,0x00,0x48,0x48,0x48,0x00,0x21,0x21,0x21,0x48,0x48,0x48,0x48,0x21,0x21,0x21,0x21,;int j,k,i;if(c=1)P3 = 0X00;else if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<7;j+)for(k=0;k<10;k+)for(i=0;i<8;i+)P0=

42、0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP0=tabP0ji;DELAY_MS(time);void Followtotop(uchar c,uchar time) /上面转移到后面 可以接旋转unsigned char code tabP0108=0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xEE,0x11,0x00,0x00,0xFF,0x00,0x00,0x00,0xEC,0x12,0x01,0x00,0xFF,0x00,0x00,0x00,0xC8,0x24,0x

43、12,0x01,0xEF,0x10,0x00,0x00,0x88,0x48,0x24,0x12,0xCE,0x21,0x10,0x00,0x88,0x88,0x48,0x24,0x8C,0x42,0x21,0x10,0x88,0x88,0x88,0x48,0x88,0x84,0x42,0x21,0x88,0x88,0x88,0x88,0x88,0x88,0x84,0x42,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x84,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88;int j,k,i;if(c=1)P3 = 0X00;else

44、if(c=2)P0 = 0X00;else P3 = 0XFF;P0 = 0XFF;for(j=0;j<15;j+)for(k=0;k<10;k+)for(i=0;i<8;i+)/P0=0;P2=tabP2i;if(c = 1)P0=tabP0ji;else if(c = 2)P3 = tabP0ji;elseP0=tabP0ji;DELAY_MS(time);void Spin(uchar c,uchar time) / 旋转unsigned char code tabP088=0x48,0x48,0x48,0x48,0x21,0x21,0x21,0x21,0x44,0x44,0x44,0x44,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x44,0x44,0x44,0x44,0x21,0x21,0x21,0x21,0x48,0x48,0x48,0x48,0x31,0x31,0x31,0x31,0xC8,0xC8,0xC8,0xC8,0x30,0x30,0x30,0x30,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x30,0x30,0x3

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论