Tetris Game System Design Based on AT89S52 Single Chip Microcomputer
SECTION I.
Introduction
Tetris game is one of the most popular computer game in all over world, which was invented by the mathematician Alexey Pazhitnov in the middle of 1980s. The game can play simply and change so much. Tetris game is with the development of the computer, and attributed to the evolution of a variety of similar games. It trains a players ability to respond. The basic rule is as follows. Firstly a gameboard is given that is a rectangular grid with all empty cells. Random tetrominoes is generated. Each large piece composed of four small square. When it falls the player can rotate and/or slide it horizontally. It stops falling when it lands on. If the piece comes to rest, this line is cleared. As soon as a piece lands on, the next piece appears at the top of the gameboard. When the window can no longer accommodate any more pieces, it declared the end of the game [1]. Tetris game has been studied from many points of view.
Although the development of personal computers, the single chip microcomputer has been widely used in various industrial and technical fields because of its high performance property and low cost [4][5][6]. The most obvious advantage of single chip microcomputer is that can be embedded into a variety of instruments, devices. When it is firstly invented, Intel Corporation gave the name of embedded microcontroller [7]. It can also applies to the development of single-chip products for consumer entertainment. Game design can be seen as a consumer entertainment products for the support and application development. The paper designs the stand-alone Tetris game to the lives of people enjoy the art of aesthetic pleasure and health supplement. Compared with other procedures, there are two characteristics: First, the well-designed man-machine interface is not only friendly but also easy to operate. Second, the author used in the game is a single board. It has some advantages such as high speed, low cost and more efficienctly.
SECTION II.
system
The system realized all the functions of Tetris game based on AT89S52 single chip microcomputer and LED. It uses five buttons. Four of them are corresponding to the four directions and another correspinding to rotating movement. Users can practice and entertainment. The system can indate the next piece and when the piece comes to rest, this line is automatically removed. When piece reach the top of the game board, the game is over. To reduce the cost, LED is selected as the display unit. The system is shown in Fig. 1 as follows.
Figure 1. The system scheme
SECTION III.
Hardware
The principle function of the single chip microcomputer control circuit is the data processing. We select AT89S52 single chip microcomputer to control the circuit. It is an 8bits CMOS single chip microcomputer with low power consumption and high performance. This chip contains 8KB ISP Flash EPROM which can be wrote more than 1000 times and 256B RAM. The apparatus is made of adopting the nonvolatile storage technology with high density of ATMEL Company. It has many functions such as special applied 16bits timing/counter, and it is compatible with standard 80C51 instruction system and 80C51 pin structure, and the chip integrates 8bits central processor and ISP Flash location and it can offer solution with high cost performance for many embedded control application systems [8].
Clock circuit is the heart of the computer, which controls the rhythm of the work of the computer. The clock signal 8052 single chip microcomputer can be generated in two ways: one is the internal way, using the chips internal oscillator circuit to produce the clock signal; another way for the external clock signal introduced from the outside. This design approach is the internal clock circuit. 12MHz crystal oscillator is used for the crystal oscillator.
Lock circuit is to achieve a major role in the low 8-bit system address. Because P0 port uses both as lines for the address and data lines as the use of a dual function, it needs a multiplexing of address and data separation. in the bus for this purpose should be to increase an 8-bit latch. First of all, by the lock system to provide temporary and low 8-bit address, then P0 port uses as data lines.
In this system the lock circuit uses chip 74LS373. Its output o0–o7 can be linked directly with the computer bus. When the tri-state control terminal OE to allow time for the low, o0–o7 normal logic state, can be used to load or bus driver. When OE is high time, o0–o7 showed high resistance state, that is, do not drive the bus, nor for the bus load, but the logic of the internal latch operation is not affected. When the latch to allow for high-end LE when, O and D change with the data. When LE is low, when, O has established the existence of locked-level data.
The keyboard has five keys. Four of them are corresponding to the four directions and another correspinding to rotating movement. The keyboard inputs single chip microcomputer directly.
LED dot matrix display module circuit is the game interface. In our Tetris game lattice formed by the four LED circuit. The internal structure of lattice model is shown in Fig. 2.
Figure 2. LED dot matrix
The designed Tetris game cricuit structure is shown in Fig. 3.
Figure3. The system hardware
SECTION IV.
Software
The software design adopts C computer language and respectively programs different functional modules by the modularization program design idea for the transfer, so the hierarchy and structure of the software will be clearer for the debugging and modification of the software.
The software has some functions as follows. When the device boo
剩余内容已隐藏,支付完成后下载完整资料
基于AT89S52单片机的俄罗斯方块游戏系统设计
第一部分.简介
俄罗斯方块游戏是全世界最流行的电脑游戏之一,它是在20世纪80年代中期的数学家Alexey Pazhitnov发明的。游戏可以简单地玩而且变化很多。俄罗斯方块游戏是用电脑开发的,并归功于各种类似游戏的进化。它训练玩家的反应能力。基本规则如下。首先给出的是一个游戏板的所有空白单元格的矩形网格。方块随机生成。每一大块由四个小正方形组成。当它落下时,玩家可以旋转和/或水平地滑动。当它到达底部时,它停止降落。如果一块填满剩余部分,这行就被清除。只要一块着陆,下一块就会出现在游戏板顶端。当窗口不能再容纳更多的方块时,则宣布游戏结束[ 1 ]。俄罗斯方块游戏已经从多个角度被研究学习。
虽然个人计算机的发展中,单片机因其高性能和低成本已被广泛应用于各种工业和技术领域 [ 4 ] [ 5 ][ 6 ]。单片机最明显的优点就是可以嵌入到各种仪器、设备中。当它第一次发明,英特尔公司给了它嵌入式微控制器这个名称[ 7 ]。它也可以应用于单片机产品的开发,为消费者娱乐。游戏设计可以看作是对消费娱乐产品的支持和应用开发。本文设计的单机俄罗斯方块游戏,是给人们的生活享受艺术的审美愉悦和健康补充。与其他程序相比,有两个特点:第一,设计良好的人机界面不仅友好,而且易于操作。二、作者在游戏中使用的是单板机。它有一些优点,比如高速、低成本并且更有效。
第二部分.系统
该系统实现了基于AT89S52单片机和LED的俄罗斯方块游戏的全部功能。它使用五个按钮。其中四个是对应的四个方向,另一个则对应旋转运动。用户可以练习和娱乐。该系统可以有效期下一块时,当方块满行时,这一行自动消去。当方块到游戏板的顶部,游戏结束。为了降低成本,选择LED作为显示单元。该系统如图1所示如下。
图1.系统方案
第三部分.硬件
单片机控制电路的主要功能是数据处理。我们选用AT89S52单片机来控制电路。这是一个8bits CMOS单芯片低功耗、高性能的单片机。该芯片包含8kb ISP Flash 可擦可编程只读存储器,可以写超过1000次并且有256B 存储器。该装置采用ATMEL公司高密度非易失性存储技术。它有许多功能,比如具有特殊的应用的16引脚定时/计数器,并且它是标准80C51指令系统及80C51引脚结构的兼容,而且芯片集成了8引脚的中央处理器和ISP Flash位置,它能性价比高地为许多嵌入式控制应用系统提供解决方案 [ 8 ]。
时钟电路是计算机的心脏,它控制着计算机的工作节奏。时钟信号8052单片机可以产生两种方式:一种是内部方式,利用芯片内部的振荡电路产生时钟信号;另一种方式为外部时钟信号从外部引入。本设计的方法是内部时钟电路。使用12MHz晶振是晶体振荡器。
锁存电路是为了在低8位系统地址实现一个重要的作用。因为P0口的使用作为地址和数据线作为双功能的用线,它需要一个复用的地址和数据分离。在总线为此目的应该增加一个8位锁存器。首先,通过锁存系统提供暂时的低8位地址,然后,P0口作为数据线使用。
该系统利用芯片74LS373锁存电路。其输出O0–O7可以与计算机总线直接相连。当三态控制终端设备允许的较低的时间,O0–O7正常逻辑状态,可用于加载或总线驱动。当OE为高电平的时候,O0–O7呈高阻状态,即不驱动总线,也不为总线的负载,但内部锁存器的运作逻辑不受影响。当锁存器调到高端LE时,O和D随数据变化。当LE为低时,O已建立锁定级数据的存在。
键盘有五个键。其中四个是对应四个方向,另一个对应旋转运动。键盘直接输入单片机。
LED点阵显示模块电路是游戏界面。在我们的俄罗斯方块游戏中由四个点阵构成的点阵电路。晶格结构的内部结构如图2所示。
图2.LED点阵
俄罗斯方块游戏的设计的电路结构如图3所示。
图3.系统硬件
第四部分.软件
此软件设计采用C语言,采用模块化的程序设计思想对不同的功能模块进行编程,使软件的层次结构更加清晰,便于软件的调试和修改。
此软件有以下一些功能。当装置启动,在游戏板显示欢迎信息。如果旋转键被按下,游戏开始。单片机扫描键盘上的键并获取键值。这个软件可以控制人机交互。在游戏运行的情况下,如果“左”键被按下,该块将向左移动;如果“右”键被按下,则该方块向右移动;如果按下“向下”键,则方块移动得更快。游戏界面LED点阵单元在右边显示会出现下一块,左边的LED显示游戏界面的正常执行。方块下落,当满行时,该行将自动消除。
第五部分.结果
根据以前的设计,我们使用Proteus软件来模拟系统电路。Proteus是一个综合功能的电子设计自动化软件,不仅可用于模拟电路和数字电路仿真分析,还可应用于单片机及其外围电路仿真。本软件由微处理器芯片包括8051个系列,支持AVR系列、PIC系列等。仿真结果表明,该设计可以实现游戏的基本功能和实现预期目的,如图4-6所示.
图4. 游戏开始
图5. 游戏运行
图6. 游戏结束
第六部分.结论
俄罗斯方块游戏在世界各地已经有很长的历史了。作为世界上最受欢迎的游戏,俄罗斯方块游戏有许多版本,可以在不同的终端,如个人电脑,手机,在互联网上玩。在本文中,一个俄罗斯方块游戏系统的开发基于单片机和发光二极管点阵模块库。设计了系统的硬件和应用软件,描述了系统各个细节的总体原理。该系统具有体积小、成本低、使用方便、功能强等优点。该系统便于在市场上推广。
剩余内容已隐藏,支付完成后下载完整资料
资料编号:[26509],资料为PDF文档或Word文档,PDF文档可免费转换为Word
您可能感兴趣的文章
- 饮用水微生物群:一个全面的时空研究,以监测巴黎供水系统的水质外文翻译资料
- 步进电机控制和摩擦模型对复杂机械系统精确定位的影响外文翻译资料
- 具有温湿度控制的开式阴极PEM燃料电池性能的提升外文翻译资料
- 警报定时系统对驾驶员行为的影响:调查驾驶员信任的差异以及根据警报定时对警报的响应外文翻译资料
- 门禁系统的零知识认证解决方案外文翻译资料
- 车辆废气及室外环境中悬浮微粒中有机磷的含量—-个案研究外文翻译资料
- ZigBee协议对城市风力涡轮机的无线监控: 支持应用软件和传感器模块外文翻译资料
- ZigBee系统在医疗保健中提供位置信息和传感器数据传输的方案外文翻译资料
- 基于PLC的模糊控制器在污水处理系统中的应用外文翻译资料
- 光伏并联最大功率点跟踪系统独立应用程序外文翻译资料
