K. J. Somaiya College of Engineering, Mumbai-77 (A Constituent College of Somaiya Vidyavihar University) Department of Electronics Engineering Course Name: Electro-Mechanical Systems Semester: V Date of Performance: 27/08/2021 Batch No: A1 Faculty Name: Roll No: 1912017 Prof. Sandeep Hanumante Faculty Sign & Date: Grade/Marks: Experiment No: 3 Title: Interfacing of Hex-keypad with 8051 microcontroller. Aim and Objective of the Experiment: • Interface Hex-key pad using Hex-key pad controller (74922) at PORT1 of 8051 microcontroller. COs to be achieved: CO1: Identify and describe the key elements of electro-mechanical system. CO2: Design microcontroller based industrial applications. CO3: Understand the principles of various electric actuator systems. Theory: In this experiment we used 8051 microcontroller, IC 74922(keypad controller IC), 7 segment display (common anode) and a hex keypad. Connections: 1. We have to connect the hex keypad with the IC 74922 through bus. Then connect the A, B, C and D terminal of IC74922 to 8051 microcontroller port pins P1.0, P1.1, P1.2, P1.3 respectively. 2. Connect KBM of IC 74922 to ground through a 100uF capacitor and OSC to ground through 10uF capacitor. 3. Connect DA of IC 74922 to pin P3.2. 4. Connect OE* to P1.7. 5. Connect common anode 7 segment display to 8051 microcontroller. So, after uploading the .hex file, as soon as a button on hex keypad is pushed and released the respective HEX number will be displayed on the 7-segment display. EMS Lab Semester: V Academic Year: 2021-2022 K. J. Somaiya College of Engineering, Mumbai-77 (A Constituent College of Somaiya Vidyavihar University) Department of Electronics Engineering Circuit Diagram/ Block Diagram: Stepwise-Procedure: 1. Design circuit and connect it as shown in the circuit diagram using Proteus simulator. 2. Write an Embedded-C program to achieve the aim. 3. Compile the program and generate HEX file using Keil microvision-3 IDE. 4. Run the hardware and take scree shot of it to attach in the output. Embedded-C program: C51 COMPILER V9.60.0.0 HEX_PAD PAGE 1 08/27/2021 17:11:56 C51 COMPILER V9.60.0.0, COMPILATION OF MODULE HEX_PAD OBJECT MODULE PLACED IN .\Objects\hex_pad.obj COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE hex_pad.c OPTIMIZE(8,SPEED) EMS Lab Semester: V Academic Year: 2021-2022 K. J. Somaiya College of Engineering, Mumbai-77 (A Constituent College of Somaiya Vidyavihar University) Department of Electronics Engineering BROWSE DEBUG OBJECTEXTEND PRINT(.\Listings\h -ex_pad.lst) TABS(2) OBJECT(.\Objects\hex_pad.obj) line level source 1 #include <reg52.h> 2 #include <intrins.h> 3 #define kbdport P1 4 sbit kbd_en=P1^7; 5 sbit int_0=P3^2; 6 void isrint0(void); 7 unsigned char keycode; 8 unsigned char ss_code[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x98,0x88,0x83,0xc6,0xa1,0x86,0x8e}; 9 10 void isrint0(void) interrupt 0 11 { 12 1 kbd_en=0; 13 1 keycode=kbdport; 14 1 keycode=keycode&0x0f; 15 1 kbd_en=1; 16 1 P2=ss_code[keycode]; 17 1 } 18 19 20 21 void main(void) 22 { 23 1 SP=0x50; 24 1 kbdport=0x0f; 25 1 kbd_en=1; 26 1 int_0=1; 27 1 IE=0x81; 28 1 IT0=1; 29 1 last: goto last; 30 1 } MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 51 ---CONSTANT SIZE = ---- ---- EMS Lab Semester: V Academic Year: 2021-2022 K. J. Somaiya College of Engineering, Mumbai-77 (A Constituent College of Somaiya Vidyavihar University) Department of Electronics Engineering XDATA SIZE = ---- ---PDATA SIZE = ---- ---DATA SIZE = 17 ---IDATA SIZE = ---- ---BIT SIZE = ---- ---END OF MODULE INFORMATION. C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S) EMS Lab Semester: V Academic Year: 2021-2022 K. J. Somaiya College of Engineering, Mumbai-77 (A Constituent College of Somaiya Vidyavihar University) Department of Electronics Engineering Observation Table/Output snap of program: EMS Lab Semester: V Academic Year: 2021-2022 K. J. Somaiya College of Engineering, Mumbai-77 (A Constituent College of Somaiya Vidyavihar University) Department of Electronics Engineering Post Lab Subjective/Objective type Questions: 1. What is disadvantage of interfacing Hex-key pad without key-pad controller? Answer: IC 74922 is used as a key-pad controller in above experiment. Generally, microcontroller have limited number of input/ output pins so by connecting the hex keypad directly with the microcontroller would require 8 I/O pins. But by using the key-pad controller IC the no of pins used reduces to only 4 i.e.by using keypad controller would save I/O pins. The key-pad controller is also used to interrupt the microcontroller. Conclusion: In this experiment we learned how to us a keypad controller to interface a Hex keypad to 8051 microcontroller and display the respective key press on hex keypad on to a 7 segment display. Signature of faculty in-charge with Date: EMS Lab Semester: V Academic Year: 2021-2022