《单片机原理及应用课程设计_抢答器控制模拟程序设计.docx》由会员分享,可在线阅读,更多相关《单片机原理及应用课程设计_抢答器控制模拟程序设计.docx(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Gay is now a provincial key construction project of aluminum Ltd-province with an annual output of 50,000 tons of technical innovation project of environmental protection and energy saving of electrolytic aluminum project manager. In this technological transformation projects, he has overall respons
2、ibility for the day-to-day affairs of the project. In order to ensure that southern companys control the scale of investment, strengthen field management, pay special attention to project progress, and ensure a successful operation, the overall goal. He and Engineering Department under the leadershi
3、p of all the staff in the companys technical command, on the difficulties and to overcome technical difficulties in the process, work hard, have made outstanding achievements, mainly reflected in the following aspects: first, careful organization and management achieved remarkable results. Technical
4、 innovation project of the year, started and completed a series of bids and completed to date, from production engineering to put into production after nearly a year, has achieved very significant results. A project first 56 slots from dismantling the old slot just 168 days, civil engineering, insta
5、llation, commissioning, guarantee engineering quality under the premise, on the production side transformation under difficult conditions, created the national industrys fastest speeds. II 32 large prebaked electrolytic cell on November 7 has been installed, marks has an annual production capacity o
6、f 50,000 tons of electrolytic aluminum production capacity of aluminum. Entire project almost 8 months earlier than planned, achieved the goal of production transformation benefits that year, created favorable conditions for aluminum through South. Second, effectively control the investment. Project
7、 is subject to a scientific approach to bidding, bidding to make savings of 20 million Yuan, in the implementation process of the project, every domestic prices of steel, cement and other building materials, the old buildings on the base encountered great difficulties in dealing with significant inc
8、rease in the volume of civil engineering, but through rationalization and optimization, project control in fixed investment of 350 million Yuan. Third, environmental energy-saving effect of the project. Project investment of nearly 30 million Yuan, using large prebake technology and aluminum oxide d
9、ense phase and hyper dense phase conveying technology, fluoride and other harmful gases purification efficiency of up to 98%. Compared with Soderberg cell before the modification, power consumption can be reduced by 1500 tons of electrolytic aluminum, and project environmental protection and energy
10、saving effect is obvious. Four are in a relatively short period of time to the normal production. After four months of efforts, a project has put into operation all the 54 240KA large cell into regular production, stable current channel conditions and all the economic indicators are good, current ef
11、ficiency in October had reached 93%, is close to and reach the domestic advanced level. In the case of production half of the cell, this effect can be achieved and better level in the industry. 50,000 tons of electrolytic modification process, from preliminary study to equipment selection, cost cont
12、rol, project progress, quality control and coordination among the various sub-projects and various professional, technical command under the correct leadership, both from an overall perspective, emphasis on integrity, and earnestly implement the relevant laws and regulations, strictly act according
13、to the contract. He tried to learn relevant knowledge, good style of business, operational and organizational coordination ability, project efficiency, quality and safety assurance system in place, with all units involved with the coordination and good . 计算机与通信工程学院单片机原理及应用实训总结报告设计题目:抢答器控制模拟程序设计 学生姓名
14、:系 别:计算机与通信工程学院专 业:信息工程班 级:09-1学 号:指导教师:陈晓雷 副教授2011年12月23日郑州轻工业学院实 训 任 务 书题目:抢答器控制模拟程序设计专业、班级 信息工程09-1 学号 姓名主要内容、基本要求、主要参考资料等:基本要求:具有8个抢答输入显示抢答剩余时间(初始10秒)显示抢答成功者扩展要求:抢答成功后有声音提示时间分辨率小于10ms完善其他自定义功能设计方案简述:1. 定时抢答器的总体框图如下图所示,它由主体电路和扩展电路两部分组成。主体电路完成基本的抢答功能,即开始抢答后,当选手按动抢答键时,能显示选手的编号,同时能封锁输入电路,禁止其他选手抢答,扩展
15、电路完成定时抢答的功能。2. 定时抢答器的工作过程是:接通电源时,节目主持人将开关置于“消除”位置,抢答器处于禁止工作状态,编号显示器灭灯,定时器倒计时,当定时时间到,却没有选手抢答时,系统报警,并封锁输入电路,禁止选手超时后抢答。当选手在定时时间内按动抢答键时,抢答器要完成以下四项工作:优先编码电路立即分辨出抢答者的编号,并由锁存器进行锁存,然后由译码显示电路显示编号;扬声器发出短暂的声响,提醒节目主持人注意;控制电路要对输入编码电路进行封锁,避免其他选手再次进行抢答;控制电路要使定时器停止工作,时间显示器上显示剩余的抢答时间,并保持到主持人将系统消零为止,当选手将问题回答完毕,主持人操作控
16、制开关,使系统回复到禁止工作状态,以便进行下一轮抢答。 3主程序流程图主程序设置抢答时间和回答问题时间定时器及并行口初始化将时间计数器及启动标志值1开中断采并行口数据为0吗?启动标志=1吗?判断抢答组号将抢答组发光二极管点亮判断哪一组为抢答组将抢答组号送显示抢答时间到了吗?输出响铃信号提示超时继续抢答比赛吗?系统返回NYYYNYN主程序流程图抢答器电路设计:抢答电路的功能有两个:一是分辨选手按键的先后,并锁存抢答者的编号,供译码显示电路用;二是是其他选手的按键操作无效。选用优先编码器74LS148和RS锁存器,74LS138,74LS279可完成上述功能。译码电路选用74LS48芯片工作原理为
17、:当主持人控制开关处于“清除”位置时,RS触发器R为低电平,输出端(4Q1Q)全部为低电平。于是74LS48的BI=0,显示器灭灯;74LS148的选通输入ST=0,74LS148处于工作状态,此时锁存器电路不工作。当主持人开关拨到开“始位”置,优先编码电路和锁存电路同时开始工作,等待输入信号I7,I0。当有选手按下键时,74LS148的输出Y2Y1Y0=010,Yex=0。经RS锁存器后,CTR=1,BI=1,74LS279处于工作状态,4Q3Q2Q=101。经过74LS48译码后,显示器显示选手编号。此外,CTR=1,是74LS148的ST为高电平,74LS148处于禁止工作状态,封锁了其
18、他选手按键的输入。当按下的键松开后,74LS148的Yes为高电平,但由于CTR维持高电平不变,所以74LS148仍处于禁止工作状态,其他选手的输入不会被接收,保证了抢答者的优先性以及抢答电路的准确性。抢答完后主持人使抢答电路复位,以便进行下一轮抢答。整体电路仿真图:程序代码:#include #define uint unsigned int #define uchar unsigned char /*- 共阴极数码管编码表 0 - f显示 -*/ uchar code table=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x7f,
19、0x7c,0x39,0x5e,0x79,0x71; sbit start= P36; sbit stop=P35; sbit reset = P37; sbit key1 = P10; /8个抢答按键sbit key2 = P11; sbit key3 = P12; sbit key4 = P13; sbit key5 = P14; sbit key6 = P15; sbit key7 = P16; sbit key8 = P17; sbit buzzer = P34; bit start_flag = 0; bit stop_flag=0; bit key1_flag = 0; /按键抢答标
20、志位,防止重复抢答bit key2_flag = 0; bit key3_flag = 0; bit key4_flag = 0; bit key5_flag = 0; bit key6_flag = 0; bit key7_flag = 0; bit key8_flag = 0; bit reset_flag = 0; /复位键标志位,防止重复按下bit action = 0; /开始键标志位,防止重复按下 uchar second = 10; /10秒倒计时uchar timer0_count = 0; /定时器计数uchar number = 0; /抢答到的人 uchar number
21、_display = 0; /*- 延时函数 延时z毫秒 -*/ void delay(uint z) uint x,y; for(x=z;x0;x-) for(y=110;y0;y-); void fengming() /蜂鸣函数 /延时1ms buzzer = 1; /给P3.7口送高电平 delay(5); /延时1ms buzzer = 0; delay(5); /*- 数码管显示驱动函数 -*/ void display(uchar number,uchar second) uchar second_first,second_second; second_first = second
22、 / 10; /计算出个位second_second = second % 10; /计算出十位P2 = 0xfe; P0 = tablenumber; delay(2); /P2 = 0xfd; / P0 = 0x3f; / delay(2); P2 = 0xfb; P0 = tablesecond_first; delay(2); P2 = 0xf7; P0 = tablesecond_second; delay(2); /*- 开始键扫描函数 -*/ void start_keyscan() if(start = 0) delay(8); /延时防抖 if(start = 0)&(!st
23、art_flag) start_flag = 1; action = 1; TR0 = 1; else start_flag = 0; /*- 八位抢答键扫描函数 -*/ char key_scan8() if(key1 = 0) delay(8); if(key1 = 0)&(!key1_flag) /防止按键重复被按下 key1_flag = 1; number = 1; number_display = number; fengming(); else key1_flag = 0; number = 0; if(key2 = 0) delay(8); if(key2 = 0)&(!key
24、2_flag) key2_flag = 1; number = 2; number_display = number; fengming(); else key2_flag = 0; number = 0; if(key3 = 0) delay(8); if(key3 = 0)&(!key3_flag) key3_flag = 1; number = 3; number_display = number; fengming(); else key3_flag = 0; number = 0; if(key4 = 0) delay(8); if(key4 = 0)&(!key4_flag) ke
25、y4_flag = 1; number = 4; number_display = number; fengming(); else key4_flag = 0; number = 0; if(key5 = 0) delay(8); if(key5 = 0)&(!key5_flag) key5_flag = 1; number = 5; number_display = number; fengming(); else key5_flag = 0; number = 0; if(key6 = 0) delay(8); if(key6 = 0)&(!key6_flag) key6_flag =
26、1; number = 6; number_display = number;fengming(); else key6_flag = 0; number = 0; if(key7 = 0) delay(8); if(key7 = 0)&(!key7_flag) key7_flag = 1; number = 7; number_display = number;fengming(); else key7_flag = 0; number = 0; if(key8 = 0) delay(8); if(key8 = 0)&(!key8_flag) key8_flag = 1; number =
27、8; number_display = number;fengming(); else key8_flag = 0; number = 0; if(number_display != 0) return 1; else return 0; /*- 复位键扫描函数 -*/ void reset_keyscan() if(reset = 0) delay(8); if(reset = 0)&(!reset_flag) reset_flag = 1; number_display = 0; second=10; else reset_flag = 0; /*- 主函数 -*/ void main()
28、 TMOD=0x01; /设置为定时器0工作方式1 TH0=(65536-50000)/256; TL0=(65536-50000)%256; EA=1; ET0=1; TR0=0; buzzer = 0; while(1) start_keyscan(); reset_keyscan(); while(action=1) if(second0) fengming(); while(!key_scan8()&!stop=0) display(number_display,second); if(second = 0) second = 10; break; TR0 = 0; display(n
29、umber_display,second); action = 0; break; display(number_display,second); /*- 中断服务函数 -*/ void timer0() interrupt 1 TH0=(65536-50000)/256; TL0=(65536-50000)%256; timer0_count +; if(timer0_count = 20) timer0_count = 0; second -; if(second0) fengming() ; if(second = 0) TR0 = 0; number_display = 0; acti
30、on = 0; 设计体会:通过这次课程设计,我想说:为完成这次课程设计我们确实很辛苦,但苦中仍有乐,和同学们相互帮助,大学里三年的相处还赶不上这几天来的实在,我感觉我和同学们之间的距离更加近了。这个工程确实很累, LED亮了起来,喇叭响起的是我一生以来最好听的声音,我们的心中就不免兴奋,不免激动。前面的种种艰辛这时就变成了最甜美的回忆!这次学习给我留下了深刻的印象,使我受益匪浅。而且对于论文的总体构思也有了很多经验,相信自己经过这一次的训练与学习,对于今后会更加努力,做得最好。总之,通过这次课程设计的制作与写作让我懂得了很多,这次课程设计由我们的老师的指导然后我们自己去图书馆,上网查资料然后自
31、己和我们这组的成员一起合作商讨完成的,原以为会很简单的,但无论在制作与写作过程中我们都遇到了理论课上所不曾遇到的问题,第一是综合性太强,这次制作不仅涉及到我们所学到的单片机,数字电子技术等课程的知识还涉及到很多我们的选修及课外的知识。第二是理论联系实际性太强,把所学的搜集到得知识运用的实际中不是一件容易的事,不仅由元件从课本上的符号到实物的认识还是理论的测量结果与实际值的误差。课程设计已结束,对我而言,知识上的收获重要,精神上的丰收更加可喜。让我知道了学无止境的道理。我们每一个人永远不能满足于现有的成就,人生就像在爬山,一座山峰的后面还有更高的山峰在等着你。挫折是一份财富,经历是一份拥有。这次
32、课程设计必将成为我人生旅途上一个非常美好的回忆。参考资料:单片机实验与课程设计(proteus仿真版)浙江大学出版社(第一版)完 成 期 限: 2011-12-26 指导教师签名: 陈晓雷 课程负责人签名: 2011年 12 月25 日Four outstanding works. They are derived from their own inner feelings. I also sent a student to attend the class Department speech contest, failed to get a good result, but also act
33、ively cooperate with the Department and class activities! in order to create a demonstration dorm room, our weekly class to every bedroom check, where proposed is insufficient. In order to clean up the bedroom, we use the brush brushes a bedroom again. For the class out of a force. In the event we,
34、many projects did not get the desired results. But we understand that we tried, and in the struggle. Also has made good progress in many of the! in my class the work carried out and the results achieved, thanks to the concern and support of the Department, thanks to instructor teachers good, proper
35、guidance, thanks to 46 students in the class will work closely together, to work together. Of course, we also have our weaknesses, needs to be further correction in their future learning and life, with a view to achieving greater results. Five declarations of good party branch branch is a fortress,
36、a party member is a banner. Fighting in the railway engineering construction Group Headquarters Headquarters branches, a total of members 18. Role of the Xiang-GUI railway and tight South Lebanon railway, heavy, poor conditions of disadvantage, the branch closely around the construction work. Holdin
37、g high the flag of our party members, unite and lead staff on the difficulties, overcome difficulties, take the zhengyou, a job well done and an engineering task, won the highly valued by leaders at all levels. Since October last year since the project began, Headquarters Branch is tightly around th
38、e center of its activities. Face South, climate is wet, sooner or later temperature larger, specific difficult, I branch from thought requirements all workers active motivated, do can long-term hard, dare fight of spirit prepared, while requirements all members lead, encouraged colleagues Zhijian ea
39、ch other help, each other learning business knowledge, overcome temporarily difficult, active into to engineering official starts of the prepared work in the to, play out has as a branch of fighting fortress role and members of pioneer model role. Since its start, I command under the correct leadership of the party branch in the Group and the superior party, centering on building a qualified party branches, branch of the forts and the