Vous êtes sur la page 1sur 32

chapter-1

INTRODUCTION
1.1 Introduction to Keypad:
A keypad is a set of buttons arranged in a block or "pad" which usually bear digits and other symbols
and usually a complete set of alphabetical letters. An alphabetic keypad is similar to a numeric keypad,
but it provides the complete set of alphabetical letters instead of numbers 0- 9. This article presents a
way to interface a keypad with 8051 microcontroller (AT89S52) to display alphabetical characters on an
LCD module. Such kind of systems is commonly used in mobile phones to write an SMS and other
texts. It can have further applications in displaying instant messages on other display systems such as
LED matrices or other multi-segment displays.

Description:
A 4x3 matrix keypad and a 16x2 LCD have been used here. Keypad and LCD are very commonly used
input & output devices, respectively. The connections in the circuit are as following: port P2 of
microcontroller AT89S52 is used as data input port which is connected to data pins (7-14) of LCD. P3^0,
P3^1 and P3^2 pins of microcontroller are connected to control pins RS, RW and EN of LCD. Port P0 is
used to take input from keypad.

Fig 1.1 Interfacing of Microcontroller with Keypad and LCD

1.2 Importance of Keypad:


Today's electronic equipment has a wide range of interface options. Custom Keypads allow
engineers nearly unlimited possibilities in control design, however those possibilities can lead to
problems if the interface is not carefully examined.
Every individual using computers or laptops understand the importance of keypads. Many
companies are into market providing latest and most updated version in keypads such as Intel, hp and
many more. Keypads or keyboards are most useful gadget as it allows you to feed data or edit data in the
computer system as per the requirement. Simple Example: 10-Digit Keypad

1.3 Importance Of Prototyping :


Why So Importance..?
Look at our phone then look at our computer. Both of them use 10-digit keypads and yet they
are upside down in relation to each other. People who use both are almost never confused. In fact that
most people who regularly use both telephones and computer numeric keypads are surprised when
someone points out they are different.
That is because we learn very quickly which is which and don't even notice they are different.
If our machine uses a 10-digit keypad, you will need to consider whether users are going to view it as
a phone-like device or a computer-like device. If you put a computer keypad on a phone device, we will
have a lot of angry users.
The example above is a perfect illustration of why custom keypads should always go through a
prototype phase. An interface design that looks great on paper might be a disaster in real life. Only
through in-person, hands-on testing can you be sure your interface design is a winner.
Prototypes can be produced quickly and easily allowing manufacturers to create a mockup of the
final device. They can quickly see how easy controls are to reach, how convenient they are to use, if the
feel of the keys is right and so on. Prototypes should be tested internally at first to fix the most glaring
flaws, but should always be tested at some point by potential customers. Your staff already knows how

the equipment should work.

A Nearly Tragic Example of Poor Design:


In a May 6, 2004 newsletter of the Institute for Safe Medicine Practices a glaring example of
poorly designed custom keypads was given. They reported problems with IV pumps that had a decimal
point key located near the zero key.
Several cases had been reported of nurses accidentally hitting zero instead of decimal. For
example a dosage of 1.5 ml/hour could become 105 ml/hour! Luckily, the errors were apparently noticed
before any harm came to the patients. A simple design change such as moving the decimal point away
from numeric keys would have made the IV pumps safer.
Even if our equipment doesn't have the potential for harm that a poorly designed IV pump
has, we still need to consider carefully the design of custom keypads. If nothing else, a confusing interface will lead to frustrated clients who might buy from our competitor next time.

Chapter-2
Block Diagram:

LCD
Fig 2.0 Block diagram of the alpha numeric keypad using AT89S52 microcontroller

2.1 Functioning of the block diagram:


In the block diagram shown above, we provide 230V AC to the Step-Down Transformer
which converts

230V AC into 12V AC .And with the help of Bridge Rectifier 12V AC is converted

to 9.2 pdc .Since each diode in the bridge rectifier consumes 0.7v, therefore bridge rectifier output will
be of 9.2 pdc. As the output of bridge rectifier consists of pulsating dc voltage, so to make these ripples
grounded we connect a capacitor whose function is to block DC and allows AC to ground. Thus this
purified 9V DC is supplied to voltage regulator LM7805 which can take 8V -25V as I/P & provide 5V
constant voltage. Thus this 5V output is supplied to the microcontroller which gets initialized with the
help of this power supply.
Key0 of this keypad is set for to provide a blank space while Key* provides the functionality of
backward movement while writing a text on LCD. Key# of the keypad is configured for forward
movement.

The 16x2 LCD can display only 16 characters in a line. Therefore, after 16th letter appears on screen,
the cursor position is moved and 17 th letter gets displayed on the first position of 2 nd line of LCD.
Similarly, 23rd letter appears back on the first line and so on.

