You are on page 1of 57

e

Sr. no Topic Page no.

1 I ntroduction

2 Block Diagram and Description

3 Circuit Diagram and Description

4 PCB Layout

5 Project hardware

6 Project Software

7 Applications and Advantages

8 Future Modifications

9 Conclusion

10 Bibliography

11 Data sheets
CHAPTER 1

I NTRODUCTI ON
1. 0 I NTRODUCTI ON

Security is prime concern in our day- today life. Every one wants to be

as muchas secure as to be possible. An accesscontrol system forms a vital link

in security chain. The micro controller based digital lock present here is an

accesscontrol system that allows only authorized persons to accessa restricted

area. The system comprises a small electronics unit with a numeric keypad,

which is fixed out side the entry door to control a magnetic lock. When an

authorized person enters predetermined number ( password) via the keypad,

the relay operated for a limited time to unlatched the magnetic lock so the

door can be pushed/pulled to open. At the end of present delay, the relay

reenergizes and the door gets locked again. I f the entered password is correct

the display displays that “ Code is correct – access allowed. ” And if the

entered password is wrong it gives three beep signals and display will displays

“ Code is in- correct – Access is denied” .

When the codehas been incorrectly entered five times, the codelock

will switch to alarm relay are turned off after entering a valid user Access

code. This function thwarts any attempt by hackers to quickly try a large

number of codes in a sequence. The secret code can be changed any time

after entering the current code ( Master code)


CHAPTER 2

BLOCK DI AGRAM

AND DESCRI PTI ON


2. 0 Block Diagram

Motor

1&2

Relay 3
2. 1 Block Diagram Description

89C51 Micro- controller based Security Access Control System

has following blocks.

1. Key Pad

2. Micro- controller 89C51

3. LCD display

4. Relay Driver

5. Buzzer

6. Power supply

1. Key Pad:

There are total 12 keys. These are normally open push buttons.

When button is normal i. e. not pressed then it gives logic zero. And

when button is pressed then it gives logic high i. e + 5 Volt i. e. 1.

2. Micro- controller 89C51 :

I t is a low- power, high- performance CMOS 8- bit microcomputer

with 4K bytes of Flash Programmable and Erasable Read Only Memory

( PEROM) . The device is manufactured using Atmel’ s high- density

nonvolatile memorytechnology and is compatible with the MCS- 51™

instruction set and pin- out. The on- chip Flash allows the program memory

to be reprogrammed in- system or by a conventional nonvolatile memory


programmer. By combining a versatile 8- bit CPU with Flash on a monolithic

chip, the Atmel AT89C51 is a powerfulmicrocomputer,which provides a highly

flexible and cost effective solution so many embeddedcontrol applications

3. LCD display :

This display contains two internal byte wise resisters, One for the

commands( RS=0) and second for character to be displayed ( RS=1) .

I t also contains a user programmed RAM area ( the character RAM)

that can be programmed to generate any desired character that can form

using a dot matrix. To distinguish between these two data areas, the hex

commandbyte 80H will be used to signify that display RAM address

00H is chosen. Port 1 is used to furnish the commandor data byte, and

ports 3. 2 to 3. 4 furnish register select and read/write levels. The

display takes varying amounts of time to accomplish the functions. LCD

bit 7 is monitored for logic high ( Busy) to ensure the display is not

overwritten.

This LCD display is used to display the code, error messageetc.

4. Relay Driver :

Output of micro- controller is not sufficient to drive the relay directly.

Therefore to drive the relay we are using relay driver block by using

transistor as switch. The motor is connected at output terminals of the


relay.

5. BUZZER:

This is output device. When wrong code is pressed then buzzer will

turn ON.

6. Power supply:

This block converts 230 Vac into + 5 volt dc and + 12 volts dc.

+ 5 volts is required for key pad, Micro- controller 89C51 board

and LCD display.

+ 12 Volts are required for Relay driver circuit, motor and Buzzer.
CHAPTER 3

CI RCUI T DI AGRAM

AND DESCRI PTI ON


3. 0 Circuit Diagram
3. 1 Circuit Diagram Description

Microcontroller 89C51 is heart of our project. I t has four ports,

port 0, port1, port2, port 3. I n our project we are using switch to enter the

number. The switches are normally open and normally it gives logic one

output. When we press the button switch will becomeclose, and it gives logic

zero to microcontroller. Through program microcontroller will check the digit.

Relay is used to drive the motor. Actually there are two relays to

drive the motor in forward direction and in reverse direction. Normally both

relays are de- energized therefore motor is off and door remains closed.

When we press the right code then the relay1 will turn ON and supply is

given to motor, to open the door. Door will open for predefined time. After

