毕业设计-基于单片机的篮球比赛计时计分器设计.doc

上传人:good****022 文档编号:116658800 上传时间:2022-07-06 格式:DOC 页数:18 大小:138.02KB
收藏 版权申诉 举报 下载
毕业设计-基于单片机的篮球比赛计时计分器设计.doc_第1页
第1页 / 共18页
毕业设计-基于单片机的篮球比赛计时计分器设计.doc_第2页
第2页 / 共18页
毕业设计-基于单片机的篮球比赛计时计分器设计.doc_第3页
第3页 / 共18页
资源描述:

《毕业设计-基于单片机的篮球比赛计时计分器设计.doc》由会员分享,可在线阅读,更多相关《毕业设计-基于单片机的篮球比赛计时计分器设计.doc(18页珍藏版)》请在装配图网上搜索。

1、单片机原理及系统课程设计报告基于单片机的篮球比赛计分计时器设计摘 要本系统是采用单片机AT89C51作为本设计的核心原件。利用7段共阴LED作为显示器件。在此设计中共接入了2个7段共阴LED显示器,用于记录得分和比赛时间,显示范围可以达到0到99分,基本满足赛程需求。计分按照倒计时,每次计时时间为12分钟,当时间暂停和开始计时时给出报警。计时是倒计时,采用定时/计数0中断,计分采用查询的方式,查询是否有键按下,如若有则跳转到相应的计分子程序进行相应的计分。关键词:AT89C51;LED显示;定时计数器 AbstractThis system is designed by single chip

2、 microcomputer AT89C51 as the core components. Use 7 with Yin LED as a display device. In the design of the communist party of China access to the two 7 with Yin LED displays, used to record scores and game time, showing the range can reach 0 to 99 points, basic meet schedule requirements. Graded ac

3、cording to the countdown, timing time of 12 minutes every time, when the time to stop and start the time alarm. Timing is the countdown, using the timer/counter interrupt 0, the score with the method of query, the query whether there is a button press, if there are program to jump to the correspondi

4、ng gauge molecules score accordingly.Keywords: AT89C51,LED display ,timing counter1 引言1.1 设计要求(1)能记录整个赛程的比赛时间;(2)能随时刷新甲、乙两队在整个过程中的比分,输入错误时能够纠正比分;(3)中场交换比赛场地时,能交换甲、乙两队比分的位置。1.2 设计方法本系统采用单片机AT89C51作为本设计的核心元件。利用7段共阳LED作为显示器件。在此设计中共接入了8个7段共阳LED显示器,其中4个用于记录AB队的分数,每队2个LED显示器显示范围可达到099分,足够满足赛程需要,另外4个LED显示器

5、则用来记录赛程时间,其中2个用于显示分钟,2个用于显示秒钟。赛程计时采用倒计时方式。即比赛前将时间设置好,即12分钟,比赛开始时启动计时,直至计时到零为止。本设计中设立了10个按键,其中8个用于设置两队的比分,1个用于交换场地,1个用于启动和暂停等功能。2 设计方案及原理2.1 器件选择系统在设计的过程中主要选取了以下一些器件:单片机:AT89C51 ,显示器件:7段共阴LED显示器,按键11个,上拉电阻2个,10K欧电阻2个,330PF电容2个,晶振一个。2.2 芯片引脚介绍(1)AT89C51介绍目前在单片机系统中,应用比较广泛的微处理器芯片主要为8XC5X系列单片机。该系列单片机均采用标

6、准MCS-51内核,硬件资源相互兼容,品类齐全,功能完善,性能稳定,体积小,价格低廉,货源充足,调试和编程方便,所以应用极为广泛。AT89C51单片机是一款低功耗,低电压,高性能CMOS 8位单片机,片内含4KB(可经受1000次擦写周期)的FLASH可编程可反复擦写的只读程序存储器(EPROM),器件采用CMOS工艺和ATMEI公司的高密度、非易失性存储器(NURAM)技术制造,其输出引脚和指令系统都与MCS-51兼容。片内的FLASH存储器允许在系统内可改编程序或用常规的非易失性存储器编程器来编程。因此,AT89C51是一种功能强,灵活性高且价格合理的单片机,可方便的应用在各个控制领域,它

7、的引脚图如图1。 图1 AT89C51引脚图(2)7段共阴LED显示器本设计中采用的是LED显示器7SEG-MPX系列。LED显示器由于结构简单,价格便宜,体积小,亮度高,电压低,可靠性高,寿命长,响应速度快,颜色鲜艳,配置灵活,与单片机接口方便而得到广泛应用。LED显示器是由若干个发光二极管组成显示字段的显示部件,当发光二极管导通时,相应的一个点或一个笔划发光,控制不同组合的二极管导通,就能显示出各种字符。在单片机系统中使用最多的是如图2所示的七段数码显示器。图2 七段共阴极数码管引脚图(4位) 图2中左面8个引脚分别是A,B,C,D,E,F,G,DP(小数点),右面是四个数码管的位选端。例