2.2 Schematic Diagram:

Fig 2.2 Schematic diagram of the alpha numeric keypad using AT89S52 microcontroller

2.3Working of Keypad:
The alphabetic pattern or letter mapping used in this system is depicted in the following figure:

Fig 2.3 Basic Diagram Of 4x3 Keypad

Every key is assigned with a variable to count the number of times it has been pressed. The count is set
to zero initially and increases by one when the same key is pressed again. On first count, the first
alphabet of the key from its letter map is displayed on LCD. For example, if Key1 is pressed when its
count is 0, then a appears on the LCD screen. After this operation, the count increases to 1.

The second letter of the alphabetic pattern is shown on the display module when the same key is
pressed again. This time the count increases again to 2 and second alphabet is displayed at same
position. Thus, we get b on display if Key1 is used twice.

When the same key is pressed third time, its count value changes to 3. This time the third alphabet of the
letter pattern gets displayed on screen replacing the previous alphabet. For the considered case, c
appears on the LCD screen when Key1 is pressed thrice in a row.

The count is reset to zero after it reaches to a value of 3. After this execution, the position on LCD is
shifted to right to allow the second letter to be printed there.
Therefore, pressing the same key four times consecutively, the first alphabet from its letter map
reappears in succession to the last letter. Here, a gets displayed on LCD after c when Key1 is used
four times.

In other words, if a key is pressed more than thrice in a row, the count resets to zero and itll behave
as a new alphabetic key. Thus the same modes of operations continue on repeated access of the keypad
buttons.

Chapter 3
HARDWARE DESCRIPTION
3.1 AT89S51 (Microcontroller):

Fig 3.1.1 IC AT89S52

Pin

Configuration:

Fig 3.1.2 Pin Configuration

The Atmel AT89S52

provides the following

standard features: 8K

bytes of downloadable

Flash, 2K bytes of

EEPROM, 256 bytes of

RAM, 32 I/O lines,

programmable watchdog

timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full
duplex serial port, on-chip oscillator, and clock circuitry.
9

Features of Atmel AT89S52 are as follows: Compatible with MCS-51 Products


8K Bytes of In-System Reprogrammable Downloadable Flash Memory
2K Bytes EEPROM
4V to 6V Operating Range
Fully Static Operation: 0 Hz to 24 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
Programmable UART Serial Channel
SPI Serial Interface
Low-power Idle and Power-down Modes
Interrupt Recovery from Power-down
Programmable Watchdog Timer
Dual Data Pointer
Power-off Flag
AT89S52 ICs pin description is given as follows:Pin Number
1

Description
Port 1.0 - T2

Pin Number
21

Description
Port 2.0 A8

Port 1.1 T2 EX

22

Port 2.1 A9

Port 1.2 Port1

23

Port 2.2 A10

Port 1.3 Port1

24

Port 2.3 A11

Port 1.4 Port1

25

Port 2.4 A12

10

Port 1.5 MOSI

26

Port 2.5 A13

Port 1.6 MISO

27

Port 2.6 A14

Port 1.7 SCK

28

Port 2.7 A 15

RST

29

PSEN

10

Port 3.0 RXD

30

ALE/PROG

11

Port 3.1 TXD

31

EA/VPP

12

Port 3.2 INT0

32

Port 0.7 AD7

13

Port 3.3 INT1

33

Port 0.6 AD6

14

Port 3.4 T0

34

Port 0.5 AD5

15

Port 3.5 T1

35

Port 0.4 - AD4

16

Port 3.6 WR

36

Port 0.3 AD3

17

Port 3.7 RD

37

Port 0.2 AD2

18

XTAL2 Crystal

38

Port 0.1 AD1

19

XTAL1 - Crystal

39

Port0.0 AD0

20

GND

40

VCC

Table 1 AT89S52 pin description

Pin Description:
VCC - Supply voltage
GND - Ground.
11

Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. External pull-ups are
required during program verification.
Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups.
Port Pin

Alternate Functions

P1.5

MOSI(used for in-system programming)

P1.6

MISO(used for in-system programming)

P1.7

SCK(used for in-system programming)

Table 2 Alignment of port1

Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. Port 2 also
receives

the

high-order

address

bits

and

some

control

signals

during

Flash

programming and verification.


Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. Port 3 also serves
the functions of various special features of the AT89S51, as shown in the following
table.

Port Pin

Alternate Functions

P3.0

RXD(serial input port)

P3.1

TXD(serial input port)

P3.2

P3.3

(external interrupt 0)
(external interrupt 1)

P3.4

T0(timer 0 external input)

P3.5

T1(timer 1 external input)

12

P3.6

(external data memory write strobe)


WR

P3.7

(external data memory read strobe)


RD

Table 3 Alignment of port3

