rock paper scissors lizard spock - 8085...

18
1 EC-316 MICROPROCESSORS LAB ROCK PAPER SCISSORS LIZARD SPOCK PARITOSH GAUTAM (117/ec/13) & SAHIL GUPTA (148/ec/13) ELECTRONICS AND COMMUNICATION DEPARTMENT NETAJI SUBHAS INSTITUTE OF TECHNOLOGY DELHI UNIVERSITY

Upload: lamngoc

Post on 29-Apr-2018

225 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

1

EC-316 MICROPROCESSORS LAB

ROCK PAPER SCISSORS LIZARD SPOCK

PARITOSH GAUTAM (117/ec/13) &

SAHIL GUPTA (148/ec/13)

ELECTRONICS AND COMMUNICATION DEPARTMENT

NETAJI SUBHAS INSTITUTE OF TECHNOLOGY

DELHI UNIVERSITY

Page 2: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

2

GAME DESCRIPTION (INTRODUCTION)

Rock-paper-scissors-lizard-spock is a hand game played by two people, where players

simultaneously form one of the five shapes with an outstretched hand. The rules of the

game are as follows:-

1) Spock smashes scissors and vaporizes rock.

2) Scissors decapitates Lizard and tears Paper.

3) Lizard poisons Spock and eats Paper.

4) Rock crushes Lizard and destroys Scissors.

5) Paper disproves Spock and wraps Rock.

In this game, we have provided 5 switches for both the players. As soon as both the players

have pressed their switches, the corresponding LEDs glow. We have made sure that both

the LEDs glow when the two players have pressed their switches, to avoid any kind of

cheating. To decide the winner of the round we have provided both the users with a winners

LED. The LED of the winning player glows after a round has been played indicating which

player has won. In case of a draw, i.e. both the players press the same switches, then the

winner’s LEDs of the both the players glow.

PROJECT REALISATION (MOTIVATION)

We had planned to make this project as it was quite challenging and fun as well. We

researched about how we can realize this game using 8085 microprocessor. The project plan

was laid first so as to make a gantt chart of what is required and when it is required. After

the project was planned only then we started working on it according to it.

Page 3: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

3

ACKNOWLEDGEMENT

We are extremely grateful to Prof. D.V. Gadre for encouraging us throughout the entire

process of making this project. Without his guidance we wouldn’t have been able to

accomplish this project. We are also grateful to Mr. Akash Gupta for the much needed

guidance and help. We would also like to thank our parents and our friends especially

Gaurav Tyagi, Anshuman Mishra, Anirudh Rustagi and Rohan Anand for helping us

throughout.

Page 4: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

4

TABLE OF CONTENTS

S. NO. TOPIC

PAGE NO.

1. GAME DESCRIPTION (INTRODUCTION)

1

2. PROJECT REALISATION (MOTIVATION)

2

3. ACKNOWLEDGEMENT

3

4. BOM

5

5. SCHEMATIC

6

6. BOARD LAYOUT

7

7. BLOCK DIAGRAM

8

8. CODE FLOW DIAGRAM

9

9. INPUTS AND OUTPUTS

10

10. RAM AND ROM

11

11. THE DECODEING CIRCUIT

12

12. POWER

13

13. THE 8085 MICROPROCESSOR

14

14. PROJECT IAGES

15

15. TESTING THE BOARD

16

16. PROBLEMS FACED

16

17. CONCLUSION

17

18. BIBLIOGRAPHY

17

Page 5: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

5

BOM

S NO. NAME OF COMPONENT QUANTITY

1. RESISTORS 33

2. CAPACITORS 12

3. 8085 1

4. 8255 1

5. 74573N 1

6. DECODER-74138N 1

7. 32K EEPROM(28256) 1

8. 32K RAM(62256) 1

9. RED LEDS 14

10. MINI USB PORT 1

11. EEPROM PROGRAMMER 1

12. SLIDE SWITCH 1

13. PUSHBUTTONs 12

14. BERG STRIP

15. NOT GATE 7404 1

Page 6: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

6

SCHEMATIC

Page 7: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

7

BOARD

LAYOUT

Page 8: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

8

BLOCK DIAGRAM

Page 9: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

9

CODE FLOW DIAGRAM

Page 10: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

10

INPUTS AND OUTPUTS

The input is given through switches. There are a total of 12 switches used in our

project. One is for reset, one is for testing purposes (example Sid-Sod) and the remaining

10 switches are part of our RPSLS game. The switches act as inputs for the 8255. Port B

and lower bits of Port C are used as input Ports on 8255.

The output of the project is given through 5mm red LEDs. There is a red LED to show

that power has been supplied to the board, one red LED for testing purposes (Sid-Sod), 10

red LEDs for their corresponding switches, and the remaining two LEDs to indicate the

winner of the game. The output is also connected through the 8255. The 12 LEDs used for

output are connected to Port A and upper bits of Port C of the 8255.

There is only one latch used in our project – for address decoding.

Page 11: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

11

RAM AND ROM RAM or Random Access Memory is used basically to store data while running the