predefined time, relay1 turns off and relay 2 turns ON. As relay 2 turns

ON the supply is given to motor, to close the door. After sometime the

relay 2 will turn OFF

When we press wrong code then the buzzer will turn on and no

supply is given to relay 1 and relay 2. Therefore door remains closed.

LCD is used to display the code entered.


CHAPTER 4

PCB Layout
4. 1 PCB Layout
CHAPTER 5

PROJECT

HARDWARE
5 Project Hardware:

I n our project weusesfollowinghardware

5. 1 Microcontroller 89C51

5. 2 Voltage Regulator 78XX series

5. 3 Relay

5. 4 Capacitors

5. 5 Diodes

5. 6 Light Emitting Diodes ( LEDs)

5. 7 Buzzer and Bleeper

5. 8 Presets

5. 9 Transistors
5. 1 Microcontroller 89C51

The AT89C51 is a low- power , high- performance CMOS 8- bit

microcomputer with 4K bytes of flash programmable and erasable read only

memory ( PEROM) . The device is manufactured using Atmel’ s high-

density nonvolatile memorytechnology and is compatible with the industry-

standard MCS- 51 instruction set and pin out. The on- chip Flash allows

the program memoryto be reprogrammed in- system or by a conventional

nonvolatile memoryprogrammer. By combining a versatile 8- bit CPU with

Flash on a monolithic chip, the Atmel AT89C51 is a powerful

microcomputerwhich provides a highly- flexible and cost- effective solution

to many embeddedcontrol applications.

The AT89C51 is designed with static logic for operation down to

zero frequency and supports two Software selectable power saving modes.

The I dle Mode stops the CPU while allowing the RAM, timer / counters

, serial port and interrupt system to continue functioning. The Power- down

Mode saves the RAM contents but freezes the oscillator disabling all other chip

functions until the next Hardware reset.


Features of 89C51

Following are the features of 89C51 Microcontroller as per the

datasheet given by Atmel-

 Compatible with MCS- 51TM Products.

 4K Bytes of I n- system Reprogrammable Flash MemoryEndurance

 1, 000 Write / Erase Cycles.

 Fully Static Operation : 0 Hz to 24 MHz

 Three- level Program Memory Lock

 128 x 8- bit I nternal RAM

 32 Programmable I / O Lines.

 Two 16- bit Timer / Counters

 Six I nterrupt Sources

 Programmable Serial Channel

 Low- powerI dle and Power- downModes


Pin Diagram of 89C51 Microcontroller
Pin Description

VCC: - Supply Voltage

GND: - Ground

Port 0: - Port 0 is an 8- bit open- drain bi- directional I /O port. As

an output port, each pin can sink eight TTL inputs. When 1s are written

to port 0 pins, the pins can be used as high impedance inputs. Port 0

may also be configured to be the multiplexed low order address / data bus

during accessesto external program and data memory. I n this mode P0

has internal pull- ups. Port 0 also receives the code bytes during Flash

programming, and outputs the code bytes during program verification.

External pull- ups are required during program verification.

Port 1: - Port 1 is an 8- bit bi- directional I / O port with internal

pull- ups. The port 1output buffers can sink/source four TTL inputs. When

1s are written to port 1 pins they are pulled high by the internal pull- ups

and can be used as inputs. As inputs , Port 1 pins that are externally

being pulled low will source current ( I I L) becauseof the internal pull-

ups. Port 1 also receives the low- order address bytes during Flash

programming and verification.

Port 2: - Port 2 is an 8- bit bi- directional I / O port with internal pull-

ups. The port 2 output buffers can sink / source four TTL inputs. When 1s

are written to Port 2 pins they are pulled high by the internal
pull- ups and can be used as inputs. As inputs, Port 2 pins that are

externally being pulled low will source current ( I I L) becauseof the

internal pull- ups. Port 2 emits the high- order address byte during fetches

from external program memory and during accesses to external data

memory that uses 16- bit addresses ( MOVX @ DPTR) . I n this

application, it uses strong internal pull- ups when emitting 1s. During

accessesto external data memorythat uses 8- bit addresses ( MOVX @

RI ) , Port 2 emits the contents of the P2 Special Function Register.

Port 2 also receives the high- order address bits and somecontrol signals

during Flash programming and verification.

Port 3: - Port 3 is an 8- bit bi- directional I /O port with internal

pull- ups. The Port 3 output buffers can sink / source four TTL inputs.

When 1s are written to Port 3 pins they are pulled high by the internal

pull- ups and can be used as inputs. As inputs, Port 3 pins that are

externally being pulled low will source Current ( I I L) becauseof the pull-

ups.

Port 3 also serves the functions of various special features of the

