mini project documentation format
TRANSCRIPT
-
8/2/2019 Mini Project Documentation Format
1/49
1
PASSWORD SECURED APPLIANCES CONTROL
SYSTEM USING MICROCONTROLLER
A MINI PROJECT REPORT
Submitted in partial fulfillment of the requirements for theAward of the Degree
Of
BACHELOR OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATION ENGINEERING
By
Mr. B. Dinesh Reddy (07C31A0425)
Mr. Aditya Rao Devaraj (07C31A0408)
Mr. Abhinay Karthik (07C31A0405)
Mr. Praveen Kumar (07C31A0464)
Mr. A. S. Ramesh (07C31A0402)
Under the Guidance of
Mr. P. Kiran KumarAssoc.Prof.
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
BALAJI INSTITUTE OF TECHNOLOGY AND SCIENCE(Affiliated to JNTU, Hyderabad)
NARSAMPET, WARANGAL506 331201011
-
8/2/2019 Mini Project Documentation Format
2/49
2
BALAJI INSTITUTE OF TECHNOLOGY AND SCIENCE
NARSAMPET, WARANGAL506 331
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
CERT I F I CA TE This is to certify that this Project Work entitled PASSWORD SECURED
APPLIANCES CONTROL SYSTEM USING MICROCONTROLLER is a
bonafide work carried out by Mr. B. Dinesh Reddy (07C31A0425), Mr. Aditya Rao
Devaraj (07C31A0408), Mr. Abhinay Karthik (07C31A0405), Mr.Praveen
Kumar (07C31A0464), Mr.A.S.Ramesh (07C31A0402), in partial fulfillment of the
requirements for the award of the degree of Bachelor of Technology from JNTU,
Hyderabad during the period 2010-11 under our guidance and supervision.
Internal Guide Head of the Dept. Principal
Mr. P. Kiran Kumar Prof. S. Umamaheshwar Prof. V. Vikram ReddyAssoc. Prof. Professor & Head Principal,Dept. of ECE Dept. of ECE BITS, NarsampetBITS, Narsampet BITS, Narsampet
EXTERNAL EXAMINER
-
8/2/2019 Mini Project Documentation Format
3/49
3
DECLARATION
We, Mr. B. Dinesh Reddy (07C31A0425), Mr. Aditya Rao Devaraj
(07C31A0408), Mr. Abhinay Karthik(07C31A0405), Mr. Praveen Kumar
(07C31A0464), Mr. A. S. Ramesh (07C31A0402), here by declare that the project
entitled PASSWORD SECURED APPLIANCES CONTROL SYSTEM USING
MICROCONTROLLER, submitted in the partial fulfillment of the requirements
for the award of Bachelor of Technology in Electronics and Communication
Engineering, to Balaji Institute of Technology & Science, Narsampet, affiliated to
JNTU, Hyderabad is a authentic work and has not been submitted to any other
university or institution for award of the degree.
Mr. B. Dinesh Reddy (07C31A0425)
Mr. Aditya Rao Devaraj (07C31A0408)
Mr. Abhinay Karthik (07C31A0405)
Mr. Praveen Kumar (07C31A0464)
Mr. A.S. Ramesh (07C31A0402)
-
8/2/2019 Mini Project Documentation Format
4/49
4
ACKNOWLEDGEMENTS
It is a great pleasure to express our deepest sense of gratitude and indebtedness,
to our Internal guide Mr. P. Kiran Kumar, Assoc. Prof., Dept. of ECE, BITS College
Narsampet, for having been a source of constant inspiration, precious guidance and
generous assistance during the project work. We deem it as a privilege to have worked
under his able guidance. Without his close monitoring and valuable suggestions this
work wouldnt have taken this shape. We feel that this help is un-substitutable and
unforgettable.
We wish to express our sincere thanks to Prof. V. Vikram Reddy, Principal,
BITS, Narsampet for providing the college facilities for the completion of the project.
We are profoundly thankful to Prof. S. Umamaheshwar, Prof., & Head, Dept.
of ECE, for his cooperation and encouragement.
We are greatly thankful to our Project coordinators Mr. P. Kiran Kumar,
Assoc. Prof. & Mr. V. Rama Krishna Reddy, Asst. Prof., Dept. of ECE, BITS,Narsampet for their support throughout our project.
We are thankful to the Mr. P. Ram Chandar Rao, Teaching Asst., Dept. of
ECE, BITS, Narsampet for his Technical Support to carryout our project.
Finally, we thank all the faculty members, supporting staff of ECE Dept. and
friends for their kind co-operation and valuable help for completing the project.
Mr. B. Dinesh Reddy (07C31A0425)
Mr. Aditya Rao Devaraj (07C31A0408)
Mr. Abhinay Karthik (07C31A0405)
Mr. Praveen Kumar (07C31A0464)
Mr. A. S. Ramesh (07C31A0402)
-
8/2/2019 Mini Project Documentation Format
5/49
5
ABSTRACT
Security is prime concern in our day-to-day life. Everyone wants to be asmuch as secure as to be possible. An access control systems forms a vital link in a securitychain. The Microcontroller based digital lock presented here is an access control system thatallows only authorized persons to access a restricted area. This system is best suitable for
corporate offices, Banks, ATMs and Home security.The system comprises a small electronic unit with a numeric keypad,
which is fixed outside the entry door to control a solenoid-operated lock with the help of arelay to switch on a Computer (or to run stepper motor). When an authorized person enterspredetermined user ID and password via the keypad, the relay turns on (or stepper motor isoperated).
When the code has been incorrectly entered three times in a row, the codelock will switch to block mode. This function thwarts any attempt by hackers to quickly try
a large number of codes in a sequence. If the user forgets his password, the code lock can beaccessed by a unique 10 digit administrator password. The secret code can be changed anytime after entering the current code (Master code).
An LED is provided for acknowledgment of the key impression.Whenever a key is pressed on the numeric key pad, the system acknowledges the impressionby a short sharp glow of the LED.
This project uses regulated 5V, 500mA power supply. 7805 threeterminal voltage regulator is used for voltage regulation. Bridge type full wave rectifier isused to rectify the ac output of secondary of 230/12V step down transformer.
-
8/2/2019 Mini Project Documentation Format
6/49
6
CONTENTS
Chapter No. Description Page No.
CHAPTER 1 INTRODUCTION 9
CHAPTER 2 BLOCK DIAGRAM 10
2.1 Block Diagram Description 112.1.1 Power Supply 112.1.2 Transformer 112.1.3 Rectifier 112.1.4 Filter 122.1.5 Voltage Regulator 122.1.6 Microcontrollers 12
2.1.6.1. Features Of P89V51RD2 132.1.6.2. Pin Diagram 16
2.1.6.3. Pin Description 17
CHAPTER 3 PROGRAMMING THE FLASH 20
CHAPTER 4 KEY PAD 24
4.1 Interfacing Keypad 24
CHAPTER 5 TRANSISTOR DRIVER CIRCUIT 27
CHAPTER 6 LIQUID CRYSTAL DISPLAY 28
6.1 Interfacing Liquid Crystal Display 29
CHAPTER 7 SOFTWARES USED 34
7.1 Keil u Vision 347.2 Flash Magic 347.3 Working procedure 34
CHAPTER 8 CODE 37
-
8/2/2019 Mini Project Documentation Format
7/49
7
LIST OF FIGURES
S.No. Fig. No. Description Page No.
1 Fig.1 Block Diagram 10
2 Fig. 2 Power Supply 11
3 Fig.3 Microcontroller Architecture 13
4 Fig.4 Block Diagram Of P89V51RD2 15
5 Fig.5 Pin Diagram 16
6 Fig.6 Telephone Keypad 24
7 Fig.7 Transistor Driver Circuit 27
8 Fig.8 Procedure of 8-bit Initialisation 33
9 Fig.9 LCD Interfacing with the microcontroller 3310 Fig.10 Schematic Diagram 36
-
8/2/2019 Mini Project Documentation Format
8/49
8
LIST OF TABLES
S.No. Table No. Description Page No.
1 Table -1 Port 3 Alternate Functions 19
2 Table-2 Flash Programming Modes 22
3 Table-3 LCD Pin Functions 29
4 Table-4 LCD Basic Commands 31
-
8/2/2019 Mini Project Documentation Format
9/49
9
CHAPTER 1
INTRODUCTION
An embedded system is a combination of software and hardware to p erform a
dedicated task.
Some of the main devices used in embedded products are Microprocessors and
Microcontrollers.
Microprocessors are commonly referred to as general purpose processors as they
simply accept the inputs, process it and give the output.
In contrast, a Microcontroller not only accepts the data as inputs but also manipulates
it, interfaces the data with various devices, controls the data and thus finally gives the result.
The Project Password securedAppliances Control System is an excellent project
that provides security in every way. This project is very useful in places where security is
must.
-
8/2/2019 Mini Project Documentation Format
10/49
10
CHAPTER 2
BLOCK DIAGRAM
Fig.1 Block Diagram
-
8/2/2019 Mini Project Documentation Format
11/49
11
2.1. BLOCK DIAGRAM DESCRIPTION
2.1.1. POWER SUPPLY
The input to the circuit is applied from the regulated power supply. The a.c. input i.e.,
230V from the mains supply is step down by the transformer to 12V and is fed to a rectifier.
The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c
voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components
present even after rectification. Now, this voltage is given to a voltage regulator to obtain a
pure constant dc voltage.
Fig. 2 Power Supply
2.1.2. TRANSFORMER
Usually, DC voltages are required to operate various electronic equipment and these
voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.c
input available at the mains supply i.e., 230V is to be brought down to the required voltage
level. This is done by a transformer. Thus, a step down transformer is employed to decrease
the voltage to a required level.
2.1.3. RECTIFIER
The output from the transformer is fed to the rectifier. It converts A.C. into pulsating
D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifieris used because of its merits like good stability and full wave rectification.
RegulatorFilterBridge
Rectifier
Step down
transformer
230V AC
50Hz D.COutput
-
8/2/2019 Mini Project Documentation Format
12/49
12
2.1.4. FILTER
Capacitive filter is used in this project. It removes the ripples from the output of
rectifier and smoothens the D.C. Output received from this filter is constant until the mains
voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage
received at this point changes. Therefore a regulator is applied at the output stage.
2.1.5. VOLTAGE REGULATOR
As the name itself implies, it regulates the input applied to it. A voltage regulator is an
electrical regulator designed to automatically maintain a constant voltage level. In this
project, power supply of 5V and 12V are required. In order to obtain these voltage levels,7805 and 7812 voltage regulators are to be used. The first number 78 represents positive
supply and the numbers 05, 12 represent the required output voltage levels.
2.1.6. MICROCONTROLLERS
Microprocessors and microcontrollers are widely used in embedded systems products.
Microcontroller is a programmable device. A microcontroller has a CPU in addition to a
fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed
amount of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them
ideal for many applications in which cost and space are critical.
The Intel 8051 is a Harvard architecture, single chip microcontroller (C) which was
developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and
early 1990s, but today it has largely been superseded by a vast range of enhanced devices
with 8051-compatible processor cores that are manufactured by more than 20 independent
manufacturers including Philips, Atmel, Infineon Technologies and Maxim Integrated
Products.
8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a
time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the CPU.
8051 is available in different memory types such as EEPROM, UV-EPROM, Flash and NV-
RAM.
-
8/2/2019 Mini Project Documentation Format
13/49
13
The present project is implemented on Keil Uvision. In order to program the device,
Flash Magic tool has been used to burn (dump) the program onto the Microcontroller.
Fig.3 Microcontroller Architecture
The features, pin description of the microcontroller and the software tools used are discussed
in the following sections.
2.1.6.1. FEATURES OF P89V51RD2
GENERAL DESCRIPTION
The P89V51RD2 is an 80C51 microcontroller with 64 kB Flash and 1024 bytes of
data RAM.A key feature of the P89V51RD2 is its X2 mode option. The design engineer can
choose to run application with the conventional 80C51 clock rate (12 clocks per machine
cycle) or select the X2 mode (6 clocks per machine cycle) to achieve twice throughput at the
same clock frequency by half.
-
8/2/2019 Mini Project Documentation Format
14/49
14
The flash program memory supports both parallel programming and in serial In
System Programming (ISP). Parallel programming mode offers gang programming at high
speed, reducing programming costs and time to market. ISP allows a device to be
reprogrammed in the end product under software control. The capability to field / update the
application firmware makes a wide range of application possible.
The P89V51RD2 is also In Application Programmable (IAP), allowing the flash
program memory to be reconfigured even while the application is running.
FEATURES
80C51Central Processing Unit. 5V Operating voltage from 0 to 40MHz. 64kB of on chip Flash Program memory with ISP (In System Programming) and IAP
(In Application Programming).
Supports 12-clock (default) or 6-clock mode selection via software or ISP. SPI (Serial Peripheral Counter Array) with PWM and Capture/Compare functions. Four 8-bit I/O ports with three high current Port 1 pins (16mA each). Three 16-bit Timers/Counters. Two 16-bit Timer/Counters. Programmable Watch Dog Timer (WDT). Eight interrupt sources with four priority levels. Second DPTR register. Low EMI mode (ALE inhibit). TTL and CMOS compatible logic levels. Brown out detection. Low power modes -1.Power down mode with external interrupt wakeup & 2.Idle
mode.
PDIP40, PLCC44 and TQFP44 packages.
-
8/2/2019 Mini Project Documentation Format
15/49
15
\
Fig.4 Block Diagram Of P89V51RD2
-
8/2/2019 Mini Project Documentation Format
16/49
16
2.1.6.2. PINDIAGRAM
Fig.5 Pin Diagram
-
8/2/2019 Mini Project Documentation Format
17/49
17
2.1.6.3. PIN DESCRIPTION
Vcc-Pin 40 provides supply voltage to the chip. The voltage source is +5V.
GND-Pin 20 is the ground.
XTAL1 and XTAL2
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier
that can be configured for use as an on-chip oscillator, as shown in Figure 11. 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 the below figure.
There are no requirements on the duty cycle of the external clock signal, since the input to the
internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum
voltage high and low time specifications must be observed.
Fig: Oscillator Connections
C1, C2 = 30 pF 10 pF for Crystals
= 40 pF 10 pF for Ceramic Resonators
Fig: External Clock Drive Configuration
-
8/2/2019 Mini Project Documentation Format
18/49
18
RESET-Pin9 is the reset pin. It is an input and is active high. Upon applying a high pulse to
this pin, the microcontroller will reset and terminate all the activities. This is often referred to
as a power-on reset.
EA (External access)-Pin 31 is EA. It is an active low signal. It is an input pin and must be
connected to either Vcc or GND but it cannot be left unconnected. The 8051 family members
all come with on-chip ROM to store programs. In such cases, the EA pin is connected to Vcc.
If the code is stored on an external ROM, the EA pin must be connected to GND to indicate
that the code is stored externally.
PSEN (Program store enable)-This is an output pin.
ALE (Address latch enable)-This is an output pin and is active high.
Ports 0, 1, 2 and 3-The four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit
ports. All the ports upon RESET are configured as input, since P0-P3 have value FFH on
them.
Port 0(P0)-Port 0 is also designated as AD0-AD7, allowing it to be used for both address and
data. ALE indicates if P0 has address or data. When ALE=0, it provides data D0-D7, but
when ALE=1, it has address A0-A7. Therefore, ALE is used for demultiplexing address and
data with the help of an internal latch.
When there is no external memory connection, the pins of P0 must be connected to a
10K-ohm pull-up resistor. This is due to the fact that P0 is an open drain. With external pull-
up resistors connected to P0, it can be used as a simple I/O, just like P1 and P2. But the ports
P1, P2 and P3 do not need any pull-up resistors since they already have pull-up resistors
internally. Upon reset, ports P1, P2 and P3 are configured as input ports.
Port 1 and Port 2-With no external memory connection, both P1 and P2 are used as simple
I/O. With external memory connections, port 2 must be used along with P0 to provide the 16-
bit address for the external memory. Port 2 is designated as A8-A15 indicating its dual
function. While P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-
A15 of the address.
-
8/2/2019 Mini Project Documentation Format
19/49
19
Port 3-Port 3 occupies a total of 8 pins, pins 10 through 17. It can be used as input or output.
P3 does not need any pull-up resistors, the same as port 1 and port 2. Port 3 has an additional
function of providing some extremely important signals such as interrupts.
Table: Port 3 Alternate Functions
Machine cycle for the 8051
The CPU takes a certain number of clock cycles to execute an instruction. In the 8051
family, these clock cycles are referred to as machine cycles. The length of the machine cycle
depends on the frequency of the crystal oscillator. The crystal oscillator, along with on-chip
circuitry, provides the clock source for the 8051 CPU.
The frequency can vary from 4 MHz to 30 MHz, depending upon the chip rating and
manufacturer. But the exact frequency of 11.0592 MHz crystal oscillator is used to make the
8051 based system compatible with the serial port of the IBM PC.
In the original version of 8051, one machine cycle lasts 12 oscillator periods.
Therefore, to calculate the machine cycle for the 8051, the calculation is made as 1/12 of the
crystal frequency and its inverse is taken.
The assembly language program is written and this program has to be dumped into the
microcontroller for the hardware kit to function according to the software. The program
dumped in the microcontroller is stored in the Flash memory in the microcontroller. Before
that, this Flash memory has to be programmed and is discussed in the next section.
-
8/2/2019 Mini Project Documentation Format
20/49
20
CHAPTER 3
PROGRAMMING THE FLASH
PROGRAMMING THE FLASH
The P89V51RD2 is normally shipped with the on-chip Flash memory array in the
erased state (that is, contents = FFH) and ready to be programmed. The programming
interface accepts either a high-voltage (12-volt) or a low-voltage (VCC) program enable
signal. The low-voltage programming mode provides a convenient way to program the
P89V51RD2 inside the users system, while the high-voltage programming mode is
compatible with conventional third party Flash or EPROM programmers. The P89V51RD2 is
shipped with either the high-voltage or low-voltage programming mode enabled. The
respective top-side marking and device signature codes are listed in the following table.
The P89V51RD2 code memory array is programmed byte-byte in either programming
mode.
To program any nonblank byte in the on-chip Flash Memory, the entire memory must
be erased using the Chip Erase Mode.
PROGRAMMING ALGORITHM
Before programming the P89V51RD2, the address, data and control signals should be
set up according to the Flash programming mode table. To program the P89V51RD2, the
following steps should be considered:
1. Input the desired memory location on the address lines.
2. Input the appropriate data byte on the data lines.
3. Activate the correct combination of control signals.
4. Raise EA/VPP to 12V for the high-voltage programming mode.
5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte-
write cycle is self-timed and typically takes no more than 1.5 ms.
Repeat steps 1 through 5, changing the address and data for the entire array or until the end of
the object file is reached.
-
8/2/2019 Mini Project Documentation Format
21/49
21
DATA POLLING
The P89V51RD2 features Data Polling to indicate the end of a write cycle. During a
write cycle, an attempted read of the last byte written will result in the complement of the
written datum on PO.7. Once the write cycle has been completed, true data are valid on all
outputs, and the next cycle may begin. Data Polling may begin any time after a write cycle
has been initiated.
READY/BUSY
The progress of byte programming can also be monitored by the RDY/BSY output
signal. P3.4 is pulled low after ALE goes high during programming to indicate BUSY. P3.4
is pulled high again when programming is done to indicate READY.
CHIP ERASE
The entire Flash array is erased electrically by using the proper combination of
control signals and by holding ALE/PROG low for 10 ms. The code array is written with all
1s. The chip erase operation must be executed before the code memory can be re
programmed.
READING THE SIGNATURE BYTESThe signature bytes are read by the same procedure as a normal verification of
locations 030H, 031H, and 032H, except that P3.6 and P3.7 must be pulled to a logic low.
The values returned are as follows.
(030H) = 1EH indicates manufactured by Atmel
(031H) = 51H indicates 89C51
(032H) = FFH indicates 12V programming(032H) = 05H indicates 5V programming
PROGRAMMING INTERFACE
Every code byte in the Flash array can be written and the entire array can be erased by
using the appropriate combination of control signals. The write operation cycle is self timed
and once initiated, will automatically time itself to completion. All major programming
vendors offer worldwide support for the Atmel microcontroller series.
-
8/2/2019 Mini Project Documentation Format
22/49
22
Fig: Flash Programming Modes
EEPROM
In the design of all microprocessors-based systems, semiconductor memories are used
as primary storage for code and data. Semiconductor memories are connected directly to the
CPU and they are the memory that the CPU first asks for information (code and data). For
this reason, semiconductor memories are sometimes referred to as primary memory.
IMPORTANT TERMINOLOGY COMMON TO ALL SEMICONDUCTOR
MEMORIES
MEMORY CAPACITY
The number of bits that a semiconductor memory chip can store is called chip
capacity. It can be in units of Kilobits, Megabits and so on. This must be distinguished from
the storage capacity of computer system. While the memory capacity of a memory IC chip is
always given in bits, the memory capacity of a computer system is given in bytes.
MEMORY ORGANIZATION
-
8/2/2019 Mini Project Documentation Format
23/49
23
Memory chips are organized into a number of locations within the IC. Each location
can hold 1 bit, 4 bits, 8 bits or even 16 bits, depending on how it is designed internally. The
number of bits that each location within the memory chip can hold is always equal to the
number of data pins on the chip. i.e., the total number of bits that a memory chip can store is
equal to the number of locations times the number of data bits per location.
SPEED
One of the most important characteristics of a memory chip is the speed at which its
data can be accessed. The speed of the memory chip is commonly referred to as its access
time. The access time of memory chip varies from a few nanoseconds to hundreds of
nanoseconds, depending on the IC technology used in the design and fabrication process.
The different types of memories are RAM, ROM, EPROM and EEPROM.
RAM and ROM are inbuilt in the microprocessor.
This project requires the data such as the user identification number and password to
be stored permanently. Thus this data has to be stored in such a location where it cannot be
erased when power fails and also the data should be allowed to make changes in it without
the system interface i.e., there should be a provision in such a way that the data should be
accessed (or modified) while it is in system board but not external erasure and programming.
The flash memory inbuilt in the microcontroller can erase the entire contents in less than a
second and the erasure method is electrical. But the major drawback of Flash memory is that
when flash memorys contents are erased, the entire device will be erased but not a desired
section or byte.
For this purpose, we prefer EEPROM in our project.
EEPROM (ELECTRICALLY ERASABLE PROGRAMMABLE READ ONLY
MEMORY)
EEPROM has several advantages over other memory devices, such as the fact that its
method of erasure is electrical and therefore instant. In addition, in EEPROM one can select
which byte to be erased, in contrast to flash , in which the entire contents of ROM are erased.
The main advantage of EEPROM is that one can program and erase its contents while it is in
system board. It does not require physical removal of the memory chip from its socket. In
general, the cost per bit for EEPROM is much higher when compared to other devices.
-
8/2/2019 Mini Project Documentation Format
24/49
24
CHAPTER 4
KEYPAD
KEYPAD
Keypads and LCDs are the most widely used input/output devices of the 8051 and a
basic understanding of them is essential. The keypads are mainly three types:
1. 4*3 keypad2. 4*4 keypad3. 4*8 keypad.
The keypad used in this project is 4*3 keypad.
Fig.6 Telephone Keypad
INTERFACING THE KEYPAD TO 8051
At the lowest level, keyboards are organized in a matrix of rows and columns. The
CPU accesses both rows and columns through ports. Therefore, with two 8-bit ports, an 8*8
matrix of keys can be connected to a microprocessor. When a key is pressed, a row and a
column make a contact, otherwise there is no connection between rows and columns. A
single microcontroller (consisting of a microprocessor, RAM, EPROM and several ports allon a single chip) takes care of hardware and software interfacing of the keypad. In such
-
8/2/2019 Mini Project Documentation Format
25/49
25
systems, it is the function of programs stored in EPROM of the microcontroller to scan the
keys continuously, identify which one has been activated and present it to the motherboard.
Fig: 4*3 Matrix Keypad Connections to Ports
SCANNING AND IDENTIFYING KEY
The rows are connected to an output port and the columns are connected to an input
port. If no key has been pressed, reading the input port will yield 1s for all columns since they
are all connected to high (Vcc). If all the rows are grounded and a key is pressed, one of the
columns will have 0 since the key pressed provides the path to ground. It is the function of
the microcontroller to scan the keypad continuously to detect and identify the key pressed.
GROUNDING ROWS AND READING THE COLUMNS
To detect a pressed key, the microcontroller grounds all rows by providing 0 (zero) to
the output latch, then it reads the columns. If the data read from the columns is D2-D0 =111,
no key has been pressed and the process continues until a key press is detected. However, if
one of the column bits has a zero, this means that a key press has occurred i.e., for example, if
-
8/2/2019 Mini Project Documentation Format
26/49
26
D2-D0=110, this means that a key in the D0 column has been pressed. After a key press is
detected, the microcontroller will go through a process of identifying the key. Starting with
the top row, the microcontroller grounds it by providing a low to row D0 only and then it
reads the columns. If the data read is all 1s, no key in that row is activated and the process is
moved to the next row. It grounds the next row, reads the columns and checks for any zero.
This process continues until the row is identified. After identification of the row in which the
key has been pressed, the next task is to find out which column the pressed key belongs to.
Now this will be easy since the microcontroller knows at any time which row and column are
being accessed.
-
8/2/2019 Mini Project Documentation Format
27/49
27
CHAPTER 5
TRANSISTOR DRIVER CIRCUIT
TRANSISTOR DRIVER CIRCUIT
Digital systems and microcontroller pins lack sufficient current to drive the circuits
like LED circuits and relay circuits. While these circuits need around 10milli amps to be
energized, the microcontrollers pin can provide a maximum of 1-2milli amps current. For
this reason, a driver such as a power transistor is placed in between the microcontroller and
the LED.
Fig.7 Transistor Driver Circuit
OPERATION OF THE CIRCUIT
The input to the base of the transistor is applied from the microcontroller port pin
P1.0. The transistor will be switched on when the base to emitter voltage is greater than 0.7V
(cut-in voltage). Thus when the voltage applied to the pin P1.0 is high i.e., P1.0=1 (>0.7V),
the transistor will be switched on and thus the LED will be activated and produces a glow.
When the voltage at the pin P1.0 is low i.e., P1.0=0 (
-
8/2/2019 Mini Project Documentation Format
28/49
28
CHAPTER 6
LIQUID CRYASTAL DISPLAY
LIQUID CRYSTAL DISPLAY
LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing
LEDs (seven segment LEDs or other multi segment LEDs) because of the following reasons:
1. The declining prices of LCDs.2. The ability to display numbers, characters and graphics. This is in contrast to LEDs,
which are limited to numbers and a few characters.
3. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU ofthe task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU to
keep displaying the data.
4. Ease of programming for characters and graphics.These components are specialized for being used with the microcontrollers, which
means that they cannot be activated by standard IC circuits. They are used for writing
different messages on a miniature LCD.
A model described here is for its low price and great possibilities most frequently
used in practice. It is based on the HD44780 microcontroller (Hitachi) and can display
messages in two lines with 16 characters each . It displays all the alphabets, Greek letters,
punctuation marks, mathematical symbols etc. In addition, it is possible to display symbols
that user makes up on its own. Automatic shifting message on display (shift left and right),
appearance of the pointer, backlight etc. are considered as useful characteristics.
-
8/2/2019 Mini Project Documentation Format
29/49
29
PIN FUNCTIONS
There are pins along one side of the small printed board used for connection to the
microcontroller. There are total of 14 pins marked with numbers (16 in case the background
light is built in). Their function is described in the table below:
FunctionPin
NumberName
Logic
StateDescription
Ground 1 Vss - 0V
Power supply 2 Vdd - +5V
Contrast 3 Vee - 0Vdd
Control ofoperating
4 RS0
1
D0D7 are interpreted as
commands
D0D7 are interpreted as data
5 R/W
0
1
Write data (from controller to
LCD)
Read data (from LCD to
controller)
6 E
0
1
From 1 to
0
Access to LCD disabled
Normal operating
Data/commands are transferred to
LCD
Data / commands
7 D0 0/1 Bit 0 LSB
8 D1 0/1 Bit 1
9 D2 0/1 Bit 2
10 D3 0/1 Bit 3
11 D4 0/1 Bit 4
12 D5 0/1 Bit 5
13 D6 0/1 Bit 6
14 D7 0/1 Bit 7 MSB
-
8/2/2019 Mini Project Documentation Format
30/49
30
LCD SCREEN
LCD screen consists of two lines with 16 characters each. Each character consists of
5x7 dot matrix. Contrast on display depends on the power supply voltage and whether
messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied
on pin marked as Vee. Trimmer potentiometer is usually used for that purpose. Some
versions of displays have built in backlight (blue or green diodes). When used during
operating, a resistor for current limitation should be used (like with any LE diode).
LCD BASIC COMMANDS
All data transferred to LCD through outputs D0-D7 will be interpreted as commands
or as data, which depends on logic state on pin RS:
RS = 1 - Bits D0 - D7 are addresses of characters that should be displayed. Built in processor
addresses built in map of characters and displays corresponding symbols. Displaying
position is determined by DDRAM address. This address is either previously defined or the
address of previously transferred character is automatically incremented.
RS = 0 - Bits D0 - D7 are commands which determine display mode. List of commands
which LCD recognizes are given in the table below:
-
8/2/2019 Mini Project Documentation Format
31/49
31
I/D
1 =
Incr
eme
nt
(by
1)
R/L
1 =
Shif
t
right
0 = Decrement (by 1) 0 = Shift left
S 1 = Display shift on DL 1 = 8-bit interface
0 = Display shift off 0 = 4-bit interface
D 1 = Display on N 1 = Display in two lines
0 = Display off 0 = Display in one line
U 1 = Cursor on F 1 = Character format 5x10 dots
0 = Cursor off 0 = Character format 5x7 dots
B 1 = Cursor blink on D/C 1 = Display shift
0 = Cursor blink off 0 = Cursor shift
Command RSRWD7D6D5D4D3 D2 D1 D0Execution
Time
Clear display 0 0 0 0 0 0 0 0 0 1 1.64mS
Cursor home 0 0 0 0 0 0 0 0 1 x 1.64mS
Entry mode set 0 0 0 0 0 0 0 1 I/D S 40uS
Display on/off control 0 0 0 0 0 0 1 D U B 40uS
Cursor/Display Shift 0 0 0 0 0 1 D/C R/L x x 40uS
Function set 0 0 0 0 1 DL N F x x 40uS
Set CGRAM address 0 0 0 1 CGRAM address 40uS
Set DDRAM address 0 0 1 DDRAM address 40uS
Read BUSY flag (BF) 0 1 BF DDRAM address -
Write to CGRAM or
DDRAM1 0 D7 D6 D5 D4 D3 D2 D1 D0 40uS
Read from CGRAM or
DDRAM1 1 D7 D6 D5 D4 D3 D2 D1 D0 40uS
-
8/2/2019 Mini Project Documentation Format
32/49
32
LCD INITIALISATION
Once the power supply is turned on, LCD is automatically cleared. This process lasts
for approximately 15mS. After that, display is ready to operate. The mode of operating is set
by default. This means that:
1. Display is cleared
2. Mode
DL = 1 Communication through 8-bit interface
N = 0 Messages are displayed in one line
F = 0 Character font 5 x 8 dots
3. Display/Cursor on/off
D = 0 Display offU = 0 Cursor off
B = 0 Cursor blink off
4. Character entry
ID = 1 Addresses on display are automatically incremented by 1.
S = 0 Display shift off
Automatic reset is mainly performed without any problems. Mainly but not always! If
for any reason power supply voltage does not reach full value in the course of 10mS, display
will start perform completely unpredictably. If voltage supply unit can not meet this condition
or if it is needed to provide completely safe operating, the process of initialization by which a
new reset enabling display to operate normally must be applied.
Algorithm according to the initialization is being performed depends on whether
connection to the microcontroller is through 4- or 8-bit interface. All left over to be done after
that is to give basic commands and of course- to display messages.
-
8/2/2019 Mini Project Documentation Format
33/49
33
Fig: Procedure on 8-bit initialization.
LCD INTERFACING WITH THE MICROCONTROLLER
P2.0P2.1P2.2
P89V51RD2
P1.0P1.1P1.2P1.3
P1.4P1.5P1.6P1.7
4 (RS) 15 (R/W) 26(EN) 3
LCD
D0D1D2D3
D4D5 15D6 16D7
-
8/2/2019 Mini Project Documentation Format
34/49
34
CHAPTER 7
SOFTWARES USED
KEIL COMPILER
Keil compiler is a software used where the machine language code is written and
compiled. After compilation, the machine source code is converted into hex code which is to
be dumped into the microcontroller for further processing. Keil compiler also supports C
language code.
FLASH MAGIC
Flash-Magic is the Software which accepts any file like hex, assembly language, C,
C++, JAVA class files. Once the machine code is converted into hex code, that hex code has
to be dumped into the microcontroller and this is done by the Flash-Magic. Flash-Magic is a
programmer which itself contains a microcontroller in it other than the one which is to be
programmed. This microcontroller has a program in it written in such a way that it accepts
the hex file from the keil compiler and dumps this hex file into the microcontroller which is
to be programmed. As the Flash-Magic programmer kit requires power supply to be operated,this power supply is given from the power supply circuit designed above. It should be noted
that this programmer kit contains a power supply section in the board itself but in order to
switch on that power supply, a source is required. Thus this is accomplished from the power
supply board with an output of 12volts.
WORKING PROCEDURE
The Project Password based Computer control system using P89V51RD2
Microcontroller is an exclusive project that provides security at Corporate Offices, Banks,
ATM centers, offices and homes.
Security is of primary concern and in this busy, competitive world, human cannot find
ways to provide security to his confidential belongings manually. Instead, he finds an
alternative which can provide a full fledged security as well as automized. This project has
been developed on this motto.
-
8/2/2019 Mini Project Documentation Format
35/49
35
In this project every user, a part of an organization, is given an unique user ID and
password. The passwords of all the users of that particular organization will be stored in
EEPROM present in the system board because the data in EEPROM can be changed any
number of times without the physical removal of the memory chip from its socket.
This system will be fixed at the main door of the restricted area. Whenever the user tries to
enter into the organization, this system asks the user to enter his user id. This message Enter
USER ID will be displayed on the LCD. Then the user has to enter his identification number
then, The microcontroller accepts this data and compares this user id which is already stores
in the EEPROM. If the user id is not matched with any of the stored user ids, the
microcontroller will not proceed for further details but displays a message Invalid USER
ID. If this user id is matched with any one of the already stored user ids, then the system
asks the user to enter his password. After he enters his password, the microcontroller onceagain compares the entered password with the already passwords in the EEPROM. If this
password matches with any one of the passwords stored, the microcontroller supllies the
power to the computer by enabling the relay for the person to enter into the restricted area
and the message PROCESSING will be displayed on the LCD display.
But if the entered password does not match with the already stored passwords, the
message Password failed. Enter ID will be displayed on the LCD and the computer does
not on.
If the password is entered wrongly for 3 times continuously, then the total system will
be blocked. The system can come to normal condition only after pressing the RESET switch.
Initially the system is given with default passwords as shown below.
User ID Password
101 555
102 556
103 557
104 558
If the user forgot his password then he should consult administrator. Then the
administrator enters a 10 digit code which is admin PSWD. Then the forgotte n password is
displayed on LCD. Default password for administrator is 1234567890. # key should be
entered after completion of entering ID or password. This key acts like a ENTER key.
-
8/2/2019 Mini Project Documentation Format
36/49
36
Fig: SCHEMATIC DIAGRAM
-
8/2/2019 Mini Project Documentation Format
37/49
37
CHAPTER 8
CODE
FAILCOUNT DATA 22H
KEYCOUNT DATA 25H ;TO STORE THE NO. KEYS ENTERD FOR EACH
TIME
TEMP DATA 26H ;TEMP VARIABLE
PWDFIND DATA 27H ;TO FIND WHICH PASSWORD SHOULD BE
COMPARED
PCOUNT1 DATA 28H ;TO STORE THE NO.OF DIGITS OF
PASSWORD1
PCOUNT2 DATA 29H ;TO STORE THE NO.OF DIGITS OF
PASSWORD2
PCOUNT3 DATA 2AH ;TO STORE THE NO.OF DIGITS OF
PASSWORD3
PCOUNT4 DATA 2BH ;TO STORE THE NO.OF DIGITS OF
PASSWORD4
ORG 00H
MOV P3,#00000111B ;MAKE P3.0-P3.2 AS INPUT PINS FOR
COLUMNS
MOV R1,#50H ;SCANNED KEY IS STORED IN THIS
LOCATION
;MOV R0,#0
CLR P2.7 ; LED OFF
MOV FAILCOUNT,#0
;LCD INTIALIZATION
MOV DPTR,#COMM
XX: CLR A
MOVC A,@A+DPTR
JZ START1
ACALL COMMAND
ACALL DELAYINC DPTR
-
8/2/2019 Mini Project Documentation Format
38/49
38
SJMP XX
START1: MOV DPTR,#MSGA ;DISPLAY "BITS"
ACALL DISPLAY1
ACALL DELAY
ACALL DELAY
ACALL DELAY
MOV A,#0C0H
ACALL COMMAND
ACALL DELAY
MOV DPTR,#MSGB
ACALL DISPLAY1
ACALL DELAYACALL DELAY
ACALL DELAY
MOV DPTR,#MSG ;DISPLAY "SECURITY SYSTEM"
ACALL DISPLAY
ACALL DELAY
START2: CLR P2.7
MOV DPTR,#MSG1 ;ASKING FOR ID
ACALL DISPLAY
ACALL DELAY
ACALL KEYSCAN ;ENTER THE ID
ACALL DELAY
ACALL COMPARISON ;ID COMPARISION
ACALL DELAY
SJMP START2
/*@@@@@@@ KEYSCAN SUBROUTINE @@@@@@@@@@@@@@@*/
KEYSCAN: MOV R1,#50H ;SCANNED KEY IS STORED IN THIS
LOCATION
MOV A,#0C3H
;ENTERD KEYS ARE DISPLAYED FROM 4TH LOCATION OF 2ND LINE
LCALL COMMAND
LCALL DELAY
MOV KEYCOUNT,#0
-
8/2/2019 Mini Project Documentation Format
39/49
39
NEXTKEY: MOV P0,#0F0H ;GROUND ALL ROWS INTIALLY
MOV A,P3 ;READ ALL COLMNS;ENSURE ALL KEYS
OPEN
ANL A, #00000111B
CJNE A,#00000111B,NEXTKEY
K2: ACALL DELAY
MOV A,P3 ;READ ALL COLMNS;ENSURE ALL KEYS
OPEN
ANL A, #00000111B
CJNE A,#00000111B,OVER
SJMP K2
OVER: ACALL DELAYMOV A,P3 ;READ ALL COLMNS
ANL A, #00000111B
CJNE A,#00000111B,OVER1
SJMP K2
OVER1: MOV P0,#00001110B ;GROUND ROW 0
MOV A,P3 ;READ ALL COLMNS
ANL A, #00000111B
CJNE A,#00000111B,ROW_0
MOV P0,#00001101B ;GROUND ROW 1
MOV A,P3 ;READ ALL COLMNS
ANL A, #00000111B
CJNE A,#00000111B,ROW_1
MOV P0,#00001011B ;GROUND ROW 2
MOV A,P3 ;READ ALL COLMNS
ANL A, #00000111B
CJNE A,#00000111B,ROW_2
MOV P0,#00000111B ;GROUND ROW 3
MOV A,P3 ;READ ALL COLMNS
ANL A, #00000111B
CJNE A,#00000111B,ROW_3
LJMP K2
ROW_0: MOV DPTR,#KCODE0
SJMP FIND
-
8/2/2019 Mini Project Documentation Format
40/49
40
ROW_1: MOV DPTR,#KCODE1
SJMP FIND
ROW_2: MOV DPTR,#KCODE2
SJMP FIND
ROW_3: MOV DPTR,#KCODE3
FIND: RRC A
JNC MATCH
INC DPTR
SJMP FIND
MATCH: SETB P2.7
ACALL DELAY ;IF KEY IS DETECTED THEN GIVE A BEEP
SOUNDACALL DELAY
CLR P2.7
CLR A
MOVC A,@A+DPTR
MOV @R1,A
CJNE A,#23H,NK ;STOP THE KEYSCANNING WHEN '#' IS
PRESSED
RET
NK: ACALL DATAWRT ;DISPLAY THE
PRESSED KEY
ACALL DELAY
INC KEYCOUNT
INC R1
SJMP NEXTKEY
COMPARISON: MOV A,KEYCOUNT
CJNE A,#3,FFAIL
CHECKID1: MOV A,#'1' ;COMPARE WITH ID1
CJNE A, 50H, CHECKID2
MOV A,#'0'
CJNE A,51H,CHECKID2
MOV A,#'1'
CJNE A,52H,CHECKID2
-
8/2/2019 Mini Project Documentation Format
41/49
41
SJMP PWDCHECK1 ;IF ID MATCHED GO FOR ITS
PASSWORD
CHECKID2: MOV A,#'1' ;COMPARE WITH ID2
CJNE A,50H,CHECKID3
MOV A,#'0'
CJNE A,51H,CHECKID3
MOV A,#'2'
CJNE A,52H,CHECKID3
SJMP PWDCHECK2
;COMPARE WITH ID3
CHECKID3: MOV A,#'1' ;COMPARE WITH ID3
CJNE A,50H,CHECKID4MOV A,#'0'
CJNE A,51H,CHECKID4
MOV A,#'3'
CJNE A,52H,CHECKID4
SJMP PWDCHECK3
;COMPARE WITH ID4
CHECKID4: MOV A,#'1' ;COMPARE WITH ID4
CJNE A,50H,FFAIL
MOV A,#'0'
CJNE A,51H,FFAIL
MOV A,#'4'
CJNE A,52H,FFAIL
LJMP PWDCHECK4
FFAIL: LJMP FAIL
PWDCHECK1: MOV PWDFIND,#10000001B ;TO SET 8th,1st BIT
THIS LOGIC IS USED TO KNOW WHICH ID'S PASSWORD SHOULD BE COMPARED
MOV DPTR,#MSG2 ;ASK FOR PASSWORD
ACALL DISPLAY
ACALL KEYSCAN ;ENTER PASSWORD
ACALL DELAY
MOV A,KEYCOUNT
CJNE A,#10,PD1 ;IF NO.OF KEYS ENTERD
ARE 10 THEN GO COMPARE WITH ADMINPASSWORD
-
8/2/2019 Mini Project Documentation Format
42/49
42
LJMP ADMIN_PSWD
PD1: MOV PCOUNT1,KEYCOUNT ;LOAD THE NO.OF DIGITS
OF PASSWORD1 IN PCOUNT1
ACALL NEXT ;CHECK WHETHER USER
WANTS TO CHANGE PASSWORD OR NOT
LJMP START2
PWDCHECK2: MOV PWDFIND,#01000010B ;TO SET 7th AND 2nd BIT
MOV DPTR,#MSG2
ACALL DISPLAY
ACALL KEYSCAN
ACALL DELAY
MOV A,KEYCOUNTCJNE A,#10,PD1
LJMP ADMIN_PSWD
PD11: MOV PCOUNT2,KEYCOUNT
ACALL NEXT
LJMP START2
PWDCHECK3: MOV PWDFIND,#00100100B ;TO SET 6th,3rd BIT
MOV DPTR,#MSG2
ACALL DISPLAY
ACALL KEYSCAN
ACALL DELAY
MOV A,KEYCOUNT
CJNE A,#10,PD111
LJMP ADMIN_PSWD
PD111: MOV PCOUNT3,KEYCOUNT
ACALL NEXT
LJMP START2
PWDCHECK4: MOV PWDFIND,#00011000B ;TO SET 5th,4th BIT
MOV DPTR,#MSG2
ACALL DISPLAY
ACALL KEYSCAN
ACALL DELAY
MOV A,KEYCOUNT
CJNE A,#10,PD1111
-
8/2/2019 Mini Project Documentation Format
43/49
43
LJMP ADMIN_PSWD
PD1111: MOV PCOUNT4,KEYCOUNT
ACALL NEXT
LJMP START2
NEXT: MOV A,KEYCOUNT
CJNE A,#3,INTIALCHECK
MOV A,#'1'
CJNE A,50H,INTIALCHECK
CJNE A,51H,INTIALCHECK
CJNE A,52H,INTIALCHECK
INTIALCHECK: ACALL CHECKPWD
ACALL DELAYLJMP SUCCESS
CHECKPWD: JB PWDFIND.7,PSWD1
JB PWDFIND.6,PSWD2
JB PWDFIND.5,PSWD3
JB PWDFIND.4,PSWD4
LJMP START2
PSWD1: MOV A,PCOUNT1
MOV A,#'5' ;COMPARE WITH ID1
CJNE A,50H,K
MOV A,#'5'
CJNE A,51H,K
MOV A,#'5'
CJNE A,52H,K
LJMP SUCCESS
K: LJMP FAIL
PSWD2: MOV A,PCOUNT2
MOV A,#'5' ;COMPARE WITH ID2
CJNE A,50H,AA
MOV A,#'5'
CJNE A,51H,AA
MOV A,#'6'
CJNE A,52H,AA
LJMP SUCCESS
-
8/2/2019 Mini Project Documentation Format
44/49
44
AA: LJMP FAIL
PSWD3: MOV A,PCOUNT3
MOV A,#'5' ;COMPARE WITH ID3
CJNE A,50H,KK
MOV A,#'5'
CJNE A,51H,KK
MOV A,#'7'
CJNE A,52H,KK
LJMP SUCCESS
KK: LJMP FAIL
PSWD4: MOV A,PCOUNT4
MOV A,#'5' ;COMPARE WITH ID4CJNE A,50H,KKK
MOV A,#'5'
CJNE A,51H,KKK
MOV A,#'8'
CJNE A,52H,KKK
LJMP SUCCESS
KKK: LJMP FAIL
RET
KJ: LJMP FAIL
ADMIN_PSWD: MOV A,#'1' ;COMPARE WITH ID ADMIN_PSWD
CJNE A,50H,KJ
MOV A,#'2'
CJNE A,51H,KJ
MOV A,#'3'
CJNE A,52H,KJ
MOV A,#'4'
CJNE A,53H,KJ
MOV A,#'5'
CJNE A,54H,KJ
MOV A,#'6'
CJNE A,55H,KJ
MOV A,#'7'
CJNE A,56H,KJ
-
8/2/2019 Mini Project Documentation Format
45/49
45
MOV A,#'8'
CJNE A,57H,KJ
MOV A,#'9'
CJNE A,58H,KJ
MOV A,#'0'
CJNE A,59H,KJ
;IF ADMIN PASSWORD IS MATCHED THEN DISPLAY THE RESPECTIVE USER'S
PASSWORD
MOV DPTR,#MSG5
ACALL DISPLAY
JB PWDFIND.0,DISP_PWD1
JB PWDFIND.1,DISP_PWD2JB PWDFIND.2,DISP_PWD3
JB PWDFIND.3,DISP_PWD4
DISP_PWD1: MOV A,#0C0H
ACALL COMMAND
ACALL DELAY
MOV DPTR,#PWD1 ;IF THE ID & PSWD ARE
MATCHED THEN PC STARTS
ACALL DISPLAY
ACALL L_DELAY
SJMP DO_AGAIN
;DISPLAY PASSWORD2
DISP_PWD2: MOV A,#0C0H
ACALL COMMAND
ACALL DELAY
MOV DPTR,#PWD2 ;IF THE ID & PSWD ARE
MATCHED THEN PC STARTS
ACALL DISPLAY
ACALL L_DELAY
SJMP DO_AGAIN
;DISPLAY PASSWORD3
DISP_PWD3: MOV A,#0C0H
ACALL COMMAND
ACALL DELAY
-
8/2/2019 Mini Project Documentation Format
46/49
46
MOV DPTR,#PWD3 ;IF THE ID & PSWD ARE
MATCHED THEN PC STARTS
ACALL DISPLAY
ACALL L_DELAY
SJMP DO_AGAIN
;DISPLAY PASSWORD4
DISP_PWD4: MOV A,#0C0H
ACALL COMMAND
ACALL DELAY
MOV DPTR,#PWD4 ;IF THE ID & PSWD ARE
MATCHED THEN PC STARTS
ACALL DISPLAYACALL L_DELAY
DO_AGAIN: LJMP START2
SUCCESS: MOV FAILCOUNT,#0
MOV DPTR,#MSG3
ACALL DISPLAY
ACALL DEVICE
LJMP START2
FAIL: MOV DPTR,#MSG4
ACALL DISPLAY
INC FAILCOUNT
MOV A,#3
CJNE A,FAILCOUNT,TRY1
MOV FAILCOUNT,#0
MOV DPTR,#MSG10
ACALL DISPLAY
SETB P2.7
SJMP $
TRY1: SETB P2.7
ACALL DLAYms
ACALL DLAYms
CLR P2.7
ACALL DELAY
ACALL DELAY
-
8/2/2019 Mini Project Documentation Format
47/49
47
SETB P2.7
ACALL DLAYms
ACALL DLAYms
CLR P2.7
ACALL DELAY
ACALL DELAY
SETB P2.7
ACALL DLAYms
ACALL DLAYms
LJMP START2
DEVICE : MOV DPTR,#MSG7
ACALL DISPLAYACALL DELAY
DD: SETB P2.7
CLR P2.0
SJMP DD
RET
/* LCD DISPLAY SUBROUTINE */
DISPLAY: MOV A,#01H
ACALL COMMAND
ACALL DELAY
DISPLAY1: CLR A
MOVC A,@A+DPTR
JZ XYZ
ACALL DATAWRT
ACALL DELAY
INC DPTR
SJMP DISPLAY1
XYZ: MOV A,#0C4H
ACALL COMMAND
ACALL DELAY
RET
;SEND COMMANDS TO LCD
COMMAND: MOV P1,A
-
8/2/2019 Mini Project Documentation Format
48/49
48
CLR P3.3
CLR P3.4
SETB P3.5
ACALL DELAY
CLR P3.5
RET
;SEND DATA TO LCD
DATAWRT: MOV P1,A
SETB P3.3
CLR P3.4
SETB P3.5
ACALL DELAYCLR P3.5
RET
DELAY: MOV R6,#200
HERE1: MOV R7,#100
HERE: DJNZ R7,HERE
DJNZ R6,HERE1
RET
DLAYms: MOV R6,#100
MOV B,#00
MS1: DJNZ B,$
DJNZ B,$
DJNZ R6,MS1
RET
L_DELAY: MOV R7,#0AH
LLL: LCALL DLAYms
DJNZ R7,LLL
RET
COMM: DB 38H,0EH,01H,06H,84H,00H
ID1: DB "101",0
ID2: DB "102",0
ID3: DB "103",0
ID4: DB "104",0
-
8/2/2019 Mini Project Documentation Format
49/49
PWD1: DB "555",0
PWD2: DB "556",0
PWD3: DB "557",0
PWD4: DB "558",0
ADMINPWD: DB "1234567890",0
MSGA: DB "BITS",0
MSGB: DB "ECE-A,IV YEAR...",0
MSG: DB "SECURITY SYSTEM",0
MSG1: DB "ENTER ID",0
MSG2: DB "ENTER PASSWORD",0
MSG3: DB "SUCCESS",0MSG4: DB "FAIL",0
MSG5: DB "YOUR PSWD IS ",0
MSG6: DB "MAX LENTH OVER ",0
MSG7: DB "SYSTEM ON.. ",0
MSG8: DB "SYSTEM OFF.. ",0
MSG9: DB "INVALID PSWD ",0
MSG10: DB " SYSTEM BLOCKED ",0
MSG11: DB " BITS... ",0
KCODE0: DB '1','2','3'
KCODE1: DB '4','5','6'
KCODE2: DB '7','8','9'
KCODE3: DB '*','0','#'
END