Keyboard Interfacing with 8051 microcontroller

22

Transcript of Keyboard Interfacing with 8051 microcontroller

Page 1: Keyboard Interfacing with 8051 microcontroller
Page 2: Keyboard Interfacing with 8051 microcontroller

CONTENTS: 1.Introduction 2.Working principle

3. Components required

4. Programming for AT89C51 microcontroller

5. Application

6.Results and future implementations.

Page 3: Keyboard Interfacing with 8051 microcontroller

Keyboard is one of the best input device now a days. From very ancient time keyboard was used to get proper input in the machine.

Interfacing microcontroller with keyboard makes it faultless and make input rate faster. Whether the input is any numeric or any alphabet microcontroller breaks those input into hex code and with the help of lookup table and proper programming language it helps to give a prompt input from the users.

Introduction

Page 4: Keyboard Interfacing with 8051 microcontroller

1.Christopher Latham Sholes invented the modern QWERTY keyboard in the 1870s

2.Herman Hollerith developed the first keypunch devices

3.In the 1930's electric typewriters were invented.

4.In 1936, August Dvorak patented a new layout to Dvorak keyboard.

5.Personal Computers keyboard in 1970's

6.XPeRT is a keyboard Built in 2003 for Speed ..... AND ...... easy transition from Qwerty.

04/17/23

History

Page 5: Keyboard Interfacing with 8051 microcontroller

About Our Work 1.Matrix keypads are well known for their simple architecture.

2.Interfacing a hex keypad to 8051 microcontroller. To build this project

we use Hex keypad, a 8051 microcontroller, display it in 7 segment display.

3.Here we are using AT89C51.we can also use any number of seven segment display or LCD module where encoder and multiplexer is required.

designing of the basic keyboard.

04/17/23

Page 6: Keyboard Interfacing with 8051 microcontroller

Hex keypad 1.Hex keypad,16 key-from 0 to 9 and A to F2.Matrix form is required to reduce the pin count in microcontroller.

Row

Column

Construction of Hexkeypad

Page 7: Keyboard Interfacing with 8051 microcontroller

To Detect A Key

Two Approaches 1.column scanning 2.row scanning

We are using column scanning.

Making each row 1 and others 0 and then scan the each column

If any switch pressed corresponding column's sense value is 0

The pressed switch make the corresponding column and row shorted.

Tow scanning is just the opposite of the column scanning technique.

Page 8: Keyboard Interfacing with 8051 microcontroller

Whole Arrangement

Page 9: Keyboard Interfacing with 8051 microcontroller

Components RequiredAT89C51 Microcontroller:-8-bit CPU

4 KB of on-chip program memory

128 bytes of on-chip data RAM

Four ports of eight bits each

Two 16-bit timers

Full duplex serial port

On-chip clock oscillator

Page 10: Keyboard Interfacing with 8051 microcontroller

The 7-segment Display:-

Common cathode

diodes require positive voltage

Common anode

diodes require negative voltage

Both works in forward bias

Programming should be done according to the diode we use in display.

Page 11: Keyboard Interfacing with 8051 microcontroller

Components:-

1.17 piece tact switch

2.eight 330 ohm registers

3.one 8.2 KΩ register

4.11.0592 crystal oscillator.

5.33 pf capacitor.

6.10 mf capacitor.

7.5 volt power supply.

Use:-

1. 16 tact switch and 1 for reset2. Control the current in seven

segment display

3. Use to create the time constant with capacitor

4. Use to create the clock5. Use in clock generation6. For time constant purpose7. To give life to the arrangement

Other Components

Page 12: Keyboard Interfacing with 8051 microcontroller

04/17/23

ORG 00HMOV DPTR,#LUT // moves starting address of LUT to DPTRMOV A,#11111111B // loads A with all 1'sMOV P0,#00000000B // initializes P0 as output port BACK:MOV P1,#11111111B // loads P1 with all 1's CLR P1.0 // makes row 1 low JB P1.4,NEXT1 // checks whether column 1 is low and jumps to NEXT1 if not low

Program

Page 13: Keyboard Interfacing with 8051 microcontroller

