31
Netaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13 EC316 Microprocessor Lab Project Faculty Advisor: Professor D.V Gadre

8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

Embed Size (px)

Citation preview

Page 1: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

Netaji Subhas Institute of Technology

Odd-Even GameSanjana Goyal-156/EC/13

Vinshu Jain-193/EC/13

EC316 Microprocessor Lab Project

Faculty Advisor: Professor D.V Gadre

It’s a two player game wherein each of the players chooses one between odd or even. Next, a random

number is generated and depending on whether the

Page 2: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

number is odd or even, and what the other two players had chosen, there will either be a draw or

one of the two shall win. The player who wins has his score incremented and the one with the maximum score after a pre-decided number of rounds wins.

CONTENTS

1) Acknowledgements............................................................

....(3)

2) Introduction, Motivation and Justification..........................

(4)

3) Block

Diagram........................................................................(5)

4) Project

Description.................................................................(6)

5) Schematic..........................................................................

.......(10)

6) Board

Layout............................................................................

(11)

7) Gallery...............................................................................

.......(12)

Page 3: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

8) Main

Flowchart........................................................................

(13)

9) Flowchart for even

number.....................................................(14)

10) Flowchart for odd

number.......................................................(15)

11) Testing

Procedure.....................................................................

(16)

12) Timeline

Comparison...............................................................(18)

13) Conclusion.....................................................................

............(20)

14)

Bibliography.......................................................................

.......(21)

Page 4: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

ACKNOWLEDGEMENTS

With profound respect and gratitude, we would like to express our sincere thanks to Professor Dhananjay Gadre Sir for providing us with this wonderful opportunity to work on a project of our own and guiding and motivating us along the way with his invaluable and meaningful advice. We are indebted to Vinod Sir for providing us with all the components we needed and for patiently keeping up with our frequent calls to him and visits to the component room. We are immensely appreciative of the people in the CEDT lab who were ever ready to assist us when we required their help and for being so benevolent as to let us use the lab at times for our project.We are obligated to our batch-mates and friends for patiently hearing us out even with the most puerile of doubts, for selflessly helping us during the course of the project, for coming to our aid when we got stuck, for making us understand some concepts we found difficult to comprehend and lastly, for simply being there for us and keeping us spirited throughout.Last but not the least, this project would not have been completed had we both not been there for each-other; supporting and encouraging each-other at all times and for having such a nice camaraderie.

Page 5: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

INTRODUCTION, MOTIVATION AND JUSTIFICATION

IntroductionThe project is a simulation of a fairly lucid two player game, using the Intel 8085 microprocessor. It begins with two players entering their choice i.e. odd or even by pressing a push button. The entries are stored in suitable locations in the memory. Next, a random number is generated by initialising and updating an 8085 internal register whose content at the time a designated push button is pressed represents the number. Logic to determine whether the number is odd or even is incorporated and accordingly it is determined which, none or both of the players’ scores have to be incremented. After a few pre-decided numbers of rounds, the two player’s scores are compared and one with the maximum score is declared the winner.

Motivation:It was not desired to implement something too esoteric or complex using the Intel 8085 microprocessor. So, we decided upon a simple game which would be hassle-free to implement, would be readily understood by any third party and thus would prove enjoyable.

Justification:

Page 6: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

Having chosen to implement a game, we thought it would be better if it was an educational one. So, we came up with the idea of an Odd-Even Game, which can most easily help the younger kids distinguish between odd and even numbers and appreciate the pleasure involved in a game involving numbers, hopefully igniting in them a love for Mathematics.

BLOCK DIAGRAM

Page 7: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

PROJECT DESCRIPTION

Components Required

Page 8: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

1) MPU(8085)2) Programmable peripheral device(8255)3) 3 to 8 line Decoder(74138)4) 8-bit D-latch bus driver (74573 )5) NOT gate(7404)6) 8K EEPROM(2864)7) 8K RAM(6264)8) Alphanumeric LCD display9) 5mm LEDs10) Push buttons11) 6Mhz crystal12) Resistors and capacitors of appropriate values13) USB

Software Used1) EAGLE CAD2) 8085 Simulator IDE3) UNIPRO programmer for EEPROM

Tools Used1) Soldering Iron and Solder2) Tweezers, Cutter, Files3) Multimeter4) EEPROM Programmer Board5) Desoldering Iron6) Copper Wick 7) Jumper Wires

Concepts Involved Foldback memory: We have designated address lines

A13 and A14 as don’t cares and A15 line as the chip select

Page 9: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

line for the RAM and ROM. These two don’t care address lines can assume any one of the four combinations from 00 to 11. Thus, each combination can generate one set of complete addresses. The address range specified given by assuming all don’t cares at logic 0 is, by convention, specified as the memory address range of the system or the primary address; the remaining address ranges are known as either foldback memory or mirror memory.

