I基于单片机的贪吃蛇游戏设计学生姓名:学生学号:院(系):电气信息工程学院年级专业:指导教师:二〇一五年五月摘要摘要Ⅰ在21世纪的今天,人们的生活开始变得更加丰富多彩。在繁忙的工作之余,娱乐成为人们生活不可或缺的一份子,而游戏作为近年来逐渐兴起的一种娱乐方式,已经越来越受到人们的青睐。在工作学习之余,通过玩游戏来放松、调节紧张的学习工作压力是不错的选择;然而大型的网络游戏玩起来比较耗费时间,且不能随时随地的玩。那么如果这时候拥有一款简单易携带,并且能够缓解压力的小游戏将是个不错的选择,所以,我就设计了这样一款简单易携带的经典小游戏——贪吃蛇。具体实现上,硬件系统平台采用STC89C52R单片机,搭载LCD12864显示屏,构成一个轻巧简单的游戏机系统。软件系统采用C语言编程,Protues软件设计电路并仿真,KEIL软件进行程序的调试。最终实现贪吃蛇游戏系统。本次设计的贪吃蛇游戏,实现了传统意义上的贪吃蛇游戏的特点:蛇吃掉豆子后,得分增加并且蛇身变长;分数到达一定数目进行升级以后,蛇运动速度加快。而玩家只需利用方向按钮“上↑、下↓、左←、右→”来改变蛇的运行方向,就能达到娱乐的目的,操作非常简单。关键词:贪吃蛇游戏,STC89C52R单片机,LCD12864,C语言ABSTRACTABSTRACTⅡInthe21stcenturytoday,people'slifebecomemorecolorful,Intheoutsideofbusywork,entertainmentbecomeanintegralpartofpeople'slife,Andthegameasemerginginrecentyears,akindofentertainment,alreadymoreandmoregetthepopularofpeople,Intheoutsideofworkandstudy,throughtheplaygamestorelax,adjustthepressureoflearningisagoodchoice;Howeverlargenetworkgameplaymoretime-consuming,Andcan'tplayanywhere,anytime.Soifthistimehasasimpleiseasytocarry,andcaneasethepressureofsmallgamewillbeagoodchoice.So,Iwoulddesignsuchasimpleandeasytocarrysmallclassicgame–thesnakegame.Ontheconcreteimplementation,withSTC89C52RCSinglechipmicrocomputersystemplatform,withaLCDdisplay,constitutealightweightsimplegamesystem.SoftwareuseClanguageprogramming,useProtuessoftwareCircuitdesignandsimulation,KEILSoftwareprogramdebugging,Finallyrealizesthesnakegamesystem.Thedesignofthesnakegame,Achievedinthetraditionalsenseofthesnakegamefeatures:afterthesnaketoeatbeans,scoresandsnake-bodyvariablelength;Scoretoreachacertainnumberaftertheupgrade,thesnake'smovementspeed.Playersneedtousethedirectionkey↑,up,down,left,right,tochangetherunningdirectionofsnake,andcanachievethepurposeofentertainment,theoperationisverysimple.Keywords:GreedySnakeGame,STC89C52RCSinglechipmicrocomputer,LCD12864,ClanguageABSTRACT目录摘要...........................................................................................................................IABSTRACT..................................................................................................................21绪论..........................................................................................................................21.1本课题研究的背景及意义...............................................................................................21.2国内外研究现状、水平..................................................................................................21.3本课题的发展趋势..........................................................................................................11.4本课题的研究内容和达到的要求...................................................................................12方案分析与选择.....................................................................................................22.1系统方案设计..................................................................................................................22.2显示器模块设计方案.......................................................................................................22.3按键输入模块设计方案..................................................................................................32.4本课题的技术指标..........................................................................................................32.5本课题的创新..................................................................................................................33系统硬件设计.........................................................................................................43.1单片机的选择与其性能分析...........................................................................................43.1.1单片机概述..........................................................................................................43.1.2单片机STC89C52RC的介绍.............................................................................43.1.3单片机最小系统的介绍.......................................................................................53.2LCD12864简介................................................................................................................63.2.1LCD12864概述....................................................................................................63.2.2LCD128*64的基本特性....................................................................................63.2.3模块接口说明....................................................................................................73.2.4指令说明............................................................................................................93.3键盘电路的设计............................................................................................................113.4蜂鸣器电路的设计........................................................................................................113.4.1蜂鸣器简介.........................................................................................................113.4.2蜂鸣器的设计....................................................................................................124软件系统设计...........................................................................