MOV A,#0D // loads a with 0D if column is low (that means key 1 is pressed) ACALL DISPLAY // calls DISPLAY subroutineNEXT1:JB P1.5,NEXT2 // checks whether column 2 is low and so on... MOV A,#1D ACALL DISPLAYNEXT2:JB P1.6,NEXT3 MOV A,#2D ACALL DISPLAYNEXT3:JB P1.7,NEXT4 MOV A,#3DACALL DISPLAYNEXT4:SETB P1.0 CLR P1.1 JB P1.4,NEXT5 MOV A,#4D ACALL DISPLAY

Page 14: Keyboard Interfacing with 8051 microcontroller

NEXT5:JB P1.5,NEXT6 MOV A,#5D ACALL DISPLAYNEXT6:JB P1.6,NEXT7 MOV A,#6D ACALL DISPLAYNEXT7:JB P1.7,NEXT8 MOV A,#7D ACALL DISPLAYNEXT8:SETB P1.1 CLR P1.2 JB P1.4,NEXT9 MOV A,#8D ACALL DISPLAYNEXT9:JB P1.5,NEXT10 MOV A,#9D ACALL DISPLAYNEXT10:JB P1.6,NEXT11 MOV A,#10D ACALL DISPLAYNEXT11:JB P1.7,NEXT12

Page 15: Keyboard Interfacing with 8051 microcontroller

04/17/23

MOV A,#11D ACALL DISPLAYNEXT12:SETB P1.2 CLR P1.3 JB P1.4,NEXT13 MOV A,#12D ACALL DISPLAYNEXT13:JB P1.5,NEXT14 MOV A,#13D ACALL DISPLAY

NEXT14:JB P1.6,NEXT15 MOV A,#14D ACALL DISPLAYNEXT15:JB P1.7,BACK MOV A,#15D ACALL DISPLAY LJMP BACK DISPLAY:MOVC A,@A+DPTR // gets digit drive pattern for the current key from LUT MOV P0,A // puts corresponding digit drive pattern into P0 RET

Page 16: Keyboard Interfacing with 8051 microcontroller

04/17/23

LUT: DB 01100000B // Look up table startshere DB 11011010B DB 11110010B DB 11101110B DB 01100110B DB 10110110B DB 10111110B DB 00111110B DB 11100000B DB 11111110B DB 11110110B DB 10011100B DB 10011110B DB 11111100B DB 10001110B DB 01111010B END

Page 17: Keyboard Interfacing with 8051 microcontroller

04/17/23

Main ProblemDebouncing Problem:

Switch contacts do not come to rest immediately after pressing.Processor sense multible key press due to multiple pulse generation.A human can not press and release a key in less than 20 ms.

Debouncing problem solution:

Hardware ApproachSoftware Approach

Page 18: Keyboard Interfacing with 8051 microcontroller

04/17/23

Other Problems We Faced

The voltage directly goes to the seven segment display.

The voltage in the two legs of crystal oscillator is totally different from the college kit.

Soldering is not up to the mark according to mriganka sir.

We burn the seven segment display twice giving 5v directly to it.

Burned the program in different pin in the microcontroller.

We tried lots of coding or program for the hexkeypad.

Page 19: Keyboard Interfacing with 8051 microcontroller

Result & Future Work

Basic Calculator:

Here we can use LCD module instead of seven segment display.

Here we can perform and display various operations like addition, substraction, multiplication and division.

Page 20: Keyboard Interfacing with 8051 microcontroller

04/17/23

Multiple Display Device:Here we can use multiple seven segment display.

It can be used to display 2-digit numbers.

Page 21: Keyboard Interfacing with 8051 microcontroller

Projection keyboardsThat brings us to the similar but significantly older idea of projection keyboards, which do exactly that: project a virtual keyboard onto a surface and track your finger movements as you type. Depending on configuration, projection keyboards typically use a combination of lasers, sensors, and infrared beams to replicate a traditional QWERTY keyboard on a flat surface.The idea is to optimize portability by providing a full-size keyboard for mobile devices, while at the same time eliminating the pesky tradition of, you know, physical matter. (You can get projection pianos too, by the way.) It's all well and good, and the technology is improving every year. But surely we can all agree that the concept reached its zenith with the frankly awesome R2-D2 Virtual Keyboard.

Page 22: Keyboard Interfacing with 8051 microcontroller

THANK YOU