Hurdle Race Game

30
Hurdle Race Game Semester Project: Digital Logic Design Course: BEE-4B Teacher: Sir Arshad Nazir Submitted by: Student Name: Syed Maaz Imran Complete Reg# NUST201200467BSEECS60412 Student Name: Muhammad Asawal Complete Reg# NUST201200599BSEECS60412

description

Digital Logic Design Project

Transcript of Hurdle Race Game

Page 1: Hurdle Race Game

i

Hurdle Race Game Semester Project: Digital Logic Design

Course: BEE-4B

Teacher: Sir Arshad Nazir

Submitted by:

Student Name: Syed Maaz Imran

Complete Reg# NUST201200467BSEECS60412

Student Name: Muhammad Asawal

Complete Reg# NUST201200599BSEECS60412

Page 2: Hurdle Race Game

Dedication

We dedicate this project to ourselves for the tireless efforts we have put in throughout the design phase of this project. We set aside valuable time for this project which could have been utilized for exam preparation, only to ensure a good and finished product which will validate our learning of the subject and its practical application.

Page 3: Hurdle Race Game

Acknowledgements

First and foremost, we are thankful to Allah Almighty for the completion of this project. Without whose help, we would not have been able to accomplish anything. We also acknowledge the efforts of our Digital Logic Design instructor, Sir Arshad Nazir, for teaching us the concepts of logic design in an excellent way and pushing us to the limits to bring out the best in us. We also acknowledge his support through the idea development phase of the project. We are also thankful to lab engineer, Mr. Awais Waris, for helping us in learning the simulation software Proteus and helping in debugging some errors during the simulation phase. We are also thankful to sources available on the internet which helped us out whenever we got stuck during any phase of the project.

Page 4: Hurdle Race Game

Abstract

3

Our Project is a hardware implemented game that incorporates a 4 * 7 matrix of LEDs which display random patterns of 4 bit binary numbers cascading down the matrix. The lighted LEDs are obstacles that need to be avoided by the player’s LED at the bottom. The player’s LED has four possible positions to stay lighted which is controlled by two

push buttons by the user, shifting the LED left or right. Collisions of lighted LED obstacles and the lighted player position is the loss of life for the player. Three such collisions cause the game to be over. Each successful avoiding of collision increments the score by one.

Page 5: Hurdle Race Game

4

List of Figures:

Figure 1: Block Diagram ................................................................................................................................ 2

Figure 2: Detailed Circuit Diagram ................................................................................................................ 2

Page 6: Hurdle Race Game

5

Table of Contents

Contents Chapter 1: Introduction ................................................................................................................................ . 1

1. Overview of Project .......................................................................................................................... . 1

2. Block Diagram of Complete System (without using ICs, just use simple blocks) ................... ............ .2

3. Clear Work Division................................................................................................................. ........... 2

Chapter 2: Design....................................................................................................................... .................... 3

1. Problem Statement .............................................................................................................. ............. 3

2. Solutions to Problems........................................................................................... .............. . . ........... 3

3. Complete Logic Diagram .................................................................................... ................................ 7

Chapter 3: Hardware Implementation................................................................... ........................................ 8

1. Schematic Diagram .............................................................................. .............................................. 8

2. Details of ICs used ............................................................................................................................. 9

3. Details of Other Components used like diodes, transistors, resistors etc. .......................................1 9

4. Hardware Issues / Results/ Observations ...................................................................... .................. 20

Chapter 4: Project Applications Further Suggestions (Optional) ......................................... ....................... 21

Chapter 5: Future Recommendations................................................................................. .........................22

Bill of Materials .................................................................................................................... ........................ 23

References / Bibliography .................................................................................................. .......................... 24

Page 7: Hurdle Race Game

Chapter 1 Introduction

1

Chapter 1: Introduction

1.1 Overview of Project

Our Project is a game that comprises mostly a sequential circuit but with some

combinational parts as well. The number of inputs are two, both from the player,

namely right shift and left shift buttons, which the player will use to move his/her

position along the available row, avoiding the falling obstacles in the shape of glowing

red LEDs reaching the player’s green LED from above. If the player avoids the falling

obstacle successfully, his/her score is incremented by 1. Incase of collision with the

obstacle, one of the three lives of the player is lost. After three lives are lost, the game

is over, indicated by the game over LED. The game can then be reset and played again.

Page 8: Hurdle Race Game

Chapter 1 Introduction

2

1.2 Block Diagram of Complete System (without using ICs, just use simple

blocks) 555 Timer ICs Random Pattern Shift Registers LEDs Generating Circuit

Push Buttons Button Control Player LEDs Score Circuit Counting & Lives Control Circuit

Figure 1: Block Diagram