8、如图中“1”号引脚为低电位(共阴极)时,第一个数字显示7段码表示的数字或者字母。3 硬件设计3.1计分电路设计该电路采用查询的方式设计,即当有键按下时给出低电平,再用软件查询的方式检查是否有低电平,如有则显示相应的计分。所以在设计时考虑设计相应的上拉电阻,因为按钮不能直接和单片机的引脚相连。按下相应按键可以达到本系统各个计分功能。各按键及对应功能如下:RESEAT键:恢复比分和时间;A+1键:显示A队分数加一;A+2键:显示A队分数加二;A+3键:显示A队分数加三;A-1键:显示A队分数减一(防止在计分时按错的情况);B队按键功能同上;3.2 换场及暂停计时/开始计时电路设计通过利用中断的方法

9、来实现换场及暂停计时/开始计时,用两个按键:STOP/START和CHANGE分别产生中断来控制开始计时/暂停计时和场地互换功能。同样注意,在设计电路是设计相应的上拉电阻。3.3 计分和时间显示电路设计计分和时间显示采用四位七段共阴极数码管(如图2),用单片机的P0口用于两个数码管的段选,P2口低四位用于控制时间显示的位选,P2口的高四位用以比分显示的位选,由于采用的是共阴极数码管,所以要有电源和上拉电阻。3.4 系统总体设计系统硬件设计根据系统框图,从系统框图中可以知道,该系统中包含了预期设计的几个部分。而核心部分是AT89C51单片机,单片机在系统设计程序的控制下,实现预期功能,连线过程中

10、,由于上拉电阻过多,所以选择RESPACK-7和RESPACK-8两个排阻,使整体电路简单美观,本设计中未使用总线。系统原理图如图7:图3 系统设计框图 4 软件设计4.1流程图软件设计的流程图为下面图4、5和6。图4 交换场地流程图 图5得分显示流程图 图6 主程序流程4.2系统仿真 根据电路连接图连接电路,在KEIL环境下编译链接装入issue7 Professional中,修改预定参数,进行软件仿真,点击软件执行键,最终仿真成功得到图7所示的结果: 图7仿真图5 总结这次课程设计对我来说试一次难得的经历,首先让我对所学单片机课程有了全面的熟悉、新的认识和深刻的理解,对于Proteus软件

11、有了更熟练的掌握,在设计过程中遇到了不少困难,经过多次的努力和尝试最终成功,当然收获远远大于成功。电路的连接不可放过每个细节,少有疏忽就会出错。对电路的整体布局也相当重要,一个好的布局对于理解和调试过程中的检查错误不可缺少,还能使整个电路美观,便于修改和创新。本次设计当中还有想到的不足之处:设计有许多可新加的扩展功能,例如倒计时为0时给与鸣笛提醒,24秒进攻时间的显示,队员犯规次数的记录与显示等等,由于自己的能力有限,未能在本次设计中实现。在这次的实践与学习当中,尽管区间困难多多,但我还是从中学到了很多的新知识、新技能和解决困难的方法,也最终体验到了经历困难到最终获得成功的那种无以言表喜悦。总

12、之,本次课程设计让我收获颇多,也希望自己能在以后的学习当中能坚持这种不懈努力,迎难而上的精神。 参考文献1 王思明.单片机原理及设计与应用M.北京:科学教育出版社,20122 胡辉.单片机原理与应用M.北京:中国水利水电出版社,20073 戴佳.51单片机C语言应用程序设计实例精讲M.北京:电子工业出版社, 2006.44 张涵.基于PROTEUS的电路及单片机设计与仿真M.北京:电子工业出版社, 2012.7附录:程序清单: ORG 0000H LJMP MAIN ORG 0003H;外部中断0 LJMP CHANGE;跳转到换场 ORG 000BH;定时计数器0中断 LJMP TIME;跳

13、转到时间中断程序 MAIN: MOV 20H,#00H ;秒 MOV 21H,#0CH ;分 MOV 22H,#00H ;A队分数 MOV 23H,#00H ;B队分数; MOV 30H,#00H ;秒缓冲区 MOV 31H,#00H MOV 32H,#02H ;分缓冲区 MOV 33H,#01H MOV 34H,#00H ;A队分数缓冲区 MOV 35H,#00H MOV 36H,#00H ;B队分数缓冲区 MOV 37H,#00H MOV TMOD,#01H ;工作方式:16位定时/计时 MOV TH0,#03CH ;定时初始化 MOV TL0,#0B0H MOV R2,#14H MOV