AT89C51 as listed below , Port Pin Alternate Functions –

P3. 0 RXD ( Serial input port)


P3. 1 TXD ( Serial output port)
P3. 2 I NT0 ( External I nterrupt 0)
P3. 3 I NT1 ( External I nterrupt 1)
P3. 4 T0 ( Timer0 external input)
P3. 5 T1 ( Timer 1 external input)
P3. 6 WR ( External data memory write strobe)
P3. 7 RD ( External data memory readstrobe)

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 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. I n normal

operation ALE is emitted at a constant rate 1 / 6 the oscillator frequency,

and may be used for external timing or clocking purposes. Note, however ,

that one ALE pulse is skipped during each access to external Data

Memory. I f desired, ALE operation can be disabled by setting bit 0 of

SFR location 8EH. With the bit set, ALE is active only during a MOVX

or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting

the ALE- disable bit has no effect if the Microcontroller is in external

execution mode.

PSEN: - Program Store Enable is the read strobe to external program

memory. When the AT89C51 is executing code from external program


memory, PSEN is activated twice each cycle, except that two PSEN

activations are skipped during each access to external data 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. Note, however,

that if lock bit 1 is programmed , EA will be internally latched on reset.

EA should be strapped to VCC for internal program executions. The pin

also receives the 12- volt programming enable voltage ( VPP) during

Flash programming, for parts that require 12- volt VPP.

XTAL1: - I nput to the inverting oscillator amplifier and input to the

internal clock operating circuit.

XTAL2: - Output from the inverting oscillator amplifier.


5. 2 Three Terminal Voltage Regulator: -

General Features: -

A three terminal voltage regulator is a regulator in

which the output voltage is set at some predetermined

value. Such regulators do not require an external

feedback connection. Hence, only three

terminals are required for device of suchtypes, input ( Vin) output ( Vo) and

a ground terminal. Since the regulator operates at a preset output voltage

the current limiting resistor is also internal to the device. The main

advantages of such regulators are the simplicity of connections to the

external circuit and the minimum of external components. Fig. Shows the

basic circuit configuration of the three terminal voltage regulator. Although,

the three terminal regulators offers only fixed output voltages,there are wide

variety of voltages available, both + Ve and – Ve. The output current range

from 100 m A to 3 A.

LM 78 MXX series3 terminal positivevoltageregulators.

General description: -

The LX78MXX series of three terminal regulators is available with

several fixed output voltages making them useful in a wide range of

applications. The voltage available allow these regulators to be used in logic

system, instrumentation, Hi – Fi and other solid state electronic


equipment. Although designed primarily devices can be used with external

componentto obtain adjustable voltage and current.

Features:

1) I nternal thermal overload protection.

2) NO external componentsrequired.

3) Output transistor safe area protection.

4) I nternal short circuit current limit.

5) Circularity allows start up even if output is pulled to negative

voltage ( I supplies)

Absolute maximum rating:

I nput voltage 35 V

internal power dissipation I nternally limited.

Operatingtemperaturerange 00 to 700 c

Maximum junction temperature + 1250c

Storage temperature range - 650v to

1500c Lead temperature + 2300c


5. 3 Relay:

A relay is an electrically operated

switch. Current flowing through the coil of

the relay creates a magnetic field, which

attracts a lever and changes the switch

contacts. The coil current can be on or off so

relays have two switch positions and

they are double throw ( changeover) switches.

Relays allow one circuit to switch a second circuit, which can be

completely separate from the first. For example a low voltage battery circuit

can use a relay to switch a 230V AC mains circuit. There is no electrical

connection inside the relay between the two circuits; the link is magnetic and

mechanical.

The coil of a relay passes a relatively large current, typically 30mA

for a 12V relay, but it can be as much as 100mA for relays designed to

operate from lower voltages. Most I Cs ( chips) cannot provide this current

and a transistor is usually used to amplify the small I C current to the larger

value required for the relay coil. The maximumoutput current for the popular

555 timer I C is 200mA so these devices can supply relay coils directly

without amplification.

Relays are usually SPDT or DPDT but they can have many more
sets of switch contacts, for example relays with 4 sets of changeover contacts

are readily available. For further information about switch contacts and the

terms used to describe them please see the page on switches.

Most relays are designed for PCB mounting but you can solder wires

directly to the pins providing you take care to avoid melting the plastic

case of the relay.

The supplier' s catalogue should show you the relay' s connections.

The coil will be obvious and it may be connected either way round. Relay

coils produce brief high voltage' spikes' when they are switched off and

this can destroy transistors and I Cs in the circuit. To prevent damage you

mustconnect a protection diode across the relay coil.

