基于51单片机贪吃蛇游戏设计

  • 格式:doc
  • 大小:1.36 MB
  • 文档页数:75

下载文档原格式

  / 50
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

摘要

本文设计了一款新颖的以单片机为控制核心的贪食蛇游戏系统。所设计的贪食蛇能完成移动、吃食物和摆放游戏自动输出的食物、使之默认出现3节蛇身、吃到每个随机点数而得分等功能。硬件设计包括LED模块、键盘模块、供电模块驱动模块和下载模块。软件采用C语言编程,方便灵活,大大加快了软件开发速度,缩短了开发周期,并且便于移植。为提高开发效率和硬件稳定性,采用了功能强大的硬件仿真软件Proteus,依托该软件提供的仿真环境搭配Keil作为软件开发调试环境进行仿真调试成功。所设计的贪食蛇游戏系统轻巧便携、老少皆宜,且成本较低,具有一定的市场前景。

关键词:贪吃蛇;单片机;游戏

I

Abstract

This paper designs a novel single-chip microcomputer as the snake game control system. The snake can complete mobile, food and put the game automatically output of food, which appears by default 3 snake, eat each random points and scoring functions. The hardware design includes LED module, keyboard module, power supply module and driving module and download module. The software is programmed with C language, convenient and flexible, greatly accelerate the speed of software development, shorten the development cycle, and easy to transplant. In order to improve the development efficiency and stability of the hardware, the powerful hardware simulation software Proteus, based on the simulation environment of the software provided with Keil as the software development environment for debugging simulation debugging success. Snake game system design of the light and portable, suitable for all ages, and the cost is low, has a certain market prospects.

KeyWords:Greedy Snake;51MCU;Game

I

目录

目录

第一章绪论 (1)

1.1课题设计的背景与意义 (1)

1.2 贪食蛇游戏的发展及现状 (2)

1.2.1贪食蛇游戏发展历史 (2)

1.2.2我国单机游戏的现状 (3)

1.3 课题设计的内容与要求 (4)

1.3.1课题设计的内容 (4)

1.3.2课题设计的要求 (4)

1.4设计方案 (4)

1.4.1硬件设计 (4)

1.4.2软件设计 (5)

第二章系统总体设计 (6)

2.1 系统基本组成及工作原理 (6)

2.2 系统的主要元器件介绍 (8)

2.2.1 74HC138 (8)

2.2.2 74HC154 (10)

2.2.3 74HC595 (12)

2.3 主控芯片单片机 (14)

2.3.1单片机的介绍 (14)

2.3.2单片机的应用 (15)

2.4 单片机红外无线 (17)

2.4.1红外遥控 (17)

2.4.2红外遥控发射 (18)

2.4.5红外遥控接收 (19)

2.4.6红外编码标准 (19)

第三章系统硬件的设计 (21)

3.1单片机控制模块的设计 (21)

3.1.1 单片机的选择 (21)

3.1.2 时钟电路 (24)

I

目录

3.1.3 复位电路 (26)

3.1.4 最小系统 (27)

3.2 供电电路设计 (27)

3.3 显示模块设计 (28)

3.3.1 点阵模块 (28)

3.3.2 驱动电路设计 (31)

3.3.3 行驱动电路 (32)

3.3.4 列驱动电路 (33)

3.3.5 扫描显示过程 (34)

3.3.6 显示模块原理图 (35)

3.4下载模块设计 (35)

第四章系统软件的设计 (37)

4.1软件的整体设计思想 (37)

4.2 软件开发环境 (37)

4.2.1 keil软件的介绍 (37)

4.2.2 软件功能 (38)

4.2.3 软件应用流程 (39)

4.3系统主函数的设计 (40)

4.3.1按键检测模块 (42)

4.3.2 显示模块 (43)

4.3.3分数模块 (44)

第五章系统调试 (46)

5.1软件调试 (46)

5.2硬件调试 (46)

5.3作品展示 (48)

总结 (49)

参考文献 (50)

致谢 (51)

附录一:原理图 ............................................... I 附录二:原程序 ............................................... I

II