Académique Documents
Professionnel Documents
Culture Documents
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.
Chapter-2
Block Diagram:
LCD
Fig 2.0 Block diagram of the alpha numeric keypad using AT89S52 microcontroller
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.
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:
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):
Pin
Configuration:
standard features: 8K
bytes of downloadable
Flash, 2K bytes of
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
Description
Port 1.0 - T2
Pin Number
21
Description
Port 2.0 A8
Port 1.1 T2 EX
22
Port 2.1 A9
23
24
25
10
26
27
28
Port 2.7 A 15
RST
29
PSEN
10
30
ALE/PROG
11
31
EA/VPP
12
32
13
33
14
Port 3.4 T0
34
15
Port 3.5 T1
35
16
Port 3.6 WR
36
17
Port 3.7 RD
37
18
XTAL2 Crystal
38
19
XTAL1 - Crystal
39
Port0.0 AD0
20
GND
40
VCC
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
P1.6
P1.7
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
Port Pin
Alternate Functions
P3.0
P3.1
P3.2
P3.3
(external interrupt 0)
(external interrupt 1)
P3.4
P3.5
12
P3.6
P3.7
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
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
15
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
TYPES OF RECTIFIERS:
Half wave Rectifier
Full wave rectifier
16
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
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.
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.
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.
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.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
Voltage (V)
semiconductor
Gallium arsenide
1.63 < V < 2.03
3.4 LCD:
21
phosphide (GaAsP)
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 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.
23
4. Save the Project by typing suitable project name with no extension in u r own folder
24
9.Then Click on OK
10.The Following fig will appear
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.
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.
27
24.Then Click OK
25.Now Click on the Peripherals from menu bar, and check your required port as shown in fig
below
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 :
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
32