Top Banner

of 34

8th Sem Report

Apr 05, 2018

Download

Documents

Bhaswati Mandal
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/2/2019 8th Sem Report

    1/34

    1

    CHAPTER 1

    INTRODUCTION

    An electronic lock is a device which has an electronic control assembly attached to it.

    They are provided with an access control system. This system allows the user to unlock the

    device with a password. The password is entered by making use of a keypad. The user can

    also set his password to ensure better protection.

    The major components include a keypad, LCD and the controller AT89C51 which

    belongs to the 8051 series of microcontrollers. A 4x4 matrix keypad and a 16x2 LCD have

    been used here. Keypad and LCD are very commonly used input & output devices,

    respectively. A four digit predefined password needs to be specified the user. This password

    is stored in the system.

    http://www.engineersgarage.com/microcontroller/8051projects/interface-keypad-AT89C51http://www.engineersgarage.com/content/lcdhttp://www.engineersgarage.com/at89c51-or-89c51-microcontrollerhttp://www.engineersgarage.com/8051-microcontrollerhttp://www.engineersgarage.com/microcontroller/8051projects/interface-keypad-AT89C51http://engineersgarage.com/content/lcdhttp://en.wikipedia.org/wiki/File:Gateman-sb740.jpghttp://engineersgarage.com/content/lcdhttp://www.engineersgarage.com/microcontroller/8051projects/interface-keypad-AT89C51http://www.engineersgarage.com/8051-microcontrollerhttp://www.engineersgarage.com/at89c51-or-89c51-microcontrollerhttp://www.engineersgarage.com/content/lcdhttp://www.engineersgarage.com/microcontroller/8051projects/interface-keypad-AT89C51
  • 8/2/2019 8th Sem Report

    2/34

    2

    CHAPTER 2

    WORKING PRINCIPLE

    The working principle of our system is simple and economy. The entire concept is

    based on microcontroller. While unlocking, if the entered password from keypad matches

    with the stored password, then the lock opens and a message is displayed on LCD. Also an

    output pin is made high to be used for further purpose. For the input the keypad is scanned

    for pressed digits one by one. Every time, row and column of the key pressed is detected.

    2.1 BLOCK DIAGRAM FOR ELECTRONIC LOCKER

    t

    output

    Fig 2.1

    Here the input code is given from the switch matrix. One code is set as a default. The

    interfacing between the switch matrix and microcontroller, the microcontroller and LCD is

    done by programming . Fig 1.1 shows the block diagram of the Electronic Locker.

    8051 micro

    controller

    Switch matrix

    L

    C

    D

    Relay

  • 8/2/2019 8th Sem Report

    3/34

    3

    CHAPTER 3

    BUILDING BLOCKS SPECIFICATION

    3.1 INPUT UNIT

    The input of the locker is given from a 4x4 switch matrix.

    Switch Matrix

    The code word (key) of the locker is set by 4x4 switch matrix.

    General description:

    In general, switch matrix are organized as a matrix of rows and columns. One side of

    this matrix is connected to 6V through resistors while the other side is connected to the

    ground. To detect which switch is pressed we ground all rows, then read all columns.initially.

    When no switch is pressed, all the columns are high. If a switch is pressed, one of the

    columns is low. The switch which is pressed, becomes grounded and other unpressed switch

    is in highstage.The circuit diagram of the matrix is shown in the figure.

    Fig 3.1

  • 8/2/2019 8th Sem Report

    4/34

    4

    3.2 8051 Microcontroller

    We are using here an AT89C51 microcontroller which is a 8051 family

    microcontroller. The Intel 8051 is an 8-bit microcontroller which means that most available

    operations are limited to 8 bits.

    Some of the features of 8051 are:

    4 KB on chip program memory. 128 bytes on chip data memory(RAM). 4 reg banks.

    128 user defined software flags. 8-bit data bus 16-bit address bus 32 general purpose registers each of 8 bits 16 bit timers (usually 2, but may have more, or less). 3 internal and 2 external interrupts. Bit as well as byte addressable RAM area of 16 bytes. Four 8-bit ports, (short models have two 8-bit ports). 16-bit program counter and data pointer. 1 Microsecond instruction cycle with 12 MHz Crystal.

  • 8/2/2019 8th Sem Report

    5/34

    5

    Pin diagram:

    Fig 3.2: Pin diagram of the 8051

    Basic Pins

    PIN 9: PIN 9 is the reset pin which is used to reset the microcontrollers internal registers and

    ports upon starting up. (Pin should be held high for 2 machine cycles.)

    PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a

    crystal at these pins to provide clock pulses to the circuit.

    PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V

    500mA to function properly, although there are lower powered versions like the Atmel 2051

    which is a scaled down version of the 8051 which runs on +3V.

    PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash

    memory. In order to program this we need to supply a voltage of +12V at pin 31. If external

    memory is connected then PIN 31, also called EA/VPP, should be connected to ground to

    indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which

    is used when multiple memory chips are connected to the controller and only one of them

    needs to be selected.We will deal with this in depth in the later chapters. PIN 29 is called

    http://en.wikibooks.org/wiki/File:Pinouts8051.jpghttp://en.wikibooks.org/wiki/File:Pinouts8051.jpghttp://en.wikibooks.org/wiki/File:Pinouts8051.jpghttp://en.wikibooks.org/wiki/File:Pinouts8051.jpg
  • 8/2/2019 8th Sem Report

    6/34

    6

    PSEN. This is "program store enable". In order to use the external memory it is required to

    provide the low voltage (0) on both PSEN and EA pins.

    Ports

    There are 4 8-bit ports: P0, P1, P2 and P3.

    PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used

    for a variety of interfacing tasks.

    PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional

    functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external

    counter inputs, read and write pins for memory access.

    PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no

    external memory is present, but if external memory access is required then PORT P2 will act

    as an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as

    A8-A15, as can be seen from fig 1.1

    PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no

    external memory is present, but if external memory access is required then PORT P0 acts as a

    multiplexed address and data bus that can be used to access external memory in conjunction

    with PORT P2. P0 acts as AD0-AD7, as can be seen from fig 1.1

    Oscillator Circuits

    The 8051 requires the existence of an external oscillator circuit. The oscillator circuit

    usually runs around 12MHz, although the 8051 (depending on which specific model) is

    capable of running at a maximum of 40MHz. Each machine cycle in the 8051 is 12 clock

    cycles, giving an effective cycle rate at 1MHz (for a 12MHz clock) to 3.33MHz (for the

    maximum 40MHz clock). The oscillator circuit generates the clock pulses so that all internal

    operations are synchronized.

  • 8/2/2019 8th Sem Report

    7/34

    7

    Internal Architecture

    fig 3.3: Internal schematics of the 8051.

    Data and Program Memory

    The 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number of

    other high-level languages. Many compilers even have support for compiling C++ for an

    8051.

    Program memory in the 8051 is read-only, while the data memory is considered to be

    read/write accessible. When stored on EEPROM or Flash, the program memory can be

    rewritten when the microcontroller is in the special programmer circuit

    Program Start Address

    The 8051 starts executing program instructions from address 0000 in the program memory.

  • 8/2/2019 8th Sem Report

    8/34

    8

    Special Function Register

    The Special Function Register (SFR) is the upper area of addressable memory, from address0x80 to 0xFF. A, B, PSW, DPTR are called SFR.

    General Purpose Registers

    The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that

    there are essentially 32 available general purpose registers, although only 8 (one bank) can be

    directly accessed at a time. To access the other banks, we need to change the current bank

    number in the flag status register.

    A and B Registers

    The A register is located in the SFR memory location 0xE0. The A register works in a similar

    fashion to the AX register of x86 processors. The A register is called the accumulator, and by

    default it receives the result of all arithmetic operations. The B register is used in a similar

    manner, except that it can receive the extended answers from the multiply and divide

    operations. When not being used for multiplication and Division, the B register is available as

    an extra general-purpose register.

  • 8/2/2019 8th Sem Report

    9/34

    9

    3.3 OUTPUT UNIT

    In our project we are using LCD (Liquid crystal display) for showing the output.

    Liquid crystal displays (LCDs) offer several advantages over traditional cathode-ray

    tube displays that make them ideal for several applications. Of course, LCDs are flat, and

    they use only a fraction of the power required by CRTs. They are easier to read and more

    pleasant to work with for long periods of time than most ordinary video monitors. There are

    several tradeoffs as well, such as limited view angle, brightness, and contrast, not to mention

    high manufacturing cost. As research continues, these limitations are slowly becoming less

    significant.

    Today's LCDs come mostly in two flavors---passive and active. The less expensive passive

    matrix displays trade off picture quality, view angle, and response time with power

    requirements and manufacturing cost. Active matrix displays have superior picture quality

    and viewing characteristics, but need more power to run and are much more expensive to

    fabricate.

    Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as

    for debugging purpose. The most common type of LCD controller is HITACHI 44780 which

    provides a simple interface between the controller & an LCD.

    These LCD's are very simple to interface with the controller as well as are cost effective.

    The most commonly used ALPHANUMERICdisplays are

    http://www.engineersgarage.com/electronic-components/16x2-lcd-module-datasheethttp://www.engineersgarage.com/electronic-components/16x2-lcd-module-datasheet
  • 8/2/2019 8th Sem Report

    10/34

    10

    1x16(Single Line & 16 characters),

    2x16(Double Line & 16 character per line),

    4x20(four lines & Twenty characters per line).

    In our project we are using a 2x16 LCD

    The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data

    Lines depends on the mode of operation. If operated in 8-bit mode then 8 data lines + 3 control

    lines i.e.total 11 lines are required. And if operated in 4-bit mode then 4 data lines + 3 control

    lines i.e. 7 lines are required. How do we decide which mode to use ? Its simple if you have

    sufficient data lines you can go for 8 bit mode & if there is a time constrain i.e. display s hould

    be faster then we have to use 8-bit mode because basically 4-bit mode takes twice as more

    time as compared to 8-bit mode.

    Pin Symbol Function

    1 Vss Ground

    2 Vdd Supply Voltage

    3 Vo Contrast Setting

    4 RS Register Select

    5 R/W Read/Write Select

    6 En Chip Enable Signal

    7-

    14

    DB0-

    DB7Data Lines

    15 A/VeeGnd for the

    backlight

    16 K Vcc for backlight

    When RS is low (0), the data is to be treated as a command. When RS is high (1), the data being

    sent is considered as text data which should be displayed on the screen.

    When R/W is low (0), the information on the data bus is being written to the LCD. When RW is

    high (1), the program is effectively reading from the LCD. Most of the times there is no need to

    read from the LCD so this line can directly be connected to Gnd thus saving one controller line.

  • 8/2/2019 8th Sem Report

    11/34

    11

    The ENABLEpin is used to latch the data present on the data pins. A HIGHLOW signal is

    required to latch the data. The LCD interprets and executes our command at the instant the EN

    line is brought low. If we never bring EN low, your instruction will never be executed.

    For Contrast setting a 10K pot should be used as shown in the figure.

    Data to be Displayed

    lcd_datadisplay:

    SETB RS//Telling the LCD that the data which is being send

    is to be displayed

    MOV P1,A //Character to be displayed is in Acc

    SETB EN

    CLR EN //High to Low pulse on EN to latch the data

  • 8/2/2019 8th Sem Report

    12/34

    12

    CALL DELAY //Delay so that LCD finishes its internal operations

    Ret

    Command or Special Instruction

    lcd_comman

    d:

    CLR RS//Telling the LCD that the data which is being send is

    a command

    MOV P1,A //Character to be displayed is in Acc

    SETB EN

    CLR EN //High to Low pulse on EN to latch the data

    CALL

    DELAY//Delay so that LCD finishes its internal operations

    ret

    Here I have used delay at the end of both the subroutines this is done to wait until the instruction

    is completely executedby the LCD. This will assure that our program gives the LCD the time

    it needs to execute instructions and also makes our program compatible with any LCD, regardless

    of how fast or slow it is.

    "*" - Not Used/Ignored. This bit can be either "1" or "0"

  • 8/2/2019 8th Sem Report

    13/34

    13

    Set Cursor Move Direction:

    ID - Increment the Cursor After Each Byte Written to Display if Set

    S - Shift Display when Byte Written to Display Enable Display/Cursor

    D - Turn Display On(1)/Off(0) C - Turn Cursor On(1)/Off(0)

    B - Cursor Blink On(1)/Off(0)

    Set Cursor Move Direction:

    ID - Increment the Cursor After Each Byte Written to Display if Set

    S - Shift Display when Byte Written to Display Enable Display/Cursor

    D - Turn Display On(1)/Off(0) C - Turn Cursor On(1)/Off(0)

    B - Cursor Blink On(1)/Off(0)

    Move Cursor/Shift Display

    SC - Display Shift On(1)/Off(0) RL - Direction of Shift Right(1)/Left(0)

    Set Interface Length

    DL - Set Data Interface Length 8(1)/4(0)

    N - Number of Display Lines 1(0)/2(1)

    F - Character Font 5x10(1)/5x7(0)

    Poll the "Busy Flag" BF - This bit is set while the LCD is processing

    Move Cursor to CGRAM/Display

    A - Address

    Read/Write ASCII to the Display

    DData

    The above Table shows the different commands for the LCD. I wont go into its details.

    Before starting to display on LCD we need to Initialize it. Firstly we must tell the LCD whether

    we'll be using 8-bit or4-bit mode. Also we will be telling the LCD that we need 5x8 characterfont.Both these options are selected using a single command i.e. 38h. So to activate both these

    options we must execute following instructions:

    MOV A,#38h

    CALL lcd_command

  • 8/2/2019 8th Sem Report

    14/34

    14

    Now that we have to Turn On the display & set the cursor option i.e. cursor ON/OFF & Cursor

    blinking ON/OFF for that we will use the command 0Eh i.e. Display On , Cursor ON but Cursor

    blinking OFF.

    MOV A,#0Eh

    CALL lcd_command

    And the last command we require is to configure the LCD in such a way that everytime we send a

    character to it the cursor position automatically increments by one & moves to right i.e. 06h.

    MOV A,#06h

    CALL lcd_command

    So the lcd_initialize contains the following instructions

    lcd_initialize:

    MOV A,#38h

    CALL lcd_command

    MOV A,#38h

    CALL lcd_command

    MOV A,#38h

    CALL lcd_command

    Ret

    Similarly another important instruction that we require is Clearing the LCD i.e.

    lcd_clr:

    MOV A,#01h

    CALL lcd_command

    Ret

  • 8/2/2019 8th Sem Report

    15/34

    15

    The other components required for perfectly running our circuit are-

    3.4 RELAY

    In our project we are using a relay at the port 2.0 of 8051 which is the output. When the code

    input is given from the the key is matched with code already set in microcontroller then the relay

    will open the door. An electric current through a conductor will produce a magnetic field at right

    angles to the direction of electron flow. If that conductor is wrapped into a coil shape, the

    magnetic field produced will be oriented along the length of the coil. The greater the current, the

    greater the strength of the magnetic field, all other factors being equal:

    Inductors react against changes in current because of the energy stored in this magnetic field.

    When we construct a transformer from two inductor coils around a common iron core , we use

    this field to transfer energy from one coil to the other.

    .

  • 8/2/2019 8th Sem Report

    16/34

    16

    3.5 PRESET

    In our project we are using preset to regulate the contrast of the LCD. A preset is a

    three legged electronic component which can be made to offer varying resistance in a circuit.

    The resistance is varied by adjusting the rotary control over it. The adjustment can be done by

    using a small screw driver or a similar tool. The resistance does not vary linearly but rather

    varies in exponential or logarithmic manner. Such variable resistors are commonly used for

    adjusting sensitivity along with a sensor.

    The variable resistance is obtained across the single terminal at front and one of the

    two other terminals. The two legs at back offer fixed resistance which is divided by the front

    leg. So whenever only the back terminals are used, a preset acts as a fixed resistor. Presets are

    specified by their fixed value resistance.

    Pin diagram:

    Fig: 3.4

  • 8/2/2019 8th Sem Report

    17/34

    17

    3.6 7805 VOLTAGE REGULATOR:

    The 7805 voltage regulatorsemploy built-in current limiting, thermal shutdown, and safe-

    operating area protection which makes them virtually immune to damage from output

    overloads. 7805 is a three-terminal positive voltage regulator. With adequate heatsinking, it

    can deliver in excess of 0.5A output current. Typical applications would include local (on-

    card) regulators which can eliminatethe noise and degraded performance associated with

    single-point regulation.7805 regulator comes from the 78xx family of self-contained fixed

    linear voltage regulator integrated circuits. The 78xx family is a very popular choice for many

    electronic circuits which require a regulated power supply, due to their ease of use and relative

    cheapness. When specifying individual ICs within this family, the xx is replaced with a two-

    digit number, which indicates the output voltage the particular device is designed to provide

    (for example, the 7805 voltage regulator has a 5 volt output, while the 7812 produces 12

    volts). The 78xx line are positive voltage regulators, meaning that they are designed to

    produce a voltage that is positive relative a common ground. There is a related line of 79xx

    devices which are complementary negative voltage regulators. 78xx and 79xx ICs can be used

    in combination to provide both positive d negative supply voltages in the same circuit, if

    necessary.7805 ICs have three terminals and are most commonly found in the TO220 form

    factor, although smaller surface-mount and larger TO3 packages are also available from some

    manufacturers. These devices typically support an input voltage which can be anywhere from

    a couple of volts over the intended output voltage, up to a maximum of 35 or 40 volts, and can

    typically provide up to around 1 or 1.5 amps of current (though smaller or larger packages

    may have a lower or higher current rating).The 7805 series has several key advantages over

    many other voltage regulator circuits which have resulted in its popularity:7805 series ICs do

    not require any additional components to provide a constant, regulated source of power,

    making them easy to use, as well as economical, and also efficient uses of circuit board real

    estate. By contrast, most other voltage regulators require several additional components toswitching power supply) can require not only a large number of components but also

    substantial engineering expertise to implement correctly as well. 7805 series ICs have built-in

    protection against a circuit drawing too much power. They also have protection against

    overheating and short-circuits, making them quite robust in most applications.

  • 8/2/2019 8th Sem Report

    18/34

    18

    7805 Regulator Circuit

    Fig 3.5

    7805 Voltage Regulator Pinout

    Fig 3.6

  • 8/2/2019 8th Sem Report

    19/34

    19

    3.7 Light Emitting Diodes

    Light Emitting Diodes or LEDs, are among the most widely used of all the different

    types of semiconductor diodes available today.

    .Light Emitting Diodes are made from exotic semiconductor compounds such as

    Gallium Arsenide (GaAs), Gallium Phosphide (GaP), Gallium Arsenide Phosphide (GaAsP),

    Silicon Carbide (SiC) or Gallium Indium Nitride (GaInN) all mixed together at different

    ratios to produce a distinct wavelength of colour. Different LED compounds emit light in

    specific regions of the visible light spectrum and therefore produce different intensity levels.

    For red colour Gallium arsenide phosphide (GaAsP) and for green colour Gallium(III)

    phosphide (GaP) is used.

    Here we use Red and Green LED as the indicator of correct code. If the correct code

    is decoded by the circuit, Green LED will glow. Red led glows when the power supply is

    given to the circuit and wrong code is pressed.

    http://en.wikipedia.org/wiki/Gallium_arsenide_phosphidehttp://en.wikipedia.org/wiki/Gallium(III)_phosphidehttp://en.wikipedia.org/wiki/Gallium(III)_phosphidehttp://en.wikipedia.org/wiki/Gallium(III)_phosphidehttp://en.wikipedia.org/wiki/Gallium(III)_phosphidehttp://en.wikipedia.org/wiki/Gallium_arsenide_phosphide
  • 8/2/2019 8th Sem Report

    20/34

    20

    CHAPTER4

    CIRCUITDIAGRAMOFELECTRONICLOCKER

    Fig 4.1

    CHAPTER 5

  • 8/2/2019 8th Sem Report

    21/34

    21

    MICROCONTROLLER PROGRAMMING

    As the program starts, string Enter Code is displayed on LCD. The keypad is

    scanned for pressed digits one by one. Every time, row and column of the key pressed is

    detected. After the four digits are entered, if we enter F then that code is accepted. If the

    passwords do not match, the door will not open.

    To unlock, user needs to Enter code through keypad. Again the keypad is scanned

    for pressed keys and corresponding digits are identified. After the four digits are entered, they

    are compared with the pre-set password. If all the four digits match with set password, LCD

    displays Lock Open and the lock output pin goes high. There is another option to reset

    password . If we enter E then we can reset the password and when F is pressed then the

    new password is set. If we press F two times then the door is again locked.

  • 8/2/2019 8th Sem Report

    22/34

    22

    FLOW CHART OF THE LCD PROGRAME

    No

    Yes

    Yes

    Yes

    No

    No

    Yes

    Start

    Code = 4567

    1st

    line-Digital lock

    2nd

    line- Enter code

    Read the key

    Data=data*10+ key

    If key=F

    Display data

    If

    code=data

    1st

    line-Unlocked

    2nd

    line- Reset code

    If key=E

    1st

    line-Enter new code

    2nd

    line- New code:

    Read the key

    If key=F

    Code = data

    New Code is set

    Display the key

    Locked

  • 8/2/2019 8th Sem Report

    23/34

    23

    CODING PART OF THE LCD

    # include

    # include# include "keyboard4_4.h"

    #define LCDPORT P1

    sbit RS=P0^0;

    sbit RW=P0^1;

    sbit EN=P0^2;

    sbit RELAY=P2^0;

    void MSDelay(unsigned int t)

    {

    unsigned int i,j;

    for(i=0;i

  • 8/2/2019 8th Sem Report

    24/34

    24

    EN=1; // Strobe the Enable PIN

    MSDelay(1); // Wait for 1 Millisecond

    EN=0;

    return;

    }

    void LCDWriteString(char *str)

    {

    int i;

    for(i=0;str[i];i++) LCDData(str[i]);

    }

    int CODE=4567;

    //MAIN PROGRAM BEGINS

    void LCDClear()

    {

    LCDCommand(0x01);

    }

    void LCDRow1()

    {

    LCDCommand(0x80);

    }

    void LCDRow2()

    {

    LCDCommand(0xC0);

    }

    void LCDInit()

    {

    //----------------------------------------------------

    // LCD Initialization

  • 8/2/2019 8th Sem Report

    25/34

    25

    //----------------------------------------------------

    LCDCommand(0x38); // 0x38 = 2 Lines and 5x7 Matrix

    MSDelay(10) ; // Wait for 10 Millisecond

    LCDCommand(0x0E); // Display on, Cursor Blinking

    MSDelay(10) ; // Wait for 10 MillisecondLCDCommand(0x01); // Clear Display Screen

    MSDelay(10) ; // Wait for 10 Millisecond

    LCDCommand(0x06); // Increment Cursor (Shift Cursor to Right)

    MSDelay(10) ; // Wait for 10 Millisecond

    }

    void main(void)

    {

    unsigned char CharacterCount = 0;

    unsigned char KeyboardData;

    int Data=0;

    char buffer[17];

    RELAY=1;

    x:

    MainSystemInitialize();

    LCDWriteString("DIGITAL LOCK");

    LCDRow2();

    LCDWriteString("Enter Code:");

    for(;;)

    {

    KeyboardData = get_data();

    if(KeyboardData!='F') Data=(Data*10)+(KeyboardData - 48);

    else

    {

    if(CODE==Data)

    {

  • 8/2/2019 8th Sem Report

    26/34

    26

    LCDRow1();

    LCDWriteString("UNLOCKED ");

    RELAY=0;

    Data=0;

    LCDRow2();LCDWriteString("E - Reset Code ");

    KeyboardData=get_data();

    if(KeyboardData=='E')

    {

    LCDClear();

    LCDWriteString("Enter New Code");

    LCDRow2();

    LCDWriteString("New Code:");

    Data=0;

    KeyboardData=0;

    while(1)

    {

    KeyboardData=get_data();

    if(KeyboardData=='F')

    {

    CODE=Data;

    Data=0;

    LCDClear();

    LCDWriteString("New Code Set");

    sprintf(buffer, "%d",Data);

    LCDRow2();

    Delay(1500);

    goto x;

    break;

    }

    else

    {

  • 8/2/2019 8th Sem Report

    27/34

    27

    if(KeyboardData != 0)

    {

    LCDData(KeyboardData);

    Data=(Data*10)+ (KeyboardData -48);

    }KeyboardData=0;

    }

    }

    }

    else

    {

    }

    }

    else

    {

    LCDRow1();

    LCDWriteString("LOCKED ");

    RELAY=1;

    Data=0;

    Delay(500);

    goto x;

    }

    }

  • 8/2/2019 8th Sem Report

    28/34

    28

    if(KeyboardData != 0)

    LCDData(KeyboardData);

    }

    }

    static void MainSystemInitialize(void){

    LCDInit();

    }

  • 8/2/2019 8th Sem Report

    29/34

    29

    CODING PART OF KEYBOARD

    //INCLUDE KEYBOARD HEADER FILE

    #include"keyboard4_4.h"

    //DECLARE GLOABL VARIABLE

    ubyte get_data()

    {

    ubyte time_out = 0;

    ubyte digit;

    ubyte a[] = "0123456789ABCDEF";

    key_data = 0x0f;

    while(key_data != 0x0f);

    Delay(40);while(key_data != 0x0f);

    while(key_data == 0x0f){

    Delay(KEY_DELAY);

    if(time_out++ == MAX_TIME_OUT)

    return 0;

    }

    Delay(20);

    if((key_data = 0x7f) && MASK != 0x0f)

    digit = find_col(0x00);

    else if((key_data = 0xbf) && MASK != 0x0f)

    digit = find_col(0x04);

    else if((key_data = 0xdf) && MASK != 0x0f)

    digit = find_col(0x08);

    else if((key_data = 0xef) && MASK != 0x0f)

  • 8/2/2019 8th Sem Report

    30/34

    30

    digit = find_col(0x0c);

    return a[digit];

    }

    ubyte find_col(ubyte key){

    key_data &= 0x0f;

    if(key_data == 0x0d)

    key++;

    else if(key_data == 0x0b)

    key +=2;

    else if(key_data == 0x07)

    key +=3;

    return key;

    }

  • 8/2/2019 8th Sem Report

    31/34

    31

    CODING PART OF THE DELAY PROGRAM

    #include "delay.h"

    void Delay(unsigned int time)

    {

    unsigned char pause;

    while( time > 0)

    {

    pause = 150;

    while(pause--);

    time--;

    }

    }

  • 8/2/2019 8th Sem Report

    32/34

    32

    CHAPTER 6

    APPLICATION

    ELECTRONIC LOCKER is mainly designed for security purpose. It can be used as

    bank locker, room locker, and at any other system that one person wants to be secured. It can

    also be used by army to secure any system which is important for nation. Thus, it can be used

    worldwide for many security purposes.

  • 8/2/2019 8th Sem Report

    33/34

    33

    CHAPTER 7

    CONCLUSION

    CHAPTER 8

    FUTURE SCOPE

  • 8/2/2019 8th Sem Report

    34/34

    The concept of the Electronic locker is very reliable as a security system. It can be

    widely use as a door locker. It can be further modified by using microprocessor,

    microcontroller for the same goal with more flexibility i.e. changing the code without

    changing the hard wire, with less complexity in designing, with lower cost, very high

    reliability and with new facilities.