RST: Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.
ALE/PROG: Address Latch Enable (ALE) is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG) during Flash
programming.

PSEN: Program Store Enable (PSEN) is the read strobe to external program memory.
EA/VPP:External Access Enable. EA must be strapped to GND in order to enable the device to fetch code
from external program memory locations starting at 0000H up to FFFFH. EA should be strapped to VCC for
internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during
Flash programming.

XTAL1:Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2:Output from the inverting oscillator amplifier.
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be
configured for use as an on-chip oscillator, as shown in Fig 3.1.3. Either a quartz crystal or ceramic
resonator may be used. To drive the device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven as shown in Figure 3.1.4.There are no requirements on the duty
cycle of the external clock signal, since the input to the internal clocking circuitry is through a divideby-two flip-flop, but minimum and maximum voltage high and low time specifications must be
observed.
13

Fig 3.1.2 Oscillator Connections

Fig 3.1.3 External Clock Drive Configuration

3.2Power supply:
The power supplies are designed to convert high voltage AC mains electricity to a suitable low
voltage supply for electronic circuits and other devices. A power supply can be broken down into a
series of blocks, each of which performs a particular function. A dc power supply which maintains the
output voltage constant irrespective of a.c mains fluctuations or load variations is known as Regulated
D.C Power Supply
For example a 5V regulated power supply system as shown below:

14

Fig 3.2. components of LPS

3.2.1 Step down Transformer:


A transformer is an electrical device which is used to convert electrical power from one
electrical circuit to another without change in frequency.
Step-down transformers decrease in output voltage. Most power supplies use a step-down
transformer to reduce the dangerously high mains voltage to a safer low voltage.
The input coil is called the primary and the output coil is called the secondary. There is no
electrical connection between the two coils; instead they are linked by an alternating magnetic field
created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol
represent the core. Transformers waste very little power so the power out is (almost) equal to the power
in. Note that as voltage is stepped down current is stepped up. The ratio of the number of turns on each
coil, called the turns ratio, determines the ratio of the voltages. A step-down transformer has a large
number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a
small number of turns on its secondary (output) coil to give a low output voltage.

15

Fig 3.2.1a Step-Up Transformer

Fig 3.2.1b Step-Down Transformer

Step up and Step down: In these voltage transformation takes place according to whether the
primary is high voltage coil or a low voltage coil.
1) Lower to higher-> Step up
2) Higher to lower-> Step down

3.2.2 BRIDGE RECTIFIER:


A circuit which is used to convert ac to dc is known as RECTIFIER. The process of
conversion ac to dc is called rectification

TYPES OF RECTIFIERS:
Half wave Rectifier
Full wave rectifier
16

1. Centre tap full wave rectifier.


2. Bridge type full wave rectifier.
Comparison of rectifier circuits:

Parameter

Type of Rectifier
Half wave

Full wave

Bridge

Number of diodes
1

Vm

2Vm

Vm

1.21

0.482

0.482

Frequency

2f

2f

Efficiency

0.406

0.812

0.812

Peak factor

PIV of diodes

Ripple factor
Output

Table 4 Comparison of rectifier circuits

17

A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave
rectification. This is a widely used configuration, both with individual diodes wired as shown and with
single component bridges where the diode bridge is wired internally.
A bridge rectifier makes use of four diodes in a bridge arrangement as shown
in fig (a) to achieve full-wave rectification. This is a widely used configuration, both
with individual diodes wired as shown and with single component bridges where
the diode bridge is wired internally.

Fig 3.2.2a Bridge arrangement

Operation:
During positive half cycle of secondary, the diodes D2 and D3 are in forward biased while D1
and D4 are in reverse biased as shown in the fig(b). The current flow direction is shown in the fig (b)
with dotted arrows.

Fig 3.2.2b Positive cycle

18

During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward biased while D2
and D3 are in reverse biased as shown in the fig(c). The current flow direction is shown in the fig (c)
with dotted arrows.

Fig 3.2.2c Negative cycle

3.2.3 Filter Capacitor:


A Filter is a device which removes the a.c component of rectifier output but allows the d.c
component to reach the load.
Filtering is performed by a large value electrolytic capacitor connected across the DC supply to act
as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling.
The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current
to the output. Filtering significantly increases the average DC voltage to almost the peak value (1.4
RMS value).

Fig 3.2.3 Capacitor

19

Note: In our circuit we are using 1000F. Hence large value of capacitor is placed to reduce
ripples and to improve the DC component.

3.2.4 Voltage Regulator:


Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output
voltages. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators
include some automatic protection from excessive current ('overload protection') and overheating
('thermal protection'). Many of the fixed voltage regulators ICs have 3 leads and look like power
transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is simple to use. You
simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to
24VDC) to the Input pin, connect the negative lead to the Common pin and then when you turn on the
power, you get a 5 volt supply from the output pin.

