Prof. D.V.Gadre Lalit Goel (75/EC/11) Manshul Arora (78/EC/11)
Submitted on :
30/MAY/2014
Name of the Institute:
Netaji Subhas Institute of Technology (NSIT)
ACKNOWLEDGEMENT
We are taking this opportunity to express our profound gratitude and regards to Prof. D.V.Gadre for his exemplary guidance, monitoring and constant encouragement throughout the course of this project. His lucid explanation of the concepts helped us to implement them practically in this project. The project allowed us to explore the 8085 microprocessor beyond the book. We would also like to thank our friend, Malay Rautela, for helping us in times of need. - Lalit Goel - Manshul Arora
CONTENTS
S.No. Topic Page No.
1. Project Title 1
2. Objective 1
3. About the Project 1
4. Block Diagram 2
5. Components used 3
6. Tools used 4
7. Schematic 5
8. Board Layout 12
9. Project Code 15
10. Simplified Flow Chart 19
11. Proposed Timeline 20
12. Actual Timeline 21
13. References 23
1. Project Title: Keypad Code/Password Detector
2. Objective: The main aim of this project is to design a keypad password detector using 8085 microprocessor. The password is static and cannot be changed by the user.
3. About the Project:
In this project, a 4*4 matrix keypad is interfaced to the microprocessor system through a MM74C922 keypad encoder IC. The user enters the 4-digit password through the keypad whenever the Enter Password LED lights up. One button in the keypad is used as the Submit Password button. When keypad buttons are pressed, the encoder generates an RST7.5 interrupt to the microprocessor. The interrupt service routine determines which digit is pressed and stores the corresponding data in RAM. Also, 4 LEDs glow to indicate that 4 digits have been pressed. On pressing the Submit button, the stored password is compared with the actual password. A green or red LED then glows to indicate whether the password is correct or incorrect. The number of attempts is indicated by LED indicators and after four unsuccessful attempts; the system gives a warning through a buzzer.
4. Block Diagram: A block diagram for the project in a broad sense is presented below:-
8085 P
Input Through 4*4 Matrix Keypad
MM74C922 Keyboard Encoder
RAM (32 kB)
EEPROM (32 kB)
Outputs using LEDs and buzzer connected to latches
5. Components used:
COMPONENTS QUANTITY MODEL 8085 (8-bit microprocessor) 1 8085AH EPROM (32K X 8 bit) 1 27256 SRAM (32K X 8 bit) 62256 16 key Encoder 1 MM74C922 8 bit D latch bus driver 3 74HCT573N Quad 2 input NOR gate 1 74HCT02N Quad 2 input OR gate 1 74HCT32N 3 to 8 line decoder/multiplexer active low output 2 74HCT138N Crystal (Frequency = 4 MHz) 1 XTAL/S Resistors 22 Resistors of different values have been used with LEDs of different colours. (Package 0204/7, 1/8 W) Pull-up resistors=10 k Pull down resistors = 680 Capacitors 15 Decoupling Capacitors = 0.1 F
Capacitor connected to crystal = 22 pF
Capacitors after the power jack = 10 F (electrolytic) and 0.1 F (ceramic)
Capacitors connected to
MM74C922 = 1 F and 0.1 F
Leds (3mm and 5mm) 13 LEDs of different colours have been used, namely red, green, blue and yellow Power jack 1 Buzzer 1 F/QMBIII
6. Tools used:
Software tools:
1. EAGLE 6.4.0 for schematic and board layout 2. 8085 Simulator IDE by OshonSoft 3. UniPro software
Hardware Tools:
1. Soldering Iron 2. Solder 3. Multimeter 4. +5V DC Power Supply 5. UniPro Programmer 6. Cutter, Tweezer, Hand Files, etc.
7. Schematic:
8085 Basic Connections:
8085 is connected to RAM and EPROM using its data bus and one Latch for latching the lower order adress from the multiplexed address and data bus. The interrupts that were not required have been grounded through pull-down resistors. The READY pin is set to logic 1 through a pull up resistor. An LED has been attached to SOD pin and a push button has been attached to SID pin for testing purposes. Appropriate Reset circuitry has been used.
The memory read, memory write, I/O read and I/O write control signals have been generated using a decoder as shown below:
A second decoder and 2-input NOR gates have been used to generate select signals for two output ports.
Power supply:
The output from a +5V power supply is connected at CON1. Capacitors are used to eliminate noise and generate a DC supply. Electrolytic capacitor (10 F) is used to eliminate low-frequency noise, while ceramic capacitor (0.1 F) is used to eliminate high frequency noise. Thus, a pure DC voltage is obtained. LED is used to indicate the presence of power. On further observing the circuit, it was realised that the voltage drop across the diode varied with the current and hence, at the diode terminals on the board, a jumper wire was connected instead of the diode.
Output Ports:
This is our output port 1 which consists of various LEDs and a buzzer connected to a latch. The LEDs indicate the following function: 1 Enter password. 2 No. of password key pressed. 3 Correct and Incorrect password.
Similarly, the output port 2 contains an LED indicator which indictaes the number of attempts left.
Latch is used for holding output data. Its enable pin is always grounded and its chip select pin is selected through control signal as generated in control part.
Input through Keypad:
IC2 (MM74C922) is used to generate interrupt when a key is pressed from a keypad. When a key is pressed its value is stored in some memory location and is used after some time for comparison. The MM74C922 keypad encoder implements all the logic necessary to interface a keypad to a digital system. The encoder finds if any connections are being made in the keypad and outputs four bits corresponding to the state of the keypad. One of the output bits, the "Data Available" bit, is high when a button is being pressed and low when no button is being pressed. The other four output bits are data bits which output a number depending on which of the sixteen buttons is being pressed. Figure 1 shows a detailed diagram of how the encoder is used. The eight inputs from the keypad are connected directly to the encoder. The "Data Available" bit and the data bits are on the right side of the diagram. The two capacitors located at the KBM and OSC pins of the encoder are used for eliminating key bouncing. Figure 2 shows the debounce period versus the capacitor value at the KBM input in microfarads. Using this graph, a capacitor value of 1 F was chosen. This gives a sufficient debounce period that will eliminate all key bouncing but is not so large that it requires the user to hold the button down a long time before the encoder recognizes the input. Finding the value of the capacitor at the OSC pin is just a matter of dividing the capacitance of the KBM capacitor by 10. Therefore, a capacitor with a value of 0.1 F is used.
Figure 1: Diagram of Keypad and Keypad Encoder
7. Board Layout:
8. Project Code:
;Crystal Frequency 4 MHz .ORG 0000H JMP START1 .ORG 003CH JMP ISR START1: DI LXI SP,0000H ;Initialising Stack Pointer MVI C,04H ;Register C holds the number of attempts CALL START2 ;Subroutine to initialise the required RAM locations and ;LED Indicator CALL START3 ;Subroutine for initial setup EI NO_OPR: NOP NOP JMP NO_OPR ;Remains in the loop till interrupt occurs ISR: DI PUSH PSW PUSH H IN 02H ;Read Keypad ANI 0FH CPI 0FH ;Check if Submit button is pressed JZ SUBMIT STA 8000H ;Store the encoded data in a RAM location MOV A,B CPI 03H ;Check which digit is entered JZ DIG_1 CPI 02H JZ DIG_2 CPI 01H JZ DIG_3 CPI 00H JZ DIG_4 JMP RETURN DIG_4: LDA 8000H ; To compare Digit 4Th of entered password with stored STA 8004H. ; Digit of correct Password MVI A,00000111B OUT 00H JMP DIG_DONE
DIG_3: LDA 8000H ; To compare Digit 3 rd of entered password with stored STA 8003H ; Digit of correct Password MVI A,00001111B OUT 00H JMP DIG_DONE DIG_2: LDA 8000H ; To compare Digit 2nd of entered password with stored STA 8002H ; Digit of correct Password MVI A,00011111B OUT 00H JMP DIG_DONE DIG_1: LDA 8000H ; To compare Digit 1st of entered password with stored STA 8001H ; Digit of correct Password MVI A,00111111B OUT 00H JMP DIG_DONE DIG_DONE: DCR B RETURN: POP H POP PSW EI RET SUBMIT: LDA 8001H ;Submit button pressed CPI 00H JNZ WRONG LDA 8002H CPI 04H JNZ WRONG LDA 8003H CPI 08H JNZ WRONG LDA 8004H CPI 0CH JNZ WRONG RIGHT: MVI A,11111101B ;Password entered is correct OUT 00H HLT WRONG: MVI A,11111011B ;Password entered is incorrect OUT 00H DCR C CALL START2 MOV A,C CPI 00H JZ OVER
CALL DEL_5 CALL START3 POP H POP PSW EI RET OVER: MVI A,11111010B ;No. of attempts are over OUT 00H HLT START2: PUSH PSW MVI A,00H STA 8000H STA 8001H STA 8002H STA 8003H STA 8004H MVI B,03H LXI H,TABLE MOV A,L ADD C MOV L,A JNC NO_ADJ INR H NO_ADJ: MOV A,M OUT 01H POP PSW RET START3: MVI A,01111111B OUT 00H RET DEL_5: PUSH B ;Delay Subroutine PUSH PSW MVI D,02H LOOP1: LXI B,0FFFFH LOOP2: DCX B MOV A,B ORA C JNZ LOOP2 DCR D JNZ LOOP1 POP PSW POP B
Enter Password LED Glows User enters the 4-digit password and Submit button READ KEYPAD
READ KEYPAD Check whether entered password is correct PASSWORD is Incorrect SWITCH ON RED LED PASSWORD is Correct SWITCH ON GREEN LED END DECREMENT THE LED INDICATOR BY SWITCHING ON AN LED CHECK WHETHER WRONG PASSWORD HAS BEEN ENTERED 4 TIMES ISSUE A WARNING THROUGH BUZZER
10. Proposed Timeline:
Beginning Date End Date Duration Task 3 rd February 20 th February 18 days Studying the concepts integral to the understanding of the project Finalizing the circuit Submission of the list of ICs 21 st February 7 th March 15 days Preparation of Mid- Semester Exam Mid-Semester Exams 8 th March 17 th March 10 days Design the schematic 18 th March 31 st March 14 days Write the program 1 st April 30 th April 30 days Drilling, Soldering Testing Debugging
11. Actual Timeline:
Beginning Date End Date Duration Task 3 rd February 20 th February 18 days Studied the concepts integral to the understanding of the project Finalized the circuit
21 st February 7 th March 15 days Preparation of Mid- Semester Exam Mid-Semester Exams 15 th March 31 st March 17 days Designed a rough schematic Tested MM74C922 Keyboard Encoder on Breadboard Wrote the program 1 st April 13 th April 14 days Finalized the schematic 15 th April 23 rd April 8 days Board being manufactured by PCBPower
3 rd May 13 th May 10 days Soldering SID/SOD Testing working successfully Debugging code Main code testing Working satisfactorily except some minor glitches
1. The month of January was dedicated to finding Project Idea and preparing Proposal.
2. Before the end of February, the circuit was finalized conceptually and work on schematic had begun. 3. The schematic was finalized till 31 st March. 4. We worked on the board file till 8 th April and placed the order on 13 th April (delivery within 7 working days) after incorporating some more changes. 5. The board came on 23 rd April as expected. 6. We completed soldering and tested the working of SID/SOD pins and output LEDs till 5 th May. 7. From 7 th May to 13 th May, we tested the main code multiple times, incorporating some changes each time. The project worked satisfactorily.
REFERENCES : 1. Microprocessor , Architecture, Programming , and Application with 8085 by Ramesh Gaonkar. 2. http://en.wikipedia.org/wiki/Intel_8085 3. https://sites.google.com/site/imnishantg/projects 4. https://sites.google.com/site/colordetector8085/home/schematics