The animated picture shows a working relay with its coil and switch

contacts. You can see a lever on the left being attracted by magnetism when

the coil is switched on. This lever moves the switch contacts. There is one

set of contacts ( SPDT) in the foreground and another behind them, making

the relay DPDT


Choosing a relay

You need to consider several features when choosing a relay:

Physical size and pinarrangement.

I f you are choosing a relay for an existing PCB you will need to ensure

that its dimensions and pin arrangement are suitable. You should find this

information in the supplier' s catalogue.

Coil voltage :

The relay' s coil voltage rating and resistance must suit the circuit

powering the relay coil. Many relays have a coil rated for a 12V supply

but 5V and 24V relays are also readily available. Some relays operate

perfectly well with a supply voltage which is a little lower than their rated

value.

Coil resistance

The circuit must be able to supply the current required by the relay

coil. You can use Ohm' slaw to calculate the current:

supplyvoltage
Relay coil current =
coil resistance
For example: A 12V supply relay with a coil resistance of 400

passes a current of 30mA. This is OK for a 555 timer I C ( maximum

output current 200mA) , but it is too muchfor mostI Cs and they will

require a transistor to amplify the current.

Switch ratings ( voltage and current)


The relay' s switch contacts must be suitable for the circuit they are

to control. You will need to check the voltage and current ratings. Note that

the voltage rating is usually higher for AC, for example: " 5A at 24V DC

or 125V AC" .

Switch contact arrangement ( SPDT, DPDT etc)

Most relays are SPDT or DPDT which are often described as

" single pole changeover" ( SPCO) or " double pole changeover"

( DPCO) . For further information please see the page on switches.

Protection diodes for relays

Transistors and I Cs ( chips) mustbe protected from the brief high

voltage ' spike' produced when the relay coil is switched off. The diagram

shows how a signal diode ( eg 1N4148) is connected across the relay

coil to provide this protection. Note that the diode is connected

' backwards' so that it will normally not conduct. Conduction only occurs

when the relay coil is switched off, at this momentcurrent tries to

continue flowing through the coil and it is harmlessly diverted through the

diode. Without the diode no current could flow and the coil would produce

a damaging high voltage ' spike' in its attempt to keep the current flowing.

Relays and transistorscompared

Like relays, transistors can be used as an electrically operated

switch. For switching small DC currents ( < 1A) at low voltage they are
usually a better choice than a relay. I n these cases a relay will be needed,

but note that a low powertransistor may still be needed to switch the

current for the relay' s coil! The main advantages and disadvantages of

relays are listed below:

Advantages of relays:

 Relays can switch AC and DC, transistors can only switch DC.

 Relays can switch high voltages, transistorscannot.

 Relays are a better choice for switching large currents ( > 5A) .

 Relays can switch many contacts at once.

Disadvantages of relays:

 Relays are bulkier than transistors for switching small currents.

 Relays cannot switch rapidly ( except reed relays) , transistors can switch

many times per second.

 Relays use more power due to the current flowing through their coil.

 Relaysrequire more current than many chips can provide, so a lowpower

transistor may be needed to switch the current for the relay' s coil.
5. 4Capacitors

Capacitors store electric charge. They are used to smooth varying DC

supplies by acting as a reservoir of charge. They are also used in filter circuits

because capacitors easily pass AC ( changing) signals but they block DC (

constant) signals.

Polarised capacitors ( large values, 1µF + )

Electrolytic capacitors are polarized and they

must be connected the correct way round, at

least one of their leads will be marked + or - .

They are not damaged byheat when soldering.

There are two designs of electrolytic

capacitors; axial where the leads are attached to each end ( 220µF in picture)

and radial where both leads are at the same end ( 10µF in picture) . Radial

capacitors tend to be a little smaller and they stand upright on the circuit

board.

I t is easy to find the value of electrolytic capacitors because they

are clearly printed with their capacitance and voltage rating. The voltage

rating can be quite low and it should always be checked when selecting an

electrolytic capacitor.
Unpolarised capacitors ( small values, up to 1µF)

Small value capacitors are unpolarised

and may be connected either way round.

They are not damagedby heat when soldering,

except for one unusual type ( polystyrene) .

I t can be difficult to find the values of these

small capacitors because there are many types of them and several different

labeling systems.

Many small value capacitors have their value printed but without a

multiplier, so you need to use experience to work out what the multiplier

should be!

5. 5 Diodes

Diodes allow electricity to flow in

only one direction. The arrow of the circuit

symbol shows the direction in which the

current can flow. Diodes are the electrical

version of a valve and early diodes were

actually called valves.


Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode,

rather like a person pushing through a door with a spring. This meansthat