14、IE,#83H;开INT1、TO中断 MOV IP,#01H;设置中断优先级 START: LCALL DISPT ;比赛时间显示 LCALL DISPF ;比赛分数显示 ;比分加减实现程序: JNB P1.0,AA1 ;P1.0=1,A队加一分 JNB P1.1,AA2 ;A队加两分 JNB P1.2,AA3 ;A队加三分 JNB P1.3,AD1 ;A队减一分 JNB P1.4,BA1 ;B队加一分 JNB P1.5,BA2 ;B队加两分 JNB P1.6,BA3 ;B队加三分 JNB P1.7,BD1 ;B队减一分 JB P3.0,START CPL TR0 ;按外取反,启动/暂停设置

15、LJMP STARTAA1: JNB P1.0,AA1 INC 22H MOV A,22H LJMP STOREA;跳转到分数转换程序AA2: JNB P1.1,AA2 MOV A,22H ADD A,#02 MOV 22H,A LJMP STOREAAA3: JNB P1.2,AA3 MOV A,22H ADD A,#03 MOV 22H,A LJMP STOREAAD1: JNB P1.3,AD1 DEC 22H MOV A,22HSTOREA: MOV B,#0AH ;A队比分转换成10进制并放缓冲区 DIV AB MOV 34H,B MOV 35H,A LJMP STARTBA1: J

16、NB P1.4,BA1 INC 23H MOV A,23H LJMP STOREBBA2: JNB P1.5,BA2 MOV A,23H ADD A,#02 MOV 23H,A LJMP STOREBBA3: JNB P1.6,BA3 MOV A,23H ADD A,#03 MOV 23H,A LJMP STOREBBD1: JNB P1.7,BD1 DEC 23H MOV A,23HSTOREB: MOV B,#0AH ;B队比分转换成10进制并放缓冲区 DIV AB MOV 36H,B MOV 37H,A LJMP START DELAY: MOV R4,#5H ;为稳定显示设置的延迟DL

17、00: MOV R5,#0FFHDL11: DJNZ R5,DL11 DJNZ R4,DL00 RET;时间中断程序:TIME: PUSH ACC PUSH PSW MOV TH0,#03CH;中断初值设定 MOV TL0,#0B0H DJNZ R2,RET0 MOV R2,#18H MOV A,20H CLR C DEC A MOV 20H,A MOV A,21H CJNE A,#00H,PFF ;非0分跳转 MOV A,20H CJNE A,#00H,PFF ;非0秒跳转 CLR TR0 ;比赛结束复位设置 LCALL DELAY MOV 20H,#00H MOV 21H,#0CH MOV

18、 30H,#00H MOV 31H,#00H MOV 32H,#02H MOV 33H,#01H LJMP RET0PFF: MOV A,20H CJNE A,#0FFH,OUT MOV 20H,#59 ;59秒设置 MOV 30H,#09H MOV 31H,#05H MOV A,21H DEC A MOV 21H,AOUT: MOV A,20H MOV B,#0AH ;16进制到 10进制转化 DIV AB MOV 30H,B MOV 31H,A MOV A,21H MOV B,#0AH DIV AB MOV 32H,B MOV 33H,ARET0: POP PSW POP ACC RETI

19、;时间显示程序:DISPT: MOV R0,#30H MOV R3,#08H ;数码管为共阴极 MOV A,R3 PLAYT: MOV P2,A MOV A,R0 ;查字形码 MOV DPTR,#TABEL MOVC A,A+DPTR MOV P0,A ;输出字形码 LCALL DL1 MOV P2,#00H; MOV A,R3 RR A ;循环右移点亮对应的LED JB ACC.7,LD1 INC R0 MOV R3,A LJMP PLAYTLD1: RET ;比分显示程序: DISPF: MOV R0,#34H MOV R3,#80H MOV A,R3 PLAYF: MOV P2,A MO

20、V A,R0 MOV DPTR,#TABEL MOVC A,A+DPTR MOV P0,A;输出字形码 LCALL DL1 MOV P2,#00H;共阴极 MOV A,R3 RR A JB ACC.3,LD1 INC R0 MOV R3,A LJMP PLAYF AJMP LD1DL1: MOV R7,#05HDL: MOV R6,#0FFHDL6: DJNZ R6,DL6 DJNZ R7,DL RET ;交换场地程序:CHANGE: PUSH PSW PUSH ACC JB P3.2 QU ;检查按键是否被按下 MOV A,22H XCH A,23H MOV 22H,A MOV A,34H

