更新时间:11-02 (邻座的怪同学)提供原创文章
摘要:随着科技的发展,现代生活节奏越来越快,人们的工作生活压力也随之加大。设计一款操作简单,生动新颖,娱乐性强,便于携带的小游戏,在繁忙的工作生活之余玩玩这款小游戏,不仅可以调节人们的情绪,使人心情舒畅,还能健脑益智,为更好地投入工作学习做好准备。
本文基于51单片机设计的贪食蛇游戏,除了具有传统意义上的贪食蛇游戏的特点:吃食物蛇身增长,得分;分数达到一定等级进行升级以后,蛇运动速度加快等以外,本次设计加入了游戏暂停,中途退出。为节省存储空间,具体实现上,硬件系统平台采用51系列单片机,搭载32x32点阵LED,独立键盘,构成了一个轻巧便携的游戏机系统。STC12C5A60S2单片机技术成熟,功能强大,应用广泛。使用单片机作为控制核心,可以简化硬件电路,采用软件编程控制单片机实现硬件电路的功能,降低能耗,降低成本。软件采用C语言编程,方便灵活,大大加快了软件开发速度,缩短了开发周期,并且便于移植。文中具体介绍了使用到的各种硬件的特性,游戏的各种功能与详细设计,软件的具体设计思路,各模块的详细介绍,部分模块的程序流程图,关键部分代码的详细讲解等。
关键词: STC12C5A60S2;游戏;点阵屏;贪食蛇
Abstract:With the development of science and technology, the increasingly fast pace of modern life, people's work life pressure also will increase. Design a simple operation, vivid novel, entertaining, portable game, this game I play in a busy working life, not only can adjust the mood of the people, people with good feelings, but brain benefits intelligence, learning to prepare for better work.
Based on the Snake game in 51 single-chip design, in addition to the characteristics of the Snake game in the traditional sense: eat snake growth, the score; the score reaches a certain level to be upgraded later, the snake movement speed beyond the design joined the game to pause, to quit. To save storage space, specifically on the hardware platform with STC12C5A60S2, equipped 32x32 dot matrix LED, keyboard, constitute a lightweight portable video game system. 51 Series single-chip technology is mature, powerful, and widely used. Use a microcontroller as the core of the hardware circuit can be simplified using the functionality of the software-programmable microcontroller hardware circuit, reduce energy consumption and reduce costs. The software uses the C programming language, convenient and flexible, and greatly accelerate the speed of software development, shorten the development cycle, and portable. The specific characteristics of the various hardware used, the game's various features and detailed design, software design ideas, the detailed description of each module, some modules of the program flow chart, the key part of the code explained in detail.
Key words:STC12C5A60S2;game;lattice screen;snake
对系统内容进行分析,深入地进行资料收集和文献阅读,跟据国内外高校教师教学质量测评软件的理论研究和实证研究的最新动向,并对文献资料进行编译、分类、比较与分析,在网上采取调查,寻找最新理论工具。本文通过对贪食蛇游戏的深入了解,对贪食蛇游戏功能的实现等优点进行深入研究。
传统的点阵贪食蛇游戏,其点阵是由分立LED组合而成,也忽略了人性化设计方面,而单片机和点阵屏组合的贪食蛇游戏设计解决了这些难题,采用8*8点阵模块可以很好的对输出显示,以及根据界面提示,便能很好进行贪食蛇游戏。
(1)利用Protel软件对该系统进行电路图的绘制。
(2)利用万用板,纯手工制作实物图,单片机的最小系统,并将其引脚以排阵的形式引出,方便以后做开发设计以及利用杜邦线接入其余电路配合调试使用,利用SPI接口的595IC设置点阵屏的行列驱动。
(3)利用C51测试程序,检测单片机最小系统能否正常工作,同时驱动点阵屏,看有无坏点现象,如有坏点则换相应的8*8点阵屏模块,以免造成其余影响。