Fig 3.2.4 A Three Terminal Voltage Regulator

3.3 LED
Introduction:
A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps in
many devices, and are increasingly used for lighting. Introduced as a practical electronic component in
1962, early LEDs emitted low-intensity red light, but modern versions are available across
the visible, ultraviolet and infrared wavelengths, with very high brightness.
LEDs present many advantages over incandescent light sources including lower energy
consumption, longer lifetime, improved robustness, smaller size, faster switching, and greater durability
20

and reliability. However, they are relatively expensive and require more precise current and heat
management than traditional light sources. Current LED products for general lighting are more
expensive to buy than fluorescent lamp sources of comparable output.
Color

Wavelength (nm)

Red

610 < < 760

Voltage (V)

semiconductor

Gallium arsenide
1.63 < V < 2.03

Fig 3.3 LED Internal Design

3.4 LCD:
21

phosphide (GaAsP)

Fig 3.4 Liquid Crystal Display

LCD(Liquid Crystal Display) screen is an electronic display module and find a wide range of
applications.A16x2 LCD display is very basic module and is very commonly used in various devices
and circuits.These modules are preferred over seven segments and other multi segments..

Chapter 4
22

Software Explanation :
4.1 About Keil Software :
Softwares used are:
Keil software for c programming.
Proteus for simulation purpose.

What's New in Vision4?


Vision3 adds many new features to the Editor like Text Templates, Quick Function Navigation,
and Syntax Coloring with brace high lighting Configuration Wizard for dialog based startup and
debugger setup. Vision3 is fully compatible to Vision4 and can be used in parallel with Vision4.

What is Vision4?
Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and
debug embedded programs. It encapsulates the following components:

A project manager.
A make facility.
Tool configuration.
Editor.
A powerful debugger.

Building an Application in Vision4


To build (compile, assemble, and link) an application in Vision4, you must:
Select Project - (for example, 166\EXAMPLES\HELLO\HELLO.UV4)
.Select Project - Rebuild all target files or Build target.

4.2 Keil Software Tools (Steps) :


Click on the Keil vision Icon on Desktop
1.The following fig will appear

23

2. Click on the Project menu from the title bar


3. Then Click on New Project

4. Save the Project by typing suitable project name with no extension in u r own folder

5.Then Click on save button above.


6. Select the component for u r project. I.e. Atmel
7.Click on the + Symbol beside of Atmel

24

8.Select AT89C52 as shown below

9.Then Click on OK
10.The Following fig will appear

11.Then Click either YES or NOmostly N


12.Now your project is ready to USE
13.Now double click on the Target1,you would get another option "Source group 1" as shown in fig

25

14.Click on the file option from menu bar and select new

15.The next screen will be as shown in next page, and just maximize it by double clicking on its blue
boarder.

16.Now start writing program in either in C or ASM


17.For a program written in Assembly, then save it with extension . asm and for C based
program save it with extension .C

26

18.Now right click on Source group 1 and click on Add files to Group Source

19.Now you will get another window, on which by default C files will appear.

20.Now select as per your file extension given while saving the file
21.Click only one time on option ADD
22.Now Press function key F7 to compile. Any error will appear if so happen.

23.If the file contains no error, then press Control+F5 simultaneously.


24.The new window is as follows

27

24.Then Click OK
25.Now Click on the Peripherals from menu bar, and check your required port as shown in fig
below

26.Drag the port a side and click in the program file.

27.Now keep Pressing function key F11 slowly and observe.


28.You are running your program successfully.

28

Chapter 5
RESULT
5.1 RESULT:
Whenever a person presses the button on the keyboard, according to the key the numbers and
alphabets are displayed.

29

Fig5.1 result

chapter 6
APPLICATIONS AND CONCLUSION

6.1 Applications :

Text messaging in mobiles and computers


For extra safety in login systems to increase the security
Can be used as input module in programmable logic controllers(PLC)
Keypad can find applications in medical,defence,technological,security,software,automobile
fields

6.2 Conclusion :
30

This report describes a simple but very useful programmable coding for implementing
ALPHABETICAL KEYPAD using AT89S52 Microcontroller.

BIBLIOGRAPHY

1. Muhammad Ali Mazidi and JaniceGillispieMazidi wrote a book on The 8051 Micro controller and
Embedded Systems.
2. Kenneth J. Ayala gave his ideas and theorys in the book titled as The 8051 Micro controller
Architecture, Programming & Applications.
3. Ramesh S. Gaonkar published Microprocessor Architecture, Programming & Applications which is
very useful for this project to follow.

31

4. D. V. PrasadtitledElectronic Components which gives detail description on the electronic


components useful for this project.

32

Vous aimerez peut-être aussi