program. We can both read and write data into it. In our project we have used the RAM majorly to store game data. This memory is volatile, and hence when the power is turned off, all its contents are destroyed.

ROM or Read Only Memory is the main memory of the brain 8085. 8085 fetches instructions saved sequentially in the ROM. The entire program that the 8085 has to execute is saved on the ROM. We can only read from the ROM once it is connected to the board. We have used EEPROM which is Electrically Erasable that means the information stored in this memory can be altered using electrical signals. Unlike RAM its contents do not get destroyed when power is turned off and to write data into it we need an EEPROM programmer.

RAM and ROM come in various sizes. We have chosen 32K ROM (28256) and 32K RAM (62256). Our work could have been easily accomplished by 2K ROM and 2K RAM but to be on the safe side we took a larger memory. A larger memory provides a provision for extension of code as we have provided hardware provision for single player mode.

Page 12: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

12

THE DECODING CIRCUIT The decoding circuit is basically used to enable the RAM, ROM and the I/O devices at

the right time.

A decoder identifies each combination at its input and decodes it into its binary

equivalent. It is commonly used in interfacing I/O peripherals and memory. Decoders are also in built in memory chip to select specific registers in it.

In our project we have used the 3x8 decoder IC 74LS138.

The A15 address line has been used to select the RAM and ROM in the project. When A15 is high, ROM is selected and when A15 is low, RAM is selected.

The 8085 pins IO/M*, RD* and WR* have been used as input to decoder 74138.

IO/M* RD* WR* LOGIC

0 0 1 RAM AND ROM OUTPUT ENABLE

0 1 0 RAM WRITE ENABLE

1 X X 8255 ENABLE

1 0 1 8255 RD* ENABLE

1 1 0 8255 WR* ENABLE

The decoder circuit can be replaced by use of logic gates.

Page 13: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

13

POWER

The circuit can be powered using a laptop or a power bank via a mini USB cable. A mini USB

port has been provided on the board for this purpose. All the ICs are powered by this power

source of 5V only and no secondary power source is required at all for the proper

functioning of this project. Decoupling capacitors have been placed parallel to the power

input of each IC.

Page 14: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

14

THE 8085 MICROPROCESSOR

The 8085 microprocessor is the heart of the project and does the most important

part of communicating with other components to do what it does, make the project

work. It fetches the instructions from memory, decodes them and takes action

according to those instructions. 8085 is responsible for displaying output, taking

inputs, decoding inputs as well as handling interrupts. For this reason separate male

bergstrips have been provided on board that are connected to each pin of 8085 and

helps (a lot actually) during debugging process. Below are some of the pictures of

8085 and the RPSLS board in the making.

Page 15: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

15

PROJECT IMAGES

Page 16: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

16

TESTING THE BOARD

Testing is an integral part of the final project completion. We hence took the following

measures: Checked all connections using a multimeter.

Checked all control signals on the oscilloscope.

Checked the functioning of 8085 on the oscilloscope.

Segregated working LEDs using multimeter and then soldered them.

Tested the SID-SOD program.

Tested the inputs and output of the 8255 for any discrepancies.

PROBLEMS FACED

DELAY DUE TO PCB MANUFACTURER: The PCB manufacturers delay in delivering our board led to some lag, as without the board, it was impossible to get started.

DELAY DUE TO A LOGICAL MISTAKE: While placing the LEDs for the corresponding switches, we didn’t notice that we are not placing the correct LED in front of its respective switch. This caused us a lot of delay as, at first, we were not able to figure out the mistake in our board. And when we got to know about the mistake, it complicated our code a lot.

GHOST LEDs: While testing our code by burning it onto the ROM, random LEDs were glowing at a very frequent rate. This problem was solved by changing the 8255 on our board.

ROM ERROR: The most frustrating error in our project. The 28-pin broad IC base which we soldered on our board for our ROM was very loose, because of which, when we tried testing our code, the board didn’t work. It took us almost 24 hours to figure this out, and all this time we tried to make amends in our code, which wasn’t wrong in the first place. This problem was solved by using a machine base, which helped in the tightening of the IC base.

Page 17: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock

17

CONCLUSION

We succeeded in finishing our project with amazing results. This experience has been

wonderful and it taught us to be patient when things aren’t going your way and to work

together without getting on each other’s nerves. It also taught us to manage time. We have also provided a toggle switch on our project for a single player mode in which the second player is 8085 microprocessor itself. Due to lack of time management and project delays we were unable to implement it in the available time. However, if we get a chance we would definitely like to upgrade the project with this feature.

BIBLIOGRAPHY

Ramesh S. Gaonkar: “Microprocessor Architecture, Programming, and

applications with the 8085”

www.alldatasheet.com

www.sparkfun.com

Page 18: ROCK PAPER SCISSORS LIZARD SPOCK - 8085 Projects8085projects.in/wp-content/uploads/2016/12/117_148_report.pdf · 2 GAME DESCRIPTION (INTRODUCTION) Rock-paper-scissors-lizard-spock