1. Clear Work Division Clearly describe the work of each and every member with the help of block diagram if possible. Or give a

new figure illustrating work division Logic Development Software Implementation Hardware Implementation Documentation Maaz – 80% Maaz – 20% Maaz – 40% Maaz – 60% Asawal – 20% Asawal – 80% Asawal – 60% Asawal – 40%

Figure 2: Work Division

Page 9: Hurdle Race Game

3

Chapter 2 Design

Chapter 2: Design

2.1 Problem Statement

1. To develop a circuit to generate random four-bit numbers to light up a row of the LED matrix.

2. To design a control circuit for the player to use left shift and right shift buttons and the glowing LED shifting accordingly.

3. Checking the collision of the glowing player LED and the glowing obstacle LED on the last row of the LED matrix.

4. To decrement the number of lives for each collision and increment the score for avoidance of collision.

5. To propagate the four-bit binary number pattern for LEDs through the columns of the LED matrix.

6. To keep a one row gap between each binary pattern for the player to move to a safer position after each obstacle row.

7. To design a reset logic to stop the game after three lives are lost, and restart it on pressing of the reset button.

8. To design a small circuit to display a four bit binary number as three LEDs, which turn off one by one following each loss of life.

9. To avoid binary number (1111)2 as a row obstacle which makes the game impossible for the player.

2.2 Solutions to Problems

Page 10: Hurdle Race Game

4

Chapter 2 Design

- Given above is our random number generation logic. The IC numbered 74163 is a four bit counter. We have jumbled up its output sequence so that the number generation does not follow a pattern. Hence solving problem statement 1.

- When the number (1111)2 is generated as output from the counter, we have used a four-input NAND gate to give output zero for that number and used it input the IC’s active LOW load input and also fed it into the Quad 2 to 1 MUX(74157) select line to select manually fed (0000)2 for the LED matrix instead. Hence solving problem statement 9.

- We have used another Quad 2 to 1 MUX (74157) to select generated random number on positive

clock edge and select number (0000)2 on negative clock pulse by feeding clock signal into the select line of the MUX. Hence solving problem statement 6.

Page 11: Hurdle Race Game

5

Chapter 2 Design

- We have used six universal shift registers (74194) in parallel loading mode in order to propagate the obstacle pattern through our LED matrix, connecting the output of one register to the input of the next. Hence solving problem statement 5.

- We have used an up/down counter (74193) to increment/decrement the position binary number of the player through 4 possible states (00, 01, 10 and 11)2. Then we have used the output of the counter as input to a Dual 2 to 4 line decoder (74155) which selects through the possible player positions (0001, 0010, 0100, 1000)2 corresponding to the respective select line input from the counter. Hence solving problem statement 2.

- The below AND gates are used to check collision on the bottom-most level of the LED matrix and the second level NOR gate outputs 1 if any of the AND gate outputs is 1 (meaning collision has occurred, and thus decrement lives count). The AND gate inputs at pins 2, 5, 10 and 13 are the player LED positions and the inputs at pins 1, 4, 9 and 12 are the bottom most row of the LED

Page 12: Hurdle Race Game

6

Chapter 2 Design

matrix. The upper two level OR gates followed by the third level AND gate check if the collision was avoided and thus increment score. Hence solving problem statement 4.

- The reset button is used as master reset to the clocks(using tristate buffers), to all the shift registers, to the player control circuit, to the lives and score counting circuit. Hence solving problem statement 7.

- The lives decrementing circuit (by counter IC 74193) is shown above. The least significant bit Q0 and Q1 will have values (11 for 3 lives, 10 for 2 lives, 01 for 1 life, 00 for game over). A simple logic for all three life indicator LEDs is used, where the topmost LED will turn off as lives count goes from (11)2 to (10)2 as AND gate output will become 0 as soon as one input is 0. The second LED will turn off as soon as Q1 changes from 1 to 2, after loss of second life, and third LED will turn off when both inputs are 0. A NOR gate also shown in the figure is used to hang the clocks (using tri state buffers) when all three lives are lost. Hence solving problem statement 8.

Page 13: Hurdle Race Game

7

Chapter 2 Design

2.3 Complete Logic Diagram

Page 14: Hurdle Race Game

8

Chapter 3 Hardware Implementation

Chapter 3: Hardware Implementation

3.1 Detailed Schematic of Design and its Description Draw the schematics of your design using Proteus or otherwise. Using the Pin numbering, IC

numbers. Give the numbers of ICs used as well. List all the components like resistors, diodes

etc.

Page 15: Hurdle Race Game

9

Chapter 3 Hardware Implementation

3.2 Details of ICs used

a. 74194 [4-bit Universal Shift Register]

Function Table

Schematic

