玩具网站建设规划书,网站策划是做什么的,北京造价员变更在哪个网站做,网易企业邮箱是什么意思1#xff0e;设计任务 本设计采用单片机为主控芯片#xff0c;结合外围电路组成彩灯门的控制系统器#xff0c;用来控制16个彩色的LED发光#xff0c;实现彩色亮点的循环移动#xff1b;通过软件编程实现各种各样的彩色亮点平面循环移动#xff0c;该彩色控制器可以通过输…1设计任务 本设计采用单片机为主控芯片结合外围电路组成彩灯门的控制系统器用来控制16个彩色的LED发光实现彩色亮点的循环移动通过软件编程实现各种各样的彩色亮点平面循环移动该彩色控制器可以通过输入按钮、自动模式按钮和手动模式按钮来控制实现LED彩色十种灯光间的效果切换还可以通过按钮暂停彩灯效果使16个彩灯灯处于全亮的状态再次按下相同按钮后继续之前的灯光闪烁效果。其中十种灯光效果分别是顺时针流水灯、逆时针流水灯、交替闪烁、顺时针对角灯、逆时针对角灯、顺时针逐个点亮、顺时针逐个熄灭、逆时针逐个点亮、逆时针逐个熄灭、二进制加法。 2. 设计要求
2.1系统方案论证
根据设计任务分析设计系统的组成给出实现设计任务的几种方案分析比较几种设计方案的优略本着尽量以软件代替硬件同时力求电路简单工作可靠的原则确定总体设计方案。
2.2系统硬件电路设计
根据系统设计方案进行软、硬件的分配软、硬件设计分别进行。硬件设计包括单片机最小系统和扩展接口及配置硬件结构在设计时要选择合适的元器件硬件电路要简洁、工作可靠需用Proteus绘制整个系统的电路仿真原理图。
2.3软件设计
根据该系统要求的功能进行软件设计简述软件的功能并根据每个模块的功能绘制软件流程图根据流程图编写程序并汇编调试通过列出软件清单软件清单要求加以注释。
2.4 软硬件系统仿真
将编译后的程序软件加载到Proteus软件仿真的单片机ROM中运行系统实现软件程序对单片机系统的硬件电路的控制并调试仿真结果直至与设计任务相符。 /*******************?????********************/
#include reg51.h
#define false 0
#define true 1
#define uchar unsigned char
#define uint unsigned int
sbit pause_key P3^0;//????
sbit auto_key P3^1;//????????
sbit change_key P3^2; //????????int ledCode[8]{0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//led??(????)
int ledCode2[8]{0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};// led??(?????)
int disCode[10]{0x03,0x9f,0x25,0x0d,0x99,0x49,0x41,0x1f,0x01,0x09};//?????0-9
void displayLed(void);//??Led????
void keyScan(void);//????????
void Delay10ms(unsigned int n);//??10ms
bit isPause false;//????
bit isAuto true;//??????
bit isChange false;//??????????
uchar time;//???0.5s
uchar types;//?????????
uint counts;//??????
void T0_INT(void) interrupt 1
{TL0(65536-50000)/256;TH0(65536-50000)%256;time;if(time 10)//????:0.5s{time0;if(isChange true)//????????????{counts 0;types;//?????????if(types 9)types 0;P0 disCode[types]; isChange false;}displayLed();counts;
}}
void main(void)
{TMOD0x61;//0110 0001 //???TL0(65536-50000)/256;//50msTH0(65536-50000)%256;TR01; //??T0ET01; //T0????EA1; //?????time 0; //???????(0.5s)counts 0; //??????types 0; //???????pauseLed 0; //??????P0disCode[types];while(1){keyScan(); //???????}
}
void keyScan(void)
{if(pause_key 0) //???????{Delay10ms(1);if(pause_key 0){isPause ~isPause;pauseLed isPause;if(isPause true){ET0 0; //??T0??P0 0xfd; P1 0x00; //????????P2 0x00;}else{ET0 1; //T0????P0 disCode[types];displayLed();}while(pause_key 0); //????????}}if(auto_key 0) //???????????{Delay10ms(1);if(auto_key 0){isAuto ~isAuto;autoLed isAuto;}while(auto_key 0); //????????}if(change_key 0 isAuto false) //????,????????{Delay10ms(1);if(change_key 0){isChange true;}while(change_key 0); //????????}
}
void displayLed(void)
{switch(types){case 0: //?????led?{if(counts 16)counts 0;if(counts 15){if(isAuto true)isChange true;}if(counts 8){P1 0xff;P2 ledCode[7-counts];}else{P1 ledCode[15-counts];P2 0xff;}break;}case 1: //?????led?{if(counts 16)counts 0;if(counts 15){if(isAuto true)isChange true;}if(counts 8){P1 ledCode[counts];P2 0xff;}else{P1 0xff;P2 ledCode[counts-8];}case 2: //????{if(counts 16)counts 0;if(counts 15){if(isAuto true)isChange true;}if(counts %2 0) //??{P1 0xaa;P2 0xaa;}else{P1 0x55;P2 0x55;}break;}case 3: //?????{if(counts 8)counts 0;if(counts 7){if(isAuto true)isChange true;}P1 ledCode[7- counts];P2 ledCode[7- counts];break;}case 4: //?????{if(counts 8)counts 0;if(counts 7){if(isAuto true)isChange true;}P1 ledCode[counts];P2 ledCode[counts];break;}case 5: //???????{if(counts 17)counts 0;if(counts 8){P1 ~ledCode2[7- counts];P2 0xff;}else if(counts 16){P1 0x00;P2 ~ledCode2[15-counts];}else //??{P1 0x00;P2 0x00;if(isAuto true)isChange true;}break;}case 6: //????????{if(counts 17)counts 0;if(counts 8){P1 ledCode2[7- counts];P2 0x00;}else if(counts 16){P1 0xff;P2 ledCode2[15-counts];}else //??{P1 0xff;P2 0xff;if(isAuto true)isChange true;}break;}case 7: //???????{if(counts 17)counts 0;if(counts 8){P1 0xff;P2 ledCode2[counts];}else if(counts 16){P1 ledCode2[counts -7];P2 0x00;}else //??{P1 0x00;P2 0x00;if(isAuto true)isChange true;}break;}case 8: //???????{if(counts 17)counts 0;if(counts 8){P1 0x00;P2 ~ledCode2[counts];}else if(counts 16){P1 ~ledCode2[counts -7];P2 0xff;}else //??{P1 0xff;P2 0xff;if(isAuto true)isChange true;}break;}case 9: //?????{if(counts 255)counts 0;if(counts 254 isAuto true)isChange true;P1 ~counts;P2 ~counts;break;}default:types 0;P0 disCode[types];}
}}void Delay10ms(unsigned int n){unsigned int a,b;for(;n0;n--){for(b38;b0;b--){for(a130;a0;a--);}}}
完整代码点开链接私信 免费 获取。
【iBot机器人工作室的个人空间-哔哩哔哩】 https://b23.tv/ryUWVKa