there is a small voltage across a conducting diode, it is called the forward

voltage drop and is about 0. 7V for all normal diodes which are made from

silicon. The forward voltage drop of a diode is almost constant whatever

the current passing through the diode so they have a very steep

characteristic ( current- voltage graph) .

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct,

but all real diodes leak a very tiny current of a few µA or less. This can

be ignored in mostcircuits becauseit will be very muchsmaller than the

current flowing in the forward direction. However, all diodes have a

maximum reverse voltage ( usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction, this is

called breakdown.

Ordinary diodes can be split into two types: Signal diodes which

pass small currents of 100mA or less and Rectifier diodes which can pass

large currents. I n addition there are LED ( which have their own page)

and Zener diodes ( at the bottom of this page) .


5. 6 Light Emitting Diodes ( LEDs)

LEDs emit light when an electric current passes through them.

Colours of LEDs

LEDs are available in red, orange, amber, yellow, green, blue and white.

Blue and white LEDs are muchmore expensive than the other colours.

The colour of an LED is determined by the semiconductor material,

not by the colouring of the ' package' ( the plastic body) . LEDs of all

colours are available in uncoloured packageswhich may be diffused ( milky)

or clear ( often described as ' water clear' ) . The coloured packages are

also available as diffused ( thestandard type) or transparent.


Bi- colour LEDs

A bi- colour LED has two LEDs wired in ' inverse

parallel' ( one forwards, one backwards) combined in one package

with two leads. Only one of the LEDs can be lit at one time and

they are less useful than the tri- colour LEDs described above.

Calculating an LED resistor value

An LED must have a resistor connected in series to limit the current

through the LED, otherwise it will burn out almost instantly.

The resistor value, R is given by:

R = ( VS - VL)

/I

VS = supply voltage

VL = LED voltage ( usually 2V, but 4V for blue and white LEDs)

I = LED current ( e. g. 20mA) , this mustbe less than the maximum

permitted

I f the calculated value is not available choose the nearest standard

resistor value which is greater, so that the current will be a little less than

you chose.I n fact you maywish to choosea greater resistor value to reduce

the current ( to increase battery life for example) but this will make the

LED lessbright.
For example

I f the supply voltage VS = 9V, and you have a red LED ( VL =

2V) , requiring a current I = 20mA = 0. 020A,

R = ( 9V - 2V) / 0. 02A = 350 , so choose 390 ( the nearest

standard value which is greater) .

5. 7 Buzzer and Bleeper

These devices are output transducers

converting electrical energy to sound. They contain

an internal oscillator to produce the sound, which is

set at about 400Hz for buzzers and about 3kHz for

bleepers.

Buzzers have a voltage rating but it is only approximate, for example

6V and 12V buzzers can be used with a 9V supply. Their typical current is

about 25mA.

Bleepers have wide voltage ranges, such as 3- 30V, and they pass a

low current of about 10mA.

Buzzers and bleepers mustbe connected the right way round, their red

lead is positive ( + ) .
5. 8 Presets

These are miniature versions of the standard

variable resistor. They are designed to be mounted

directly onto the circuit board and adjusted only

when the circuit is built. For example to set the

frequency of an alarm tone or the sensitivity of a light- sensitive circuit. A

small screwdriver or similar tool is required to adjust presets.

Presets are muchcheaper than standard variable resistors so they are

sometimesused in projects where a standard variable resistor would normally be

used.

Multiturn presets are used where very precise adjustments must be

made. The screw must be turned many times ( 10+ ) to move the slider

from one end of the track to the other, giving very finecontrol.

5. 9 Transistors

Transistors amplify current, for example they can be

used to amplify the small output current from a logic chip

so that it can operate a lamp, relay or other high current

device. I n many circuits a resistor is used to

convert the changing current to a changing voltage, so the transistor is

being used to amplify voltage.

A transistor may be used as a switch ( either fully on with


maximum current, or fully off with no current) and as an amplifier (

always partly on) . The amount of current amplification is called the current

gain, symbol hFE.

Types of transistor

There are two types of standard transistors,

NPN and PNP, with different circuit symbols.

The letters refer to the layers of semiconductor

material used to make the transistor. Most transistors used today are NPN

because this is the easiest type to make from silicon. I f you are new to

electronics it is best to start by learning how to use NPN transistors.

The leads are labelled base ( B) , collector ( C) and emitter

( E) .

These terms refer to the internal operation of a transistor but they are not much

help in understanding how a transistor is used, so just treat them as labels!


CHAPTER 6

SYSTEM SOFTWARE
6. Program:

;*************************************************
*********************
; TI TAL : ADVANCED SECURI TY SYSTEM
;*************************************************
**********************
; P0. 0 = SWI TCH 0 = FOR DI GI T 0
; P0. 1 = SWI TCH 1 = FOR DI GI T 1
; P0. 2 = SWI TCH 2 = FOR DI GI T 2
; P0. 3 = SWI TCH 3 = FOR DI GI T 3
; P0. 4 = SWI TCH 4 = FOR DI GI T 4
; P0. 5 = SWI TCH 5 = FOR DI GI T 5
; P0. 6 = SWI TCH 6 = FOR DI GI T 6
; P0. 7 = SWI TCH 7 = FOR DI GI T 7
; P2. 0 = SWI TCH 8 = FOR DI GI T 8
; P2. 1 = SWI TCH 9 = FOR DI GI T 9
; P2. 2 = SWI TCH 10 = FOR ENTER
; P2. 3 = SWI TCH 11 = FOR PROGRAM
; P2. 4 = FORWARD MOTOR I . E OPEN DOOR
; P2. 5 = REVERSE MOTOR I . E CLOSE DOOR
; P2. 6 = BUZZER
; R0 = LSB
; R1 = NEXT TO LSB
; R2 = MSB
; R5 = I NPUT KEY
; R6 = DELAY
; R7 = DELAY
;------------------------------------------------------------------
-----------
; PROGRAM STARTS HERE:

ORG 0000H

CLR P2. 4
CLR P2. 5
CLR P2. 6

MOV DPTR, # COMM1


UP1: CLR A
MOVC A, @A+ DPTR
I NC DPTR
CJNE A, # ' $ ' , COMMAND1
UP772: ACALL LOCKDI SPLAY
ACALL COLLAGEDI SPLAY
MOV A, P2
ANL A, # 04H
JNZ UP772
UP22: MOV
R0, # 7EH MOV
R1, # 7EH
MOV R2, # 7EH
ACALL LCDDI SPLAY
ACALL SWREAD
MOV R2, A
ACALL LCDDI SPLAY
ACALL SWREAD
MOV R1, A
ACALL LCDDI SPLAY
ACALL SWREAD
MOV R0, A
UP012: ACALL SETDI SPLAY
MOV A, P2
ANL A, # 0CH
CJNE A, # 0CH, PRGORFI X
AJMP UP012
;------------------------------------------------------------------
-----------
COMMAND1: ACALL COMMAND
AJMP UP1
;------------------------------------------------------------------
-----------
PRGORFI X:
CJNE A, # 08H, UP22
MOV 30H, R0
MOV 31H, R1
MOV 32H, R2
MOV 46H, # 00H
MOV 45H, # 03H
UP223: ACALL SAVEDI SPLAY
DJNZ 45H, UP223

SKAGAI N:
MOV R0, # 0FFH
MOV R1, # 0FFH
MOV R2, # 0FFH
ACALL LCDDI SPLAY
ACALL SWREAD
MOV R2, A
ACALL LCDDI SPLAY
ACALL SWREAD
MOV R1, A
ACALL LCDDI SPLAY
ACALL SWREAD
MOV R0, A
UP0122: ACALL SETDI SPLAY
MOV A, P2
ANL A, # 0CH
CJNE A, # 0CH, PRGORFI X2
AJMP UP0122
PRGORFI X2:
CJNE A, # 08H, SKAGAI N
MOV A, R0
CJNE A, 30H, DENIED
MOV A, R1
CJNE A, 31H, DENI ED
MOV A, R2
CJNE A, 32H, DENIED
MOV 46H, # 00H

SETB P2. 4

MOV 45H, # 03H


UP_D09: LCALL DELAY
DJNZ 45H, UP_D09

CLR P2. 4

MOV 45H, # 0FH


UP2232: ACALL ALLOWDI SPLAY
DJNZ 45H, UP2232

SETB P2. 5
MOV 45H, # 05H
UP_DD: LCALL DELAY
DJNZ 45H, UP_DD
CLR P2. 5

SJMP SKAGAI N
;------------------------------------------------------------------
-----------
DENI ED:
MOV A, 46H
CJNE A, # 03H, DDDD1
SETB P2. 6
YAHA: LCALL HANG
SJMP YAHA
DDDD1: I NC 46H
SETB P2. 6
MOV 45H, # 0FH
DENI ED1: ACALL DENI EDI SPLAY
DJNZ 45H, DENI ED1
CLR P2. 6
SJMP SKAGAI N
;
LOCKDI SPLAY:
MOV A, # 01H
ACALL COMMAND
MOV A, # 80H
ACALL COMMAND
MOV R0, # 05H
P225: ACALL DELAY
DJNZ R0, P225
MOV DPTR, # LINE72
LCALL DI SPLAY_LI NE
MOV A, # 0C0H
ACALL COMMAND
MOV DPTR, # LINE73
LCALL DI SPLAY_LI NE
MOV R0, # 05H
UP525: ACALL DELAY
DJNZ R0, UP525
RET
;----------------------------------------------------------
DI SPLAY_LI NE:
CLR A
MOVC A, @A+ DPTR
I NC DPTR
CJNE A, # ' $ ' , GO_TO_DISPLAY
RET
GO_TO_DI SPLAY:
ACALL DI SPLAY
AJMP DI SPLAY_LI NE
;-------------------------------------------------------------
COLLAGEDI SPLAY:
MOV A, # 01H
ACALL COMMAND
MOV A, # 80H
ACALL COMMAND
MOV R0, # 05H
P5225: ACALL DELAY
DJNZ R0, P5225
MOV DPTR, # LINE572
LCALL DI SPLAY_LI NE
MOV A, # 0C0H
ACALL COMMAND
MOV DPTR, # LINE573
LCALL DI SPLAY_LI NE
MOV R0, # 05H
UP5525: ACALL DELAY
DJNZ R0, UP5525
RET
;------------------------------------------------------------------
-----
SAVEDI SPLAY:
MOV A, # 01H
ACALL COMMAND
MOV A, # 80H
ACALL COMMAND
MOV R0, # 05H
P2251: ACALL DELAY
DJNZ R0, P2251
MOV DPTR, # LINE721
LCALL DI SPLAY_LI NE
MOV A, # 0C0H
ACALL COMMAND
MOV DPTR, # LINE731
LCALL DI SPLAY_LI NE
MOV R0, # 05H
UP5251: ACALL DELAY
DJNZ R0, UP5251
RET
;------------------------------------------------------------------
-------
ALLOWDI SPLAY:
MOV A, # 01H
ACALL COMMAND
MOV A, # 80H
ACALL COMMAND
MOV R0, # 05H
P02251: ACALL DELAY
DJNZ R0, P02251
MOV DPTR, # LINE0721
LCALL DI SPLAY_LI NE
MOV A, # 0C0H
ACALL COMMAND
MOV DPTR, # LINE0731
LCALL DI SPLAY_LI NE
MOV R0, # 05H
UP05251: ACALL DELAY
DJNZ R0, UP05251
RET
;------------------------------------------------------------------
--------
; DELAY SUBROUTI NE USED TO GENERATE DELAY OF 1 SECONDS:
;------------------------------------------------------
DELAY: MOV R7, # 0FAH
LOOP1: MOV R6, # 0FFH
LOOP: DJNZ R6, LOOP
DJNZ R7, LOOP1
RET
;------------------------------------------------------------------
-----------
; LCD DI SPLAY SUBROUTI NES
;-----------------------
LCDDI SPLAY:
ACALL DELAY
MOV A, # 01H
ACALL COMMAND
MOV A, # 80H
ACALL COMMAND
MOV DPTR, # LINE1
LCALL DI SPLAY_LI NE
UP1234: MOV A, # 0C0H
ACALL COMMAND
MOV DPTR, # LINE2
LCALL DI SPLAY_LI NE
MOV A, # 20H
ACALL DI SPLAY
MOV A, R2
ORL A, # 30H
ACALL DI SPLAY
MOV A, R1
ORL A, # 30H
ACALL DI SPLAY
MOV A, R0
ORL A, # 30H
ACALL DI SPLAY
MOV A, # 0A1H
ACALL DI SPLAY
RET
;------------------------------------------------------------------
----
SETDI SPLAY:
ACALL DELAY
MOV A, # 01H
ACALL COMMAND
MOV A, # 80H
ACALL COMMAND
MOV DPTR, # LINE11
LCALL DI SPLAY_LINE
AJMP UP1234
;------------------------------------------------------------------
-------
; COMMAND SUBROUTI NE USED TO I NI TI LI SE LCD DI SPLAY:
;-------------------------------------------------
COMMAND: ACALL READY
MOV P1, A
CLR P3. 2
CLR P3. 3
SETB P3. 4
CLR P3. 4
RET
;------------------------------------------------------------------
------
; DI SPLAY SUBROUTI NE USED TO DI SPLAY DATA ON LCD DI SPLAY:
DI SPLAY: ACALL READY
MOV P1, A
SETB P3. 2
CLR P3. 3
SETB P3. 4
CLR P3. 4
RET
;------------------------------------------------------------------
-------
; READY SUBROUTI NE USED TO CHECK THE LCD STATUS i. e. BUSY OR NOT
READY: CLR P3. 4
MOV P1, # 0FFH
CLR P3. 2
SETB P3. 3
WAI T: CLR P3. 4
SETB P3. 4
JB P1. 7, WAI T
CLR P3. 4
RET
;------------------------------------------------------------------
-----------
SWREAD:
MOV R5, # 00H
MOV A, P0
CJNE A, # 0FFH, CHECKSW
MOV A, P2
ANL A, # 03H
CJNE A, # 03H, CHECKSW1
AJMP SWREAD
CHECKSW: RRC A
JNC DOWN111
I NC R5
AJMP CHECKSW
DOWN111: MOV A, P0
CJNE A, # 0FFH, DOWN111
MOV A, R5
RET
CHECKSW1:
MOV R5, # 08H
CHECKSW11: RRC A
JNC DOWN1111
I NC R5
AJMP CHECKSW11
DOWN1111: MOV A, P2
ANL A, # 03H
CJNE A, # 03H, DOWN1111
MOV A, R5
RET
;----------------------------------------------------------------
DENI EDI SPLAY:
MOV A, # 01H
ACALL COMMAND
MOV A, # 80H
ACALL COMMAND
MOV R0, # 05H
PK02251: ACALL DELAY
DJNZ R0, PK02251
MOV DPTR, # LINE0721K
LCALL DI SPLAY_LI NE
MOV A, # 0C0H
ACALL COMMAND
MOV DPTR, # LINE0731K
LCALL DI SPLAY_LI NE
MOV R0, # 05H
UP05251K: ACALL DELAY
DJNZ R0, UP05251K
RET
;------------------------------------------------------------------
------
HANG:
MOV A, # 01H
ACALL COMMAND
MOV A, # 80H
ACALL COMMAND
MOV R0, # 02H
P22517: ACALL DELAY
DJNZ R0, P22517
MOV DPTR, # LINE7217
LCALL DI SPLAY_LI NE
MOV A, # 0C0H
ACALL COMMAND
MOV DPTR, # LINE7317
LCALL DI SPLAY_LI NE
MOV R0, # 02H
UP52517: ACALL DELAY
DJNZ R0, UP52517
RET
;*************************************************
*****************************
COMM1: DB 3CH, 0EH, 06H, 01H, ' $ '
LI NE1: DB ' SECURI TY SYSTEM. $ '
LI NE2: DB ' ENTER CODE =$ '
LI NE72: DB ' SECURI TY ACCESS $ '
LI NE73: DB ' CONTROL SYSTEM. $ '
LI NE572: DB ' GOVT. POLY. KARAD. $ '
LI NE573: DB ' TY EE PRESENTS$ '
LI NE721: DB ' NEW PASSWARD $ '
LI NE731: DB ' SAVED. $'
LI NE0721: DB ' CODE I S CORRECT. $ ' LI
NE0731: DB ' ACCESS ALLOWED $ ' LI
NE11: DB ' PRESS EN2FI X/PRG$ '
LI NE0721K: DB ' CODE I N- CORRECT. $ '
LI NE0731K: DB ' ACCESS DENI ED. $ '
LI NE7217: DB ' System is Hanged$'
LI NE7317: DB ' Press Reset. $ '
CHAPTER 7

APPLCATI ONS

AND

ADVANTAGE

7. 1 Applications:
 Digital card accessin telephone exchange.

 Electrical application access.

 Door locking system.

 Password protected accessto PC.

 Access to electronic circuit.

 Locker in bank.

 Antitheft system design.

7. 3 Advantages:

 The system used is microcontroller based.

 Too little space is required for it to set for any operation at any

location.

 Used of keyboard matrix for entering password in simple way.

 LCD display which makes very easy to understand the operation taking

place.

 Reset button is available for resetting the system.

 There is also facility of changing password.

 Simple circuit which can easily be understood.

 Moderate price.
CHAPTER 8

FUTURE

MODI FI CATI ONS


8. 0 Future Modifications:

I n future from our point of view we will not make use of password

instead of that we shall be able to make use of detecting finger print or again

in any advance technology detecting face or eyes, etc.


CHAPTER 9

CONCLUSI ON
9. 0 CONCLUSI ON

I t was are pleasure that we deal with our project “ 89C51 Micro-

controller based Security Access Control System” ”

Thus we can say that with this project we can automatically control the lock

just by giving the password, for security purpose. So only the user can

access it by entering the correct password.


CHAPTER 10

BI BLI OGRAPHY
10. 0 BI BLI OGRAPHY

1. The 8051 Microcontroller

- Kenneth J. Ayala

2. Microcontroller 89C51 data Manual

- I ntel

3. Web site : www.google. com

4. web site : www.geocities. com/sk_instru


CHAPTER 11

DATA SHEETS

You might also like