b. 74163 [4-bit binary counter]

Function Table

Page 16: Hurdle Race Game

10

Chapter 3 Hardware Implementation

Schematic

c. 74157 [Quad 2 to 1 MUX]

Function Table

Schematic

Page 17: Hurdle Race Game

11

Chapter 3 Hardware Implementation

d. 74155 [Dual 2 to 4 line Decoder]

Function Table

Schematic

e. 74193 [4-bit Up/Down Counter]

Function Table

Page 18: Hurdle Race Game

12

Chapter 3 Hardware Implementation

Schematic

f. 7448 [BCD to 7-segment Decoder]

Function Table

Schematic

Page 19: Hurdle Race Game

13

Chapter 3 Hardware Implementation

g. 555 [Timer IC]

Function Table

Schematic

h. 74125 [Quad- Tristate Buffer]

Function Table

Page 20: Hurdle Race Game

14

Chapter 3 Hardware Implementation

Schematic

i. 7408 [Quad- Two input AND gate]

Function Table

Page 21: Hurdle Race Game

15

Chapter 3 Hardware Implementation

Schematic

j. 7432 [Quad- Two input OR gate]

Function Table

Page 22: Hurdle Race Game

16

Chapter 3 Hardware Implementation

Schematic

k. 7425 [Dual- 4 input NOR gate]

Function Table

Page 23: Hurdle Race Game

17

Chapter 3 Hardware Implementation

Schematic

l. 7404 [Hex- NOT gate]

Function Table

Page 24: Hurdle Race Game

18

Chapter 3 Hardware Implementation

Schematic

m. 7413 [Dual- 4 input NAND gate]

Function Table

Schematic

Page 25: Hurdle Race Game

19

Chapter 3 Hardware Implementation

3.3 Details of Other Components used like diodes, transistors, resistors

etc.

Capacitors:

10nF – 2 pieces

470uF – 1 piece

820uF – 1 piece

100uF – 1 piece

Resistors:

1 kohm – 4 pieces

100 ohm – 9 piece

Page 26: Hurdle Race Game

20

Chapter 3 Hardware Implementation

3.4 Hardware Issues / Results/ Observations

During hardware implementation, several issues were faced. After patching of

every block of the circuit, we used to test and debug our block for correct

results. The block worked correctly some times, other times it did not. We then

traced the error and removed it. Most of the times, the error was due to our our

human mistakes, however other times, some ICs would not perform their

functions properly and were replaced. The patching of the circuit took a lot of

time, and later when the circuit was working, we levitated the display to make

our project look more presentable.

Page 27: Hurdle Race Game

21

Chapter 4 Project Applications

Chapter 4: Project Applications

Our Project was a game, whose construction taught us a lot about Digital Logic Design in the most testing ways possible. However practical applications of this project are limited. It can be used as a recreational activity, as a cool gadget to show the practical applications of Digital Logic Design to new students.

However, the various blocks of our designed game can be individually used in the design of various other components. The player control circuit block can be modified and used in simulating vehicle testing machines.

Similarly, the random number propagation circuit can be modified to be used again in the vehicle design simulator to be displayed as road traffic vehicles. The collision logic block may also be used here.

Page 28: Hurdle Race Game

22

Chapter 5 Future Recommendations

Chapter 5: Future Recommendations

Our Project can be improved and perhaps be implemented on PCBs instead of breadboards to reduce hardware costs and the complexity look. Perhaps a circuit can be added to increase the difficulty level of the game as a player progresses through. It may even be split into a multiplayer mode to work as a scoring competition between two players. Even a high-score saving capability can be added to be used in a storage element and displayed on demand.

Page 29: Hurdle Race Game

23

Chapter 6 Bill of Materials

Bill of Materials

Give the bill of materials. Mention the IC name, cost and numbers of IC used. Mention the total cost of

project. Tabular form required.

Particulars Quantity Unit Price Amount

Breadboard 7 150 1050

Wires 15 m 10 150

Push button 4 20 80

7 segment CC Display 2 15 30

LM555 2 10 20

7448 2 45 90

74163 3 30 90

74193 5 30 150

74155 1 25 25

74157 2 25 50

74194 7 35 245

7408 2 20 40

7432 2 15 30

7404 2 15 30

7413 1 25 25

74125 1 30 30

Cap 470uF 1 5 5

Cap 820uF 1 5 5

Cap 100uF 1 5 5

Cap 10nF 2 2 4

Res 1kohm 2 0.5 1

Res 100ohm 10 0.5 5

LEDs 40 1 40

Net Total 2200

Page 30: Hurdle Race Game

24

Chapter 7 References

References / Bibliography

[www.datasheetarchive.com]

[www.google.com/images]

[www.google.com/web]