21、XCH A,36H MOV 34H,A MOV A,35H XCH A,37H MOV 35H,AQU: POP ACC POP PSW RETI TABEL: DB 0C0H,0F9H,0A4H,0B0H,99H DB 92H,82H,0F8H,80H,90H ENDg an employment tribunal claiEmployment tribunals sort out disagreements between employers and employees.You may need to make a claim to an employment tribunal if: y

22、ou dont 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, seeDismissal.You can make a claim to an employment tribunal, even if you haventapp

23、ealedagainst 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 month

24、s 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 underFurther help.Employment trib

25、unals 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

26、 straight away from one of the organisations listed underFurther 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 adamages-based agreement. In England and Wal

27、es, your solicitor cant 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 youre clear about the terms of the agreement. It might be best to get advice from an experienced adviser, for example, at

28、 a Citizens Advice Bureau. To find your nearest CAB, including those that give advice by e-mail, click onnearest CAB.For more information about making a claim to an employment tribunal, seeEmployment tribunals.The (lack of) air up there Watch mCayman Islands-based Webb, the head of Fifas anti-racism

29、 taskforce, is in London for the Football Associations 150th anniversary celebrations and will attend Citys 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 its about how he felt and I would like to speak t

30、o him first to find out what his experience was.Uefa hasopened disciplinary proceedings against CSKAfor the racist behaviour of their fans duringCitys 2-1 win.Michel Platini, president of European footballs governing body, has also ordered an immediate investigation into the referees actions.CSKA sa

31、id they were surprised and disappointed by Toures 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; Ma

32、y 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.一字开头的年龄已经到了尾声

33、。或许是愧疚于自己似乎把转瞬即逝的很多个不同的日子过成了同一天的样子;或许是追溯过去,对自己那些近乎偏执的怪异信念的醒悟,这些天以来,思绪一直很凌乱,在脑海中不断纠缠。总觉得自己自己似乎应该去做点什么,或者写点什么。二十年的人生轨迹深深浅浅,突然就感觉到有些事情,非做不可了。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 Yea

34、r, 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 isnt really grow up, it seems is not

35、so important; Then in high school, think dont 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 bas

36、ketball hoops, suddenly found himself has already cant remember his appearance.童年时,觉得压岁钱和新衣服是过年必备,但是随着年龄的推进,会越来越发现,那些东西根本就可有可无;初中时,以为要有一场暗恋才意味着真正的成长,但三年过去后,自己心平气和的写同学录的时候,突然就发现是不是真正的成长了,好像并没有那么重要了;然后到了高中,觉得非要吐露出自己的心声才能为高中生涯里的懵懂情愫划上一个句点,但毕业晚会的时候最终还是被梗塞在了咽喉,后来再次站在他曾经挥汗如雨的球场,看着他投过篮球的球框时,突然间发现自己已经想不起他的容

37、颜。Originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time.原来,这个世界上,对某个事件能产生化学反应的,除了非做不可的坚决,还有,时间。A persons time, your ideas are always special to clear. Want, want, line is clear, as if nothing could shake his. Also once seemed to be deter

38、mined 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.一个人的

39、时候,自己的想法总是特别地清晰。想要的,不想要的,界限明确,好像没有什么可以撼动自己。也曾经好像已经下定了决心去做某件事,但更多的时候是最后又打起了退堂鼓。嫌恶过自己的怯懦,最终却发现有很多缘分,有很多错过,好像冥冥之中真的已经注定。那些曾经所谓的非做不可,只是青葱年华里自己给自己注射的一支强心剂,或者说,是自以为是的精神寄托罢了。At the moment, the sky is dark, the air is fresh factor after just rained. Suddenly thought of blue plaid shirt; Those were broken in

40、to various shapes of stationery; From the corner at the beginning of deep friendship; Have declared the end of the encounter that havent start planning. Those years, those days of do, finally, like youth, will end in our life.此刻,天空是阴暗的,空气里有着刚下过雨之后的清新因子。突然想到那件蓝格子衬衫;那些被折成各种各样形状的信纸;那段从街角深巷伊始的友谊;还有那场还没有

41、开始就宣告了终结的邂逅计划那些年那些天的非做不可,终于和青春一样,都将在我们的人生中谢幕。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 c

42、apsule 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 kilometer

43、s) 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 o

44、nto 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, hell 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

45、 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 less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to Earth. But this will not be enough t

46、o stop him completely.If he goes too fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524 meters).In

47、 order to deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).cause there17

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!