Random Number Generation: We haven’t used any external interrupts for this process. Rather, we have used an internal register of 8085 which is being incremented. As soon as the designated push button is pressed, the incrementing is stopped and the content of the register is stored in the memory. This is the random number generated.

Debouncing: When a mechanical push button key is pressed or released, the metal contacts of the key momentarily bounce before giving a steady-state reading. Therefore, it is necessary that the bouncing of the key should not be read as an input. This key bounce is eliminated by debouncing technique, using either hardware or software. We have used the software technique in which, when a key closure is found, the microprocessor waits for 10 to 20 ms before it accepts the key as an input.

Input Combinations: We have assigned two push buttons to each of the two players which generate four combinations of outputs viz. Odd-Odd, Even-Even, Odd-Even and Even-Odd.

Combinations Player 1 Player 2Odd-Odd 0 1 0 1Odd-Even 0 1 1 0Even-Odd 1 0 0 1Even-Even 1 0 1 0

Page 10: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

Hardware Description Power Supply

The board is powered using an external 5v source which is supplied by the USB. A power LED incorporated alongside indicates that the system is receiving power.

CrystalA 6 MHz crystal is used to provide a clock frequency of 3 MHz. A 22pF capacitor is used to provide proper impedance matching between the 8085 and the crystal as the crystal does not load immediately.

MicroprocessorIt’s the most important component of the system. It fetches all the instructions from the memory, decodes and executes them. It has registers to store data and can select input/output devices for data transfer and programmable devices for interfacing. It consists of an address bus, multiplexed data bus and control lines along with an internal ALU logic.

LatchIt is used alongside the 8085 to latch the lower order addresses generated by the processor during the first T-state indicated by the ALE signal going high, to give the 16-bit address.

3 to 8 line DecoderIt is used to implement the decoding logic for the address lines. Its output determines which device is being selected by the 8085 and accordingly the address range of each.

A4 A3 A1 A0

Page 11: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

EEPROMWe have used ATMEL 28C64 EEPROM to store the code. It is present in the first 8K block of the 64K memory space available to 8085.

RAMThis is the volatile memory that resets its contents every time the power is turned on/off. Its function is to store the temporary data generated during the execution of the code. We have used HYUNDAI 6264 RAM which is present in the last 8K block.

8255It is a programmable, parallel I/O device which includes three programmable ports. We have used it in Mode 0 i.e. no handshaking is required. It interfaces the push buttons and the LCD display with the MPU. Port A has been used for input and port B for the output. Three pins of port C are connected to RS, R/W and Enable pins of the LCD.

Gist of the code

Page 12: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

SCHEMATIC

Page 13: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

BOARD LAYOUT

Page 14: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

GALLERY

Page 15: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

MAIN FLOWCHART

Page 16: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13
Page 17: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

FLOWCHART FOR EVEN NUMBER

FLOWCHART FOR ODD NUMBER

Page 18: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

TESTING PROCEDURE

Page 19: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

Once we were done soldering our board, the logical next step was to check whether our 8085 was working or not. For this purpose, we had to carry out the SID/SOD test. However, we were not as lucky as we faced the maximum number of problems at this stage only.

(a) We first checked whether +5v was appearing across SID and SOD pins or not and if the push-button and LED were working.

(b) Next, we carefully looked for any tracks that were shorted or broken.

(c) Then, we checked to make sure the ALE pin was high during the first T-state and that it was not receiving forced ground from anywhere, by using an oscilloscope.

(d) We analysed our schematic to make sure the decoding logic was correct and each IC was invoked.

(e) We checked the output of each IC using an oscilloscope.(f) We checked the values of all the resistors and capacitors

to make sure they were correct.After spending days trying out all the above among other minor tests, we finally realised where our problem lied. We had used a wrong package for our decoder which was only CMOS compatible. We checked the pin diagrams of both the wrong and correct decoder ICs and seeing that all the pins were same and only the pin numbers were different, we did mapping with the correct decoder IC using a zero-board and viola, our SID/SOD finally worked.

Our next step was to determine whether the general purpose programmable peripheral IC (8255) was working or not. For this purpose, we checked whether the port A was taking input and port B was displaying output according to our schematic by

Page 20: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

using an MSO. We concluded that the 8255 ports were all working perfectly fine. Having done that, we moved on to testing our RAM by writing a SID/SOD code using RAM instead of ROM. It did not work though. There were two possibilities. Either our RAM was damaged or there was a problem with the logic. We tested our RAM on another board and it worked perfectly fine and we multiple-checked our logic as well which seemed absolutely correct. There was a possibility the 7404 IC was not working and so we checked that as well by using male to female connectors and turned out there was no issue in that too. Next, just as an experiment, we wrote the code without using the stack-pointer. And it worked! So, we knew the stack-pointer register of our 8085 was damaged and all we had to do was replace it with another one which thankfully we had.Having done that, we tested our LCD using a sample LCD code to see whether it was displaying perfectly without any flickering and overwriting. Here, however, we did face some issues. Since the same problem arose by using other working LCDs, we knew the problem was with our code. We tweaked it in a number of ways by modifying the initialisation commands and inserting delays between each character. But to no avail. We then decided to move on to our logic for the game.This completed our hardware testing procedure.

