毕业设计基于AT89C51单片机的篮电子球记分牌设计.doc
单片机课程设计报告册设 计 题 目: 篮球赛电子记分牌 专 业:指 导 教 师:姓 名:学 号:2012年12月摘 要随着单片机在各个领域的广泛应用,许多用单片机作控制的计时记分系统也应运而生,如用单片机控制LCD液晶显示的计时记分器,用单片机控制LED七段显示的计时记分器等。篮球赛电子记分牌是根据篮球比赛特点设计的独立的信息采集、分配、评判和显示的系统,能实现比赛分数的实时、准确、快捷处理和呈现。本设计原理简单,主要采用AT89C51单片机作为微控制器,集合数码管和LED指示灯,通过键盘控制记分牌的工作状态,通过数码管和LED指示灯来反馈信息的篮球赛记分系统,并仿真实现。本设计在充分考虑了篮球比赛的实际情况基础上设计,该系统的数据显示由两个四位数码来实现,能显示甲乙两队的比分情况,具有加分、减分、甲乙切换等功能。此外,该系统具有低功耗、可靠性、安全性以及低成本等特点,可广泛用于学校和小团体作为赛程记分。具有一定的实用性。关键词:单片机,AT89C51,LED数码管,仿真,篮球记分牌目 录第一章 设计任务与要求11.1 设计的目的和意义11.2 设计任务与要求1第二章 总体设计方案22.1 显示模块22.2 按键控制模块22.3 指示模块22.4 总体硬件组成框图2第三章 硬件系统33.1 数码管显示模块33.2 按键控制模块43.3 LED指示灯模块53.4 单片机最小系统6第四章 软件系统74.1 主程序设计74.2 指示灯设计9第五章 系统调试与测试105.1 系统调试105.2 测试结果11结 论12参考文献13附录一 程序清单14附录二 仿真全图17附录三 元件清单18第一章 设计任务与要求1.1 设计的目的和意义目前球场记分牌在传统操作模式下,采用记分员手动翻动记分牌记分,工作方式单一。由于种种弊端,电子记分板已经开始在一些大型的体育场流行起来,不仅发展速度迅猛并会逐渐取代传统的电子记分牌。电子记分板根据篮球比赛的特点,采用单片机为核心控制LED数码管,具有亮度高、可视性好、功耗小、使用寿命长等优点;具有性能稳定,尺寸适中,运输安装方式灵活,物美价廉等特点,特别适用于小型篮球体育馆和露天运动场。1.2 设计任务与要求l 设计题目:篮球赛电子记分牌 l 设计要求: (1)分别设计篮球比赛甲乙两个队的记分牌;(2)能实现两张记分牌的切换;(3)能按照篮球赛记分规则记分并显示;(4)将原有的一个指示灯基础上进一步改进为两个指示灯,作分别指示。第二章 总体设计方案本系统采用单片机AT89C51为控制核心,系统主要包括显示模块、按键控制模块、指示模块等。 2.1 显示模块 采用七段码数码管显示。数码管是指将所有发光二极管的一极接到一起形成公共极,因此数码管有共阴共阳之分。以共阳数码管为例,共阳数码管在应用时应将公共极接到+5V,当某一字段发光二极管的阴极为低电平时,相应字段就点亮。当某一字段的阴极为高电平时,相应字段就不亮。因此每个数码管有8个接口。根据其实际应用进行选择。 2.2 按键控制模块采用独立按键。每个独立按键与单片机I/O连接,虽然不能节省I/O口,但电路简单、编程容易,由于本系统只需要五个按键,因此选者独立按键。2.3 指示模块 采用指示灯,在切换记分牌时起指示作用,能够看得清楚明白。按键控制模块AT89C51数码管显示模块LED指示2.4 总体硬件组成框图图2-1第三章 硬件系统为使该电子记分牌更加方便和灵活,本设计将其划分为三个模块,下面将对各个模块逐一介绍。3.1 数码管显示模块数码管也叫LED数码管,它是一种专门用来显示数字的器件,led数码管(LED Segment Displays)是由多个发光二极管封装在一起组成“8”字型的器件,引线已在内部连接完成,只需引出它们的各个笔划,公共电极。led数码管常用段数一般为7段有的另加一个小数点,还有一种是类似于3位“+1”型。位数有半位,1,2,3,4,5,6,8,10位等等.,led数码管根据LED的接法不同分为共阴和共阳两类,了解LED的这些特性,对编程是很重要的,因为不同类型的数码管,除了它们的硬件电路有差异外,编程方法也是不同的。图3-1数码管显示模块电路3.2 按键控制模块按键控制模块采用4个独立按键,Ke1、K2、K3、K4、K5分别于单片机的P10、P11、P12、P13、P17连接,每个按键的另一端直接与地相连接,因此是低电平有效。按键控制模块的电路如图3-2所示。这四个独立按键分别实现了比赛两只队伍的得分值的改变。具体标号和功能如表3-1所示。 表3-1 按键功能描述序号接口功能K1P10加1分K2P11加2分K3P12加3分K4P13减1分K5P17甲乙互换图3-2按键控制模块电路图3.3 LED指示灯模块LED指示灯模块由两条电路R1与D1、R2与D2组成,分别接入单片机的P30、P31口,低电平有效。LED指示灯模块如图3-3所示。图3-3LED指示灯模块电路图3.4 单片机最小系统 AT89C51是一种带4K字节FLASH存储器(FPEROMFlash Programmable and Erasable Read Only Memory)的低电压、高性能CMOS 8位微处理器,俗称单片机。AT89C2051是一种带2K字节闪存可编程可擦除只读存储器的单片机。单片机的可擦除只读存储器可以反复擦除1000次。该器件采用ATMEL高密度非易失存储器制造技术制造,与工业标准的MCS-51指令集和输出管脚相兼容。图3-4最小系统模块电路图由于将多功能8位CPU和闪烁存储器组合在单个芯片中,ATMEL的AT89C51是一种高效微控制器。最小系统模块的晶振电路由12MHz晶振和30pF的电容构成,复位电路由10uF的电解电容构成。电路如图3-4所示。第四章 软件系统在本设计中,系统的软件设计也采用了模块化的设计,将系统的各部分功能编写成子模块的形式。4.1 主程序设计本系统中单片机的主要功能就是利用内部的定时器计时,并随时接受按键控制模块的信息,将比赛的得分显示LED数码管上。K1、K2、K3键配合程序所设定的端口控制比赛的加分,开始时,当K1按下,甲队加一分;当K2按下,加两分;当K3按下,加三分;K4键配合程序所设定的端口控制比赛的减分,K4按下,减一分。程序流程如图4-1所示。开始初始化选甲?队?YesK1按键是否按下?noK2按键是否按下?将甲乙队分数显K3按键是否按下?no结束K4按键是否按下?no甲加1分YesYes甲加2分Yes甲加3分甲减1分K1按键是否按下?K2按键是否下?K3按键是否按下?K4按键是否按下?nonono乙加1分YesYes乙加2分Yes乙加3分乙减1分nonoYesYes图4-1主程序流程图4.2 指示灯设计开始运行时,黄灯亮,表示选中了甲队记分牌,当K5按下,绿灯亮,表示选中了乙队记分牌。程序流程如图4-2所示。YesNo开始清零D1亮选中甲队K5是否按下?D2亮选中乙队显示结束图4-2指示灯设计流程图 第五章 系统调试与测试5.1 系统调试 软件调试采用Keil软件完成。在打开后,建新工程,选择AT89C51处理器,接着新建文档编辑程序,编辑完存为.ASM,把保存的.ASM文件加入到工程里。检查无语法错误后生成.HEX文件。程序清单查看附录一。打开仿真软件ISIS,找到与系统相关的元器件,将各个元器件的引脚连接,保存到程序所在文件夹,将程序加载到AT89C51单片机上,开始运行仿真。(1)出现了以下问题,如图5-1所示。图5-1(2)发现问题,如图5-2所示。图5-2(3)解决问题后,如图5-3所示。图5-35.2 测试结果 本次系统设计结构较好,单片机最小系统能正常工作,经过调试发现问题并将问题解决后,按键模块能实现控制功能,LED数码管显示模块能根据按键模块输入的控制信息进行显示,指示灯模块能按按键模块输入控制信息和程序设定的要求显示。仿真结果全图如附录二所示。 结 论本次基于单片机的篮球比赛电子记分牌是针对传统篮球比赛人工翻动比分牌的改进,解决篮球比赛时计分与计时准确方便和灵活适用的问题。系统总体电路由单片机最小系统、LED数码管显示模块、5个独立按键控制模块LED指示灯模块构成。四个模块分别完成信息的处理、显示、控制等篮球比赛记分牌的基本功能。通过软件的仿真调试,实现了本次设计的基本功能,左边的数码管显示甲队比赛的得分,右边数码管显示乙队比赛的得分。五个按键能完成程序的要求对比分的调整进行控制,指示灯在记分牌切换时发生变化,给予球员和观众指示。虽然调试成功,但是该记分牌功能过于单一,只能够记分,不能满足现代人们的需求,有待改进。为了使一个系统能够具备多种功能,以后可以将其进一步改进,根据篮球比赛的特点,让这个系统能够记分,也可以计时,蜂鸣器在规定的时间段鸣叫,给球员和观众提示。参考文献1.单片机原理与应用技术/江力主编;蔡骏,王艳春,董泽芳副主编.北京:清华大学出版社,2006(2007重印)2.单片机课程设计指导/楼然苗,李光飞编著./-2版-北京:北京航空航天大学出版社,2012.1附录一 程序清单 ORG 0000H LJMP MAIN ORG 0030H;*;P0口接数码管的段选(低电平有效);P2.0-P2.3接数码管的位选(高电平有效);*MAIN: MOV P2,#0FFH MOV P0,#0C0H MOV R2,#00 MOV R1,#00 CLR P3.0;* ;键盘扫描程序;*;=判断甲乙间的转换=CHENGXU: JB P1.7,JIAYIDUI JNB P1.7,$ CPL P3.0 CPL P3.1JIAYIDUI:JB P3.0,YIDUILJMP JIADUIJB P3.1,JIADUI LJMP YIDUI;* ;甲 乙队加减分判断;*;=甲队加1分程序=JIADUI: JB P1.0,LOOP1 JNB P1.0,$ LJMP JIA1;=甲队加2分程序=LOOP1: JB P1.1,LOOP2 JNB P1.1,$ LJMP JIA2;=甲队加3分程序=LOOP2: JB P1.2,LOOP3 JNB P1.2,$ INC R2 JIA2:INC R2JIA1:INC R2 CJNE R2,#200,LP3 LJMP MAINLP3: CJNE R2,#201,LP4 LJMP MAINLP4: CJNE R2,#202,LOOP3 LJMP MAIN;=甲队减1分程序=LOOP3: JB P1.3,XIANSHI JNB P1.3,$ DEC R2 CJNE R2,#0FFH,XIANSHI LJMP MAIN;=乙队加1分程序=YIDUI: JB P1.0,LOOP4 JNB P1.0,$ LJMP JIA3;=乙队加2分程序=LOOP4: JB P1.1,LOOP5 JNB P1.1,$ LJMP JIA4;=乙队加3分程序=LOOP5: JB P1.2,LOOP6 JNB P1.2,$ INC R1 JIA4:INC R1JIA3:INC R1 CJNE R1,#200,LP5 LJMP MAINLP5: CJNE R1,#201,LP6 LJMP MAINLP6: CJNE R1,#202,LOOP6 LJMP MAIN;=乙队减1分程序=LOOP6: JB P1.3,XIANSHI JNB P1.3,$ DEC R1 CJNE R2,#0FFH,XIANSHI LJMP MAIN;* ;显示程序;*;=甲队显示扫描=XIANSHI: MOV A,R2 MOV B,#100 DIV AB LCALL CHABIAO MOV P2,#02H MOV P0,A LCALL DELAY MOV P2,#00H MOV A,B MOV B,#10 DIV AB LCALL CHABIAO MOV P2,#04H MOV P0,A LCALL DELAY MOV P2,#00H MOV A,B LCALL CHABIAO MOV P2,#08H MOV P0,A LCALL DELAY MOV P2,#00H;=乙队显示扫描= MOV A,R1 MOV B,#100 DIV AB LCALL CHABIAO MOV P2,#20H MOV P0,A LCALL DELAY MOV P2,#00H MOV A,B MOV B,#10 DIV AB LCALL CHABIAO MOV P2,#40H MOV P0,A LCALL DELAY MOV P2,#00H MOV A,B LCALL CHABIAO MOV P2,#80H MOV P0,A LCALL DELAY MOV P2,#00H LJMP CHENGXU;跳转到甲乙切换;*;延时20ms子程序;*DELAY: MOV R5,#10LOOP: MOV R6,#0FFH DJNZ R6,$ DJNZ R5,LOOP RET;*;查表指令;*CHABIAO: MOV DPTR,#0200H MOVC A,A+DPTR RET;*;0-9共阳数码管显示表;* ORG 0200H DB 0C0H,0F9H,0A4H,0B0H,99H DB 92H,82H,0F8H,80H,90H END;*;结束程序;*附录二 仿真全图附录三 元件清单序号名称位号型号规格数量1电阻R1/R21002只2电阻R310K1只3瓷片电容C1/C230uF2只4电解电容C310uf1只5发光二极管(黄/绿)D1/D22只6NPN三极管Q1/Q2/Q3/Q4/Q5/Q6/Q7/Q890148只7四位数码管(红/蓝)共阳2只8单片机U1AT89C511只9晶振X112MHZ1只10单片机座子1只11轻触开关K1/K2/K3/K4/K5/电源开关四脚6只12导线0.5mm若干13万用板34*541块Employment tribunals sort out disagreements between employers and employees.You may need to make a claim to an employment tribunal if:· you don't agree with the disciplinary action your employer has taken against you· your employer dismisses you and you think that you have been dismissed unfairly.For more information about dismissal and unfair dismissal, see Dismissal.You can make a claim to an employment tribunal, even if you haven't appealed against the disciplinary action your employer has taken against you. However, if you win your case, the tribunal may reduce any compensation awarded to you as a result of your failure to appeal.Remember that in most cases you must make an application to an employment tribunal within three months of the date when the event you are complaining about happened. If your application is received after this time limit, the tribunal will not usually accept i.If you are worried about how the time limits apply to you, take advice from one of the organisations listed under Further help.Employment tribunals are less formal than some other courts, but it is still a legal process and you will need to give evidence under an oath or affirmation.Most people find making a claim to an employment tribunal challenging. If you are thinking about making a claim to an employment tribunal, you should get help straight away from one of the organisations listed under Further help.If you are being represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their fee out of your compensation if you win the case. This is known as a damages-based agreement. In England and Wales, your solicitor can't charge you more than 35% of your compensation if you win the case.If you are thinking about signing up for a damages-based agreement, you should make sure you're clear about the terms of the agreement. It might be best to get advice from an experienced adviser, for example, at a Citizens Advice Bureau. To find your nearest CAB, including those that give advice by e-mail, click on nearest CAB.For more information about making a claim to an employment tribunal, see Employment tribunals.The (lack of) air up there Watch mCayman Islands-based Webb, the head of Fifa's anti-racism taskforce, is in London for the Football Association's 150th anniversary celebrations and will attend City's Premier League match at Chelsea on Sunday."I am going to be at the match tomorrow and I have asked to meet Yaya Toure," he told BBC Sport."For me it's about how he felt and I would like to speak to him first to find out what his experience was."Uefa has opened disciplinary proceedings against CSKA for the "racist behaviour of their fans" during City's 2-1 win.Michel Platini, president of European football's governing body, has also ordered an immediate investigation into the referee's actions.CSKA said they were "surprised and disappointed" by Toure's complaint. In a statement the Russian side added: "We found no racist insults from fans of CSKA."Age has reached the end of the beginning of a word. May be guilty in his seems to passing a lot of different life became the appearance of the same day; May be back in the past, to oneself the paranoid weird belief disillusionment, these days, my mind has been very messy, in my mind constantly. Always feel oneself should go to do something, or write something. Twenty years of life trajectory deeply shallow, suddenly feel something, do it.一字开头的年龄已经到了尾声。或许是愧疚于自己似乎把转瞬即逝的很多个不同的日子过成了同一天的样子;或许是追溯过去,对自己那些近乎偏执的怪异信念的醒悟,这些天以来,思绪一直很凌乱,在脑海中不断纠缠。总觉得自己自己似乎应该去做点什么,或者写点什么。二十年的人生轨迹深深浅浅,突然就感觉到有些事情,非做不可了。The end of our life, and can meet many things really do?而穷尽我们的一生,又能遇到多少事情是真正地非做不可?During my childhood, think lucky money and new clothes are necessary for New Year, but as the advance of the age, will be more and more found that those things are optional; Junior high school, thought to have a crush on just means that the real growth, but over the past three years later, his writing of alumni in peace, suddenly found that isn't really grow up, it seems is not so important; Then in high school, think don't want to give vent to out your inner voice can be in the high school children of the feelings in a period, but was eventually infarction when graduation party in the throat, later again stood on the pitch he has sweat profusely, looked at his thrown a basketball hoops, suddenly found himself has already can't remember his appearance.童年时,觉得压岁钱和新衣服是过年必备,但是随着年龄的推进,会越来越发现,那些东西根本就可有可无;初中时,以为要有一场暗恋才意味着真正的成长,但三年过去后,自己心平气和的写同学录的时候,突然就发现是不是真正的成长了,好像并没有那么重要了;然后到了高中,觉得非要吐露出自己的心声才能为高中生涯里的懵懂情愫划上一个句点,但毕业晚会的时候最终还是被梗塞在了咽喉,后来再次站在他曾经挥汗如雨的球场,看着他投过篮球的球框时,突然间发现自己已经想不起他的容颜。Originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time.原来,这个世界上,对某个事件能产生化学反应的,除了非做不可的坚决,还有,时间。A person's time, your ideas are always special to clear. Want, want, line is clear, as if nothing could shake his. Also once seemed to be determined to do something, but more often is he backed out at last. Dislike his cowardice, finally found that there are a lot of love, there are a lot of miss, like shadow really have been doomed. Those who do, just green years oneself give oneself an arm injection, or is a self-righteous spiritual.一个人的时候,自己的想法总是特别地清晰。想要的,不想要的,界限明确,好像没有什么可以撼动自己。也曾经好像已经下定了决心去做某件事,但更多的时候是最后又打起了退堂鼓。嫌恶过自己的怯懦,最终却发现有很多缘分,有很多错过,好像冥冥之中真的已经注定。那些曾经所谓的非做不可,只是青葱年华里自己给自己注射的一支强心剂,或者说,是自以为是的精神寄托罢了。At the moment, the sky is dark, the air is fresh factor after just rained. Suddenly thought of blue plaid shirt; Those were broken into various shapes of stationery; From the corner at the beginning of deep friendship; Have declared the end of the encounter that haven't start planning. Those years, those days of do, finally, like youth, will end in our life.此刻,天空是阴暗的,空气里有着刚下过雨之后的清新因子。突然想到那件蓝格子衬衫;那些被折成各种各样形状的信纸;那段从街角深巷伊始的友谊;还有那场还没有开始就宣告了终结的邂逅计划那些年那些天的非做不可,终于和青春一样,都将在我们的人生中谢幕。Baumgartner the disappointing news: Mission aborted. r plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.The supersonic descent could happen as early as Sunda.The weatheThe balloon will slowly drift to the edge of space at 120,000 feet ( Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform.Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, he'll be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. It will be like he is diving into the shallow end. Skydiver preps for the big jumpWhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in les