Page 21: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

TIMELINE COMPARISON

Proposed Timeline

Beginning Date

End Date Duration Task

26th January 10th

February16 days Reading about all the

important concepts pertaining to the project

such as input/output, memory and LCD

interfacing, working of 8085 and 8255 and pin

diagrams of each IC to be used.

15th February 15th March 30 days Creating the schematic, getting it verified for any errors, finalising it and

generating the board file.16th March 24th March 9 days Placing the order for the

PCB and waiting for the board to arrive.

26th March 1st April 7 days Making a list of all the components that we

require and procuring the same.

3rd April 9th April 7 days Soldering all the components on the board

and testing the proper functioning of 8085 using

the SID/SOD test.

Page 22: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

10th April 19th April 10 days Devising the logic for the project, creating a first

draft of the code, debugging and creating subsequent drafts and finally having a code ready to test on the

system.20th April 4th May 15 days Testing the code on the

board and debugging.

Actual Timeline

Beginning Date

End Date Duration Task

1st February 16th

February16 days Reading about all the

important concepts pertaining to the project such as input/output, memory and LCD interfacing, working of

8085 and 8255 and pin diagrams of each IC to be

used.25th February 13th April 49 days Creating the schematic,

getting it verified for any errors, finalising it and

generating the board file.15th April 29th April 15 days Placing the order for the PCB

and waiting for the board to arrive.

26th April 1st May 6 days Making a list of all the components that we require

and procuring the same.2nd May 27th May 26 days Soldering all the components

on the board and testing the

Page 23: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

proper functioning of 8085 using the SID/SOD test.

28th May 30th May 3 days Devising the logic for the project, creating a first draft of the code, debugging and creating subsequent drafts and finally having a code

ready to test on the system.31st May 4th June 5 days Testing the code on the board

and debugging.

CONCLUSION

Engineering is the art or science of making practical. Till now, our course had been heavily leaning towards theoretical knowledge. Sure, theoretical knowledge helps one understand why one technique works where another fails. It shows the whole forest, builds the context, and helps one to strategise. However, practical knowledge helps one acquire the specific techniques that become the tools of one’s trade. It sits much closer to the actual day-to-day work. While theory is often taught in the ideal of vacuum, the practical is learned through the reality of life.Keeping this in mind, this great opportunity to gain practical knowledge was immensely satisfying. Designing our very own

Page 24: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

8085-based project from scratch, with little prior experience in practical projects was honestly a humongous and arduous task. It seemed like a daunting challenge and there were quite a few moments when we felt extremely helpless and hopeless. However, we tried our best to stay motivated and not get bogged down by failure. And, in the end, we realised how much we had learnt in the process.The numerous hardware issues that arose during the course of the project taught us a lot. Brainstorming for solutions proved a great exercise for the mind and we understood concepts more deeply which would never have been possible by just theoretical knowledge. We learnt to operate various devices, learnt about various electronic designing hacks and gained a deeper insight into the working of each component. To add to that, going to Lajpat Rai to purchase all the components was an experience in itself as we went there alone and searched for the shops all by ourselves. It may sound nondescript, but these little things all combined together and made working on this project a really remarkable experience.

BIBLIOGRAPHY

Hardcopy Resources1) Microprocessor Architecture, Programming, and

Applications with the 8085 by Ramesh Gaonkar, Fifth edition, Penram International Publishing.

Page 25: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13

ISBN 81-87972-09-22) The 8085 Microprocessor: Architecture, Programming and

Interfacing by K. Udaya Kumar, Pearson Education India, 2008.ISBN 978-81-7758-455-4

Online Resources

1) LCD Interfacing: http://www.circuitstoday.com/interfacing-16x2-lcd-with-8051

2) LCD Initialization: http://web.alfredstate.edu/weimandn/lcd/lcd_initialization/lcd_initialization_index.html

3) Introduction to LCD Programming:

http://www.8052.com/tutlcd4) 8255 Datasheet: http://www.alldatasheet.com/datasheet-

pdf/pdf/66100/INTEL/8255A.html

Page 26: 8085projects.in8085projects.in/.../2016/12/156EC13193EC13Report-1.docx · Web viewNetaji Subhas Institute of Technology Odd-Even Game Sanjana Goyal-156/EC/13 Vinshu Jain-193/EC/13