Sunteți pe pagina 1din 86

CHAPTER-1

PROJECT INTRODUCTION

1.1 INTRODUCTION

Authentication plays a very critical role in security-related applications like e-commerce.


There are a number of methods and techniques for accomplishing this key process. In this
regard, biometrics is gaining increasing attention these days. Security systems, having
realized the value of biometrics, use biometrics for two basic purposes: to verify or
identify users. There is a number of biometrics and different applications need different
biometrics. Biometric is the most secure and convenient authentication tool. It can not be
borrowed, stolen, or forgotten and forging one is practically impossible. Biometrics
measure individual's unique physical or behavioral characteristics to recognize or
authenticate their identity. Common physical biometrics includes fingerprints, hand or
palm geometry, retina, iris, and facial characteristics. Behavioral characters
characteristics include signature, voice, keystroke pattern, and gait. Project deals with
Identification, Authentication and Setup of Security System using FIM 3030 Biometrics
and 8051 Microcontroller. Beside Biometrics and 8051 Microcontroller the major
components required are LCD, RTC Section (for real time clock updates), General
purpose PCB, Relay section (for opening and closing of security doors) and Personal
Computer etc. The interfacing between 8051-LCD, 8051-RTC, 8051 - FIM 3030
Biometrics Module (Thumb Geometry recognition) and FIM 3030 Biometric Module –
Personal Computer is to be implemented. The details about each module are given in next
sections of this report.

1.2 WORKING OF THE PROJECT

The working of the project is explained with the help of block diagram.

Block diagram:

1
Figure 1.1 Block diagram of the system

There are two modes

1. Registration mode

2. User mode

In first mode, i.e., the registration mode, system communicates with personal
computer for creating and maintenance of data base. This mode can be selected using
mode switches available on system. In this mode scanner scans the image of thumb
impression of the person and generates its bit pattern matrix according to the key points
in thumb geometry and than stores it in memory available in FIM 3030 Biometrics
Module known as user’s space. Only administrator has authority to register the new
person. In second mode, i.e., the user mode, system breaks contact with personal

2
computer. This mode can be selected with the same switches that are mode switches on
system. In this mode system again scans the thumb geometry of the person making
contact with scanner for identification and start matching with the existing data base
maintained during registration mode. If system recognizes the person than it would grant
the access through doors according to his/her designation else access denied message
would be shown on LCD and according to persons designation access through doors will
be provided.

For a student only door number 1 gets open. For a teacher/staff member door number
1 and 2 gets open. For an administrator all three doors i.e. door no. 1, 2 & 3 gets open for
approximately 6seconds. As only single door lock is available, we are using electrical
bulbs for door no. 2 and 3.System also includes real time clock updates, which updates
our system clock continuously. I²C protocols are used to access real time updates from
RTC (real time clock) section. Central control unit of system is Microcontroller 8051,
which is also interfaced with RTC Section. Codes for whole procedure followed by
system are retune in Embedded C programming language. Keil MicroVision3 Integrated
Development Environment is used to compile whole program and Flash magic is used to
burn the program code Hex file.

Whole project is divided in 6 chapters. Second chapter describes the microcontroller


8051’s architecture. Third chapter describes the biometrics basics and the FIM system.
Forth chapter describes the fundamentals of serial communication. Fifth chapter
describes the hardware description of whole project.

At last in appendix codes are shown related to the project.

Summary

The project deals with the identification, authentication and setup of security system
using Biometrics module. Main aim of project is to give access to the user according to
their designation and to maintain data base. Working of project has been discussed.

Finally, this chapter gives the over view of compete project working.

3
CHAPTER-2

THE 8051 MICROCONTROLLER

2.1 GENERAL

In this chapter, the 8051 family, 8051 assembly language programming, loop and I/O port
programming, 8051 addressing modes, arithmetic instructions, 8051 hardware connection
and Intel hex file have been discussed.

2.2 THE 8051 FAMILY

In 1981, Intel Corporation introduced an 8-bit microcontroller called the 8051. This
microcontroller had 128 bytes of RAM, 4K bytes of on-chip ROM, two timers, one serial
port, and four ports (each 8-bits wide) all on a single chip. The 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 broken into 8-bit pieces to be processed by the CPU. The 8051 has a total of four
I/O ports, each 8 bits wide. Although the 8051 can have a maximum of 64K bytes of on-
chip ROM, many manufacturers have put only 4K bytes on the chip. There are different
flavors of the 8051 in terms of speed and amount of on-chip ROM, but they are all
compatible with the original 8051 as far as the instructions are concerned. The various
members of the 8051 family are 8051 microcontroller, 8052 microcontroller and 8031
microcontroller.

Block Diagram:

4
Figure 1.2 Block diagram of inside the microcontroller 8051

2.2.1 8051 Microcontroller

The 8051 is the original member of the 8051 family. Figure 2.1 shows the block diagram
of the 8051 microcontroller. 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 memory
technology and is compatible with the industry-standard 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 powerful microcomputer which

5
provides a highly-flexible and cost-effective solution to many embedded control
applications. The AT89C51 provides the following standard features: 4Kbytes of Flash,
128 bytes of RAM, 32 I/O lines, two 16-bittimer/counters, five vector two-level interrupt
architecture, a full duplex serial port, and on-chip oscillator and clock circuitry. In
addition, the AT89C51 is designed with static logic for operation down to zero frequency
and supports two software selectable power saving modes. The Idle 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.

2.2.2 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 accesses to external program and data memory. In 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.

6
Figure 2.2 Pin diagram for microcontroller 8051

Port 1

Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output 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 (IIL) because of the internal pull-ups. Port
1 also receives the low-order address bytes during Flash programming and verification.

7
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 (IIL) because of 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). In
this application, it uses strong internal pull-ups when emitting 1s. During accesses to
external data memory that 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
some control 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 buffer
scan 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 (IIL) because of the pull-ups. Port 3 also
serves the functions of various special features of the AT89C51 as listed below:

Table 2.1function of port 3

8
Port 3 also receives some control signals for Flash programming and verification.

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. In normal operation ALE is emitted at a constant rate of 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. If
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 machine
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. This pin also receives the
12-volt programming enable voltage (VPP) during Flash programming, for parts that

9
require 12-volt VPP.

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2

Output from the inverting oscillator amplifier. Oscillator Characteristics XTAL1 and
XTAL2 are the input and output, respectively, of an inverting amplifier which can be
configured for use as an on-chip oscillator, as shown in Figure 1. 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.

Figure 2.3 Crystal Oscillator Connections

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.

10
2.2.3 Programming of Microcontroller 8051

We are using embedded C programming language to program the central unit i.e.
microcontroller 8051, so that it performs the specific task according to the requirement.

Need of C:

Compiler produces hex file that we download into ROM of microcontroller. The size of
hex file produced by compiler is one of the main concerns of microcontroller
programmers for two reasons:

1. Microcontroller has limited on -chip ROM


2. The code space for 8051 is limited to 64 KB

Programming in assembly language is tedious and time consuming. C is a high level


programming language that is portable across many hardware architectures.

So for following reasons we use C:

1. It is easier and less time consuming to write in C than assembly.


2. C is easier to modify and update.
3. You can use code available in function libraries.
4. C code is portable to other microcontrollers with little or no modification.

We use reg51.h as a header file as “#include <reg51.h>”. These files contain all the
definitions of the 80C51 registers. This file is included in your project and will be
assembled together with the compiled output of your C program.

C data types for 8051:

1. Unsigned char is 8-bit data type ranging 0-255 (0-FFH)


2. Signed char is 8-bit data type that uses most significant bit to represent the – or +
value. We have only 7-bits for the magnitude of the signed numbers giving us
values from -128 to +127.

11
3. Unsigned int is 16-bit data type ranging 0-65535(0-FFFFH).
4. Signed int is 16-bit data type that uses most significant bit to represent the – or +
value. We have only 15-bits for the magnitude of the signed numbers giving us
values from -32768 to +32767.

Sbit is a keyword designed to access single bit addressable registers. It allows to the
single bits of the SFR registers. We can use sbit to access the individual bits of the ports
as “Sbit mybit=P1^0”. This controls the D0 of port P1. Bit data type allows access to the
single bits of bit - addressable memory spaces 20-2FH. Sfr, the bit data type is used for
the bit addressable section of RAM space 20-2FH. Bitwise operators are AND (&), OR
(|), EX-OR (^), Inverter (~), Shift Right (>>) and Shift left (<<).

Summary

In this chapter the 8051 Families, Architecture of 8051 Microcontroller, Pin description
and Embedded C programming basics have been discussed.

12
CHAPTER-3

BIOMETRICS

3.1 INTRODUCTION

Humans recognize each other according to their various characteristics for ages. We
recognize others by their face when we meet them and by their voice as we speak to
them. Identity verification (authentication) in computer systems has been traditionally
based on something that (key, magnetic or chip card) or (PIN, password). Things like
keys or cards, however, tend to get stolen or lost and passwords are often forgotten or
disclosed.

To achieve more reliable verification or identification we should use something that


really characterizes the given person. Biometrics offer automated methods of identity
verification or identification on the principle of measurable physiological or behavioral
characteristics such as a fingerprint or a voice sample. The characteristics are measurable
and unique. These characteristics should not be duplicable, but it is unfortunately often
possible to create a copy that is accepted by the biometric system as a true sample. This is
a typical situation where the level of security provided is given as the amount of money
the impostor needs to gain an unauthorized access. We have seen biometric systems
where the estimated amount required is as low as $100 as well as systems where at least a
few thousand dollars are necessary.

Biometric systems can be used in two different modes. Identity occurs when the user
claims to be already enrolled in the system (presents an ID card or login name); in this
case the biometric data obtained from the user is compared to the user’s data already
stored in the database. Identification occurs when the identity of the user is a priori
unknown. In this case the user’s biometric data is matched against all the records in the
database as the user can be anywhere in the database or he/she actually does not have to
be there at all.

13
It is evident that identification is technically more challenging and costly.
Identification accuracy generally decreases as the size of the database grows. For this
reason records in large databases are categorized according to a sufficiently
discriminating characteristic in the biometric data. Subsequent searches for a particular
record are searched within a small subset only. This lowers the number of relevant
records per search and increases the accuracy (if the discriminating characteristic was
properly chosen).

Before the user can be successfully verified or identified by the system, he/she must be
registered with the biometric system. User’s biometric data is captured, processed and
stored. As the quality of this stored biometric data is crucial for further authentications,
there are often several (usually 3 or 5) biometric samples used to create user’s master
template. The process of the user’s registration with the biometric system is called
enrollment.

3.1.1 What to measure?

Most significant difference between biometric and traditional technologies lies in the
answer of the biometric system to an authentication/identification request. Biometric
systems do not give simple yes/no answers. While the password either is ’abcd’ or not
and the card PIN 1234 either is valid or not, no biometric system can verify the identity
or identify a person absolutely. The person’s signature never is absolutely identical and
the position of the finger on the fingerprint reader will vary as well. Instead, we are told
how similar the current biometric data is to the record stored in the database. Thus the
biometric system actually says what is the probability of these two biometric samples
come from the same person.

Biometric technologies can be divided into 2 major categories according to what they
measure:

1. Devices based on physiological characteristics of a person (such as the fingerprint


or hand geometry).
2. Systems based on behavioral characteristics of a person (such as signature

14
dynamics).

Biometric systems from the first category are usually more reliable and accurate as the
physiological characteristics are easier to repeat and often are not affected by current
(mental) conditions such as stress or illness. One could build a system that requires a
100%match each time. Yet such a system would be practically useless, as only very few
users (if any) could use it. Most of the users would be rejected all the time, because the
measurement results never are the same. We have to allow for some variability of the
biometric data in order not to reject many authorized users.

However, the greater variability we allow the greater is the probability that an
impostor with a similar biometric data will be accepted as an authorized user. The
variability is usually called a (security) threshold or a (security) level. If the variability
allowed is small then the security threshold or the security level is called high and if we
allow for greater variability then the security threshold or the security level is called low.

3.1.2 Biometric techniques

There are lots of biometric techniques available nowadays. A few of them are in the stage
of the research only (e.g. the odor analysis), but a significant number of technologies is
already mature and commercially available (at least ten different types of biometrics are
commercially available nowadays: fingerprint, finger geometry, hand geometry, palm
print, iris pattern, retina pattern, facial recognition, voice comparison, signature dynamics
and typing rhythm).

3.1.3 Fingerprint technologies

Fingerprint identification is perhaps the oldest of all the biometric techniques.


Fingerprints were used already in the Old China as a means of positively identifying a
person as an author of the document. Their use in law enforcement since the last century
is well known and actually let to an association fingerprint = crime. This caused some
worries about the user acceptance of fingerprint-based systems. The situation improves as
these systems spread around and become more common. Fingerprint readers before we

15
can proceed any further we need to obtain the digitalized fingerprint. The traditional
method uses the ink to get the fingerprint onto a piece of paper. This piece of paper is
then scanned using a traditional scanner. This method is used only rarely today when an
old paper-based database is being digitalized, scanning a fingerprint found on a scene of a
crime is being processed or in law enforcement AFIS systems. Otherwise modern live
fingerprint readers are used. They do not require the ink anymore. These live fingerprint
readers are most commonly based on optical, thermal, silicon or ultrasonic principles.

Figure 3.1 Optical Scanner

All the optical fingerprint readers comprise of the Source of light, the light sensor and
a special reflection surface that changes the reflection according to the pressure. Some of
the readers are fitted out with the processing and memory chips as well.

Optical finger print readers are the most common at present. They are based on
reflection changes at the spots where the finger papillary lines touch the reader’s surface.
The size of the optical fingerprint readers typically is around 10 x 10 x 5 centimeters. It is
difficult to minimize them much more as the reader has to comprise the source of light,
reflection surface and the light sensor. The optical fingerprint readers work usually
reliably, but sometimes have problems with dust if heavily used and not cleaned. The dust
may cause latent fingerprints, which may be accepted by the reader as a real fingerprint.
Optical fingerprint readers cannot be fooled by a simple picture of a fingerprint, but any
3D fingerprint model makes a significant problem, all the reader checks is the pressure. A
few readers are therefore equipped with additional detectors of finger aliveness.

16
Figure 3.2 Fingerprint bitmap

Optical readers are relatively cheap and are manufactured by a great number of
manufacturers. The field of optical technologies attracts many newly established firms
(e.g., American Biometric Company, Digital Persona) as well as a few big and well
-known companies (such as HP, Philips or Sony). Optical fingerprint readers are also
often embedded in keyboards, mice or monitors.

Figure 3.3 Optical fingerprint reader

Silicon technologies are older than the optical technologies. They are based on the
capacitance of the finger. The dc-capacitive silicon fingerprint sensors consist of
rectangular arrays of capacitors on a silicon chip. One plate of the capacitor is the finger;
the other plate is a tiny area of metallization (a pixel) on the chip’s surface. One places
his/her finger against the surface of the chip (actually against an insulated coating on the
chip’s surface). The ridges of the fingerprint are close to the nearby pixels and have high
capacitance to them. The valleys are more distant from the pixels nearest them and
therefore have lower capacitance.

Such an array of capacitors can be placed onto a chip as small as 15 x 15 x 5 mm and


thus is ideal for miniaturization. A PCMCIA card (the triple height of a credit card) with a
silicon fingerprint reader is already available. Integration of a fingerprint reader on a
credit card-sized smartcard was not achieved yet, but it is expected in the near future.
Silicon fingerprint readers are popular also in mobile phones and laptop computers due to

17
the small size. The fingerprint bitmap obtained from the silicon reader is affected by the
finger moisture as the moisture significant influences the capacitance. This often means
that too wet or dry finger do not produce bitmaps with a sufficient quality and so people
with unusually wet or dry finger do not produce bitmaps with a sufficient quality and so
people with unusually wet or dry finger have problems with these silicon fingerprint
readers.

Both optical and silicon fingerprint readers are fast enough to capture and display the
fingerprint in real time. The typical resolution is around 500 DPI.Ultrasonic fingerprint
readers are the newest and least common. They use ultrasound to monitor the finger
surface.

The user places the finger on a piece of glass and the ultrasonic sensor moves and
reads whole the fingerprint. This process takes one or two seconds. Ultrasound is not
disturbed by the dirt on the finger so the quality of the bitmap obtained is usually fair.
Ultrasonic fingerprint readers are manufactured by a single company nowadays. This
company (Ultra Scan Inc.) owns multiple patents for the ultrasonic technology. The
readers produced by this company are relatively big (15 x15 x 20 centimeters), heavy,
noisy and expensive (with the price around $2500). They are able to scan fingerprint at
300, 600 and 1000 DPI (according to the model).

Fingerprint processing Fingerprints are not compared and usually also not stored as
bitmaps. Fingerprint matching techniques can be placed into two categories: minutiae-
based and correlation based. Minutiae-based techniques find the minutiae points’ first and
then map their relative placement on the finger. Minutiae are individual unique character-
minutiae istics within the fingerprint pattern such as ridge endings, bifurcations,
divergences, dots or islands (see the picture on the following page). In the recent years
automated fingerprint comparisons have been most often based on minutiae.

The problem with minutiae is that it is difficult to extract the minutiae points
accurately when the fingerprint is of low quality. This method also does not take into
account the global pattern of ridges and furrows. The correlation-based method is able to

18
correlation based overcome some of the difficulties of the minutiae-based approach.
However, it has some of its own shortcomings. Correlation-based techniques require the
precise location of a registration point and are affected by image translation and rotation.

Loop Arch Whorl

Figure 3.4 Loop, Arch& Whorl

The loop is the most common type of fingerprint pattern and accounts for about 65%
of all prints. The arch pattern is a more open curve than the loop. There are two types of
arch patterns: the plain arch and the tented arch. Whorl patterns occur in about 30% of all
fingerprint and are defined by at least one ridge that makes a complete circle.

The readability of a fingerprint depends on a variety of work and environmental


factors. These include age, gender, occupation and race. A young, female, Asian mine-
worker is seen as the most difficult subject. A surprisingly high proportion of the
populations have missing finger, with the left forefinger having the highest percentage at
0.62%. There are about 30 minutiae within a typical fingerprint image obtained by a live
fingerprint reader. The number and spatial distribution of minutiae varies according to the
quality of the fingerprint image, finger pressure, moisture and placement. In the decision
process, the biometric system tries to find minutiae transformation between the current
distribution and the stored template. The matching decision is then based on the
possibility and complexity of the necessary transformation. The decision usually takes
from 5 milliseconds to 2 seconds.

19
Figure 3.5 Fingerprint ridge

These are not continuous, straight ridges. Instead they are broken, forked, changed
directionally, or interrupted. The points at which ridges end, fork and change are called
minutia points and these minutia points provide unique, identifying information. There
area number of types of minutia points. The most common are ridge endings and ridge
bifurcations (points at which a ridge divides into two or more branches).

The speed of the decision sometimes depends on the security level and the negative
answer very often takes longer time than the positive one (sometimes even 10 times
more). There is no direct dependency between the speed and accuracy of the matching
algorithm according to our experience. We have seen fast and accurate as well as slow
and less accurate matching algorithms.

The minutiae found in the fingerprint image are also used to store the fingerprint for
future comparisons. The minutiae are en- templates coded and often also compressed.
The size of such a master template usually is between 24 bytes and one kilobyte.

Figure 3.6 The minutiae matching

The minutia matching is a process where two sets of minutiae are compared to decide
whether they represent the same finger or not.

Fingerprints contain a large amount of data. Because of the high level of data present
in the image, it is possible to eliminate false matches and reduce the number of possible

20
matches to a small fraction. This means that the fingerprint technology can be used for
identification even within large databases. Fingerprint identification technology has
undergone an extensive research and development since the seventies. The initial reason
for the effort was the response to the FBI requirement for an identification search system.
Such systems are called Automated Fingerprint Identification Systems (AFIS) and are
used to identify individuals in large AFIS databases (typically to find the offender of a
crime according to a fingerprint found at the crime scene or to identify a person whose
identity is unknown). AFIS systems are operated by professionals who manually
intervene the minutiae extraction and matching process and thus their results are really
excellent. The typical access control systems, on the other side, are completely
automated. Their accuracy is slightly worse. The quality of the fingerprint image obtained
by an automated fingerprint reader from an inexperienced (non-professional) user is
usually lower. Access control systems Fingerprint readers often do not show any
fingerprint preview and so the users do not know if the positioning and pressure of the
finger is correct. The automatic minutiae extraction in a lower quality image is not perfect
yet. Thus the overall accuracy of such a system is lower.

Some newer systems are based not only on minutiae extraction; they use the length
and position of the papillary lines as well. A few system take into account even pores
(their spatial distribution), pores but the problem with pores is that they are too dependent
on the fingerprint image quality and finger pressure. Most of the biometric fingerprint
systems use the fingerprint reader to provide for the fingerprint bitmap image only, whole
the processing and matching is done by a software that runs on a computer (the software
is often available for Microsoft Windows operating systems only). There are currently
only very few fingerprint devices that does all the processing by the hardware.

The manufacturers of the fingerprint readers used to deliver the fingerprint processing
software with the hardware. Today, the market specializes. Even if it is still possible to
buy a fingerprint reader with a software package (this is the popular way especial for the
low-end devices for home or office use) there are many manufacturers that produce
fingerprint hardware only (e.g. fingerprint silicon chips by Thomson) or software
companies that offer device-independent fingerprint processing software. Device

21
independent software is not bound to images obtained by one single input device, but
their accuracy is very low if various input devices are mixed.

3.1.4 The layer model

Although the use of each biometric technology has its own specific issues, the basic
operation of any biometric system is very similar. The system typically follows the same
set of steps. The typical steps separation of actions can lead to identifying critical issues
and to improving security of the overall process of biometric authentication. The whole
process starts with the enrollment:

3.1.5 First measurement (acquisition)

This is the first contact of the user with the biometric system. The user’s biometric
sample is obtained using an input device. The quality of the first biometric sample is
crucial for further authentications of the user, so the quality of this biometric sample must
be particularly checked and if the quality is not sufficient, the acquisition of the biometric
sample must be repeated. It may happen that even multiple acquisitions do not generate
biometric samples with quality is crucial sufficient quality. Such a user cannot be
registered with the system. There are also mute people, people without finger or with
injured eyes. Both these categories create a “failed to enroll “group of users. Users very
often do not have any previous experiences with the kind of the biometric system they are
being registered with, so their behavior at the time of the first contact with the technology
is not natural. This negatively influences the quality of the first measurement and that is
why the first measurement is guided by a professional who explains the use of the
biometric reader.

Creation of master characteristics the biometric measurements are processed after the
acquisition. The number of biometric samples necessary for further processing is based
on the nature of the used biometric technology. Sometimes a single sample is sufficient,
but often multiple biometric samples are required. The biometric characteristics are most
commonly neither compared nor stored in the raw format (say as a bitmap). The raw

22
measurements contain a lot of noise or irrelevant information, which need not be stored.
So the measurements are processed and only the important features are extracted and
used. This significant reduces the size of the data. The process of feature extraction is not
lossless and so the extracted features cannot be used to reconstruct the biometric sample
completely.

Storage of master characteristics after processing the first biometric sample and
extracting the features, we have to store (and maintain) the newly obtained master
template. Choosing a proper discriminating characteristic for the categorization of
records in large databases can improve identification (search) tasks later on. There are
basically 4 possibilities where to store the template: in a card, in the central database on a
server, on a workstation or directly in an authentication terminal. The storage in an
authentication terminal cannot be used for template must be encrypted large-scale
systems, in such a case only the first two possibilities are applicable. If privacy issues
need to be considered then the storage on a card has an advantage, because in this case no
biometric data must be stored (and potentially misused) in a central database. The storage
on a card requires a kind of a digital signature of the master template and of the
association of the user with the master template. Biometric samples as well as the
extracted features are very sensitive data and so the master template should be stored
always encrypted no matter what storage is used.

As soon as the user is enrolled, he/she can use the system for successful
authentications or identification. This process is typically fully automated and takes the
following steps:

Acquisition(s) The current biometric measurements must be obtained for the


system to be able to make the comparison with the master template. These subsequent
acquisitions of the user’s biometric measurements are done at various places where the
authentication of the user is required. This might be user’s computer in the office, an
ATM machine or a sensor in front of a door. For the best performance the kind of the
input device used at the enrollment and for the subsequent acquisitions should be the
same. Other conditions of use should also be as similar as possible with the conditions at

23
the enrollment. These include the background (face recognition), the background noise
(voice verification) or the moisture (fingerprint). While the enrollment is usually guided
by trained personnel, the subsequent biometric measurements are most commonly fully
automatic and unattended. This brings up a few special issues. Firstly, the user needs to
know how to use the device to provide the sample in the best quality. This is often not
easy because the device does not show any preview of the sample obtained, so for
example in the case of a fingerprint reader, the user does not know whether the
positioning of the finger on the reader and the pressure is correct. Secondly, as the reader
is left unattended, it is up to the reader to check that the measurements obtained really
belong to live persons (the aliveness property). For example, a fingerprint reader
aliveness test should tell if the fingerprint it gets is from a live finger, not from a mask
that is put on top of a finger. Similarly, an iris scanner should make sure that the iris
image it is getting is from a real eye not a picture of an eye. In many biometric techniques
(e.g. fingerprinting) the further processing trusts the biometric hardware to check the
aliveness of the person and provide genuine biometric measurements only. Some other
systems (like the face recognition) check the user’s aliveness in software (the proper
change of a characteristic with time). No matter whether hardware or software is used,
ensuring that the biometric measurements are genuine is crucial for the system to be
secure. Without the assumption of the genuine data obtained at the input we cannot get a
secure system. It is not possible to formally prove that a reader provides only genuine
measurements and this affects also the possibility of a formal proof attacks and of the
security of whole the biometric system. The aliveness test of a person is not an easy task.
New countermeasures are always to be followed by newer attacks. We do not even know
how efficient the current countermeasures are against the attacks to come. Biometric
readers are not yet the main target of sophisticated criminals. But then we can expect a
wave of professional attacks. We have seen a few biometric readers where the estimated
cost of an attack is as low as a few hundred dollars. The security of such a system is
really poor Creation of new characteristics the biometric measurements obtained in the
previous step is processed and new characteristics are created. The process of feature
extraction is basically the same as in the case of the enrollment. Only a single biometric
sample is usually available. This might mean that the number or quality of the features

24
extracted is lower than at the time of enrollment.

Comparison the currently computed characteristics are then compared with the
characteristics obtained during enrollment. This process is very dependent on the nature
of the biometric technology used. Sometimes the desired security threshold is a parameter
of the matching process, sometimes the biometric system returns a score within range. If
the system performs verification then the newly obtained characteristics are compared
only with one master template (or with a small number of master templates, e.g. a set of
master templates for a few different finger). For an identification request the new
characteristics are matched against a large number of master templates (either against all
the records in the database or if the database is clustered then against the relevant part of
the database.

3.2 FIM30N
3.2.1 General Descriptions

FIM30N is a low-price stand-alone Fingerprint Identification Device with many excellent


features. It provides benefits such as high identification performance, low power
consumption and RS-232 serial interface with the various commands for easy integration
into a wide range of applications. It is a durable and compact device with fingerprint
identification module containing NITGEN® optics-based fingerprint sensor inside.

3.2.2 Target Application

1. Door-lock system
2. Safe Box
3. Simple Access Controller
4. Vehicle Control
5. ATM , POS
6. And more

3.2.3 Basic Feature

25
Hardware Specification

Table 3.1 Hardware specification of FIM3030

Operation Specification

Table 3.2 Operational specification of FIM3030

3.2.4 Block Diagram

26
Figure 3.7 RS-232C communication data consist of 8-bit data, no parity, 1-bit start-bit
and 1-bit stop-bit.

3.2.5 Operation

1. Communication

FIM30N has RS-232 serial communication port through that FIM30N communicates at
the same time. These ports support 6 baud rate modes such as 9600, 14400, 19200,
38400, 57600, and 115200 bps. FIM30N follows NITGEN Serial Communication
protocol.

2. User Data Area

FIM30N provides 64 Kbytes flash memory. Using this memory, host can save private
data for specific usage. The caution is needed because the responsibility for reading,
writing and erasing user data area is given to the host.

3. Key Function

27
FIM30N supports 3 function key inputs such as Enroll Key, delete Key, and Identify Key.
Using these keys without serial communication, enrollment, deletion, all deletion and
identification operating can be executed.

3.2.6 External Port

1. External Interface Connection (JP1)

Table 3.3 Pin description of FIM 3030

2. 20-Pin Sensor Connection (JP2)

28
Table 3.4 Pin Description of sensor

3.2.7 NITGEN FIM - Ev Tool

It is tool provided by NITGEN with user friendly GUI for addition, deletion of
records. It connects the module with the personal computer through COM Port.
Hence we can do the process of enrollment of new comer and maintain the data base.

Summary

In this chapter the basics of Biometrics and its various types has been discussed. The
specifications and working of FIM 3030 Nitgen Module with working Ev tool have
been understood thoroughly.

29
CHAPTER-4

SERIAL COMMUNICATION

4.1BASICS OF SERIAL COMMUNICATION

Computer transfers data in two ways these are

1. Parallel: Often 8 or more lines (wire conductors) are used to transfer data to a
device that is only few feet away.
2. Serial: To transfer to a device located many meters away, the serial method is
used. The data is sent one bit at a time.

Figure 4.1 Mode of Communication

At the transmitting end, the byte of data must be converted to serial bits using parallel-
in-serial-out shift register. At the receiving end, there is a serial-in-parallel-out shift
register to receive the serial data and pack them into byte. When the distance is short, the
digital signal can be transferred as it is on a simple wire and requires no modulation. If
data is to be transferred on the telephone line, it must be converted from 0s and 1s to
audio tones. This conversion is performed by a device called a modem,

30
“Modulator/demodulator”.

Serial data communication uses two methods. First are synchronous method transfers
a block of data at a time. Second is an asynchronous method transfer a single byte at a
time.

It is possible to write software to use either of these methods, but the programs can be
tedious and long. There are special IC chips made by many manufacturers for serial
communications namely UART (universal asynchronous Receiver-transmitter) & USART
(universal synchronous-asynchronous Receiver-transmitter).

Figure 4.2 Diagrammatic Simplex & Duplex Transmission

A protocol is a set of rules agreed by both the sender and receiver. Asynchronous serial
data communication is widely used for character-oriented transmissions where each
character is placed in between start and stop bits, this is called framing and block-
oriented data transfers use the synchronous method. The start bit is always one bit, but the
stop bit can be one or two bits the start bit is always a 0 (low) and the stop bit(s) is 1
(high).

31
Figure 4.3 Transmissions of Data

Due to the extended ASCII characters, 8-bit ASCII data is common in modern PCs the
use of one stop bit is standard. Assuming that we are transferring a text file of ASCII
characters using 1 stop bit, we have a total of 10 bits for each character. In some systems
in order to maintain data integrity, the parity bit of the character byte is included in the
data frame. The rate of data transfer in serial data communication is stated in bps (bits per
second).

Another widely used terminology for bps is baud rate. As far as the conductor wire is
concerned, the baud rate and bps are the same, and we use the terms interchangeably. The
data transfer rate of given computer system depends on communication ports
incorporated into that system.

An interfacing standard RS232 was set by the Electronics Industries Association (EIA)
in 1960. The standard was set long before the advent of the TTL logic family, its input
and output voltage levels is not TTL compatible where a 1 is represented by -3 ~ -25 V,
while a 0 bit is +3 ~ +25 V, making -3 to +3 undefined.

4.2MAX232

A line driver required to convert RS232 voltage levels to TTL levels, and vice versa. It
includes a capacitive voltage generator to supply TIA/EIA-232-F voltage levels from a

32
single 5-V supply. Each receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOS
levels. These receivers have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and
can accept ±30-V inputs. Each driver converts TTL/CMOS input levels into TIA/EIA-
232-F levels.

Pin Diagram

Figure 4.4 MAX 232 pin configuration

Connection with Microcontroller and DB9

Figure 4.5 Connections with Microcontroller and DB9

33
8051 has two pins that are used specifically for transferring and receiving data serially.
These two pins are called TxD and RxD and are part of the port 3 group (P3.0 and
P3.1).These pins are TTL compatible; therefore, they require a line driver to make them
RS232 compatible. To allow data transfer between the PC and an 8051 system without
any error, we must make sure that the baud rate of 8051 system matches the baud rate of
the PC’s COM port.

4.3 REGISTER STRUCTURE

SBUF Register: This is an 8-bit register used solely for serial communication. For a
byte data to be transferred via the TxD line, it must be placed in the SBUF register. The
moment a byte is written into SBUF, it is framed with the start and stop bits and
transferred serially via the TxD line. SBUF holds the byte of data when it is received by
8051 RxD line. When the bits are received serially via RxD, the 8051 defames it by
eliminating the stop and start bits, making a byte out of the data received, and then
placing it in SBUF.

SCON Register: SCON is an 8-bit register used to program the start bit, stop bit, and
data bits of data framing, among other things.

Table 4.1 Functions of various bits in SCON register

34
SM0, SM1: They determine the framing of data by specifying the number of bits per
character, and the start and stop bits.

Table 4.2 Mode selection using SM0 & SM1

SM2: This enables the multiprocessing capability of the 8051.

REN (receive enable): It is a bit-addressable register. When it is high, it allows 8051


to receive data on RxD pin. If low, the receiver is disables (transmit interrupt). When
8051 finishes the transfer of 8-bit character. It raises TI flag to indicate that it is ready to
transfer another byte. TI bit is raised at the beginning of the stop bit RI (receive
interrupt). When 8051 receives data serially via RxD, it gets rid of the start and stop bits
and places the byte in SBUF register. It raises the RI flag bit to indicate that a byte has
been received and should be picked up before it is lost. RI is raised halfway through the
stop bit.

4.4I²C

Philips Semiconductors developed the I²C bus over 20 years ago and has an extensive
collection of specific use and general purpose devices. Originally, the I²C bus was
designed to link a small number of devices on a single card, such as to manage the tuning
of a car radio or TV. The maximum allowable capacitance was set at 400 pF to allow
proper rise and fall times for optimum clock and data signal integrity with a top speed of
100 kbps. In 1992 the standard bus speed was increased to 400 kbps, to keep up with the
ever-increasing performance requirements of new ICs. The 1998 I²C specification,

35
increased top speed to 3.4 Mbits/sec. All I²C devices are designed to be able to
communicate together on the same two-wire bus and system functional architecture is
limited only by the imagination of the designer.

But while its application to bus lengths within the confines of consumer products such
as PCs, cellular phones, car radios or TV sets grew quickly, only a few system integrators
were using it to span a room or a building. The I²C bus is now being increasingly used in
multiple card systems, such as a blade servers, where the I²C bus to each card needs to be
isolatable to allow for card insertion and removal while the rest of the system is in
operation, or in systems where many more devices need to be located onto the same card,
where the total device and trace capacitance would have exceeded 400 pF.

New bus extension & control devices help expand the I²C bus beyond the 400 pF limit
of about 20 devices and allow control of more devices, even those with the same address.
These new devices are popular with designers as they continue to expand and increase the
range of use of I²C devices in maintenance and control applications.

4.4.1 Features

1. I²C Only two bus lines are required: a serial data line (SDA) and a serial clock line
(SCL).
2. Each device connected to the bus is software addressable by a unique address and
simple master/slave relationships exist at all times; masters can operate as master-
transmitters or as master-receivers.
3. It’s a true multi-master bus including collision detection and arbitration to prevent
data corruption if two or more masters simultaneously initiate data transfer.
4. Serial, 8-bit oriented, bi-directional data transfers can be made at up to 100 kbit/s
in the Standard-mode, up to 400 kbit/s in the Fast-mode, or up to 3.4 Mbit/s in the
High-speed mode.
5. On-chip filtering (50 ns) rejects spikes on the bus data line to preserve data
integrity.
6. The number of ICs that can be connected to the same bus segment is limited only

36
by the maximum bus capacitive loading of 400 pF.

4.4.2 Communication Procedure

One IC that wants to talk to another must:

1. Wait until it sees no activity on the I²C bus. SDA and SCL are both high. The bus
is ‘free’.
2. Put a message on the bus that says 'its mine' - I have STARTED to use the bus. All
other ICs then LISTEN to the bus data to see whether they might be the one who
will be called up (addressed).
3. Provide on the CLOCK (SCL) wire a clock signal. It will be used by all the ICs
as the reference time at which each bit of DATA on the data (SDA) wire will be
correcting (valid) and can be used. The data on the data wire (SDA) must be valid
at the time the clock wire (SCL) switches from ‘low’ to 'high' voltage.
4. Put out in serial form the unique binary 'address'(name) of the IC that it wants to
communicate with.
5. Put a message (one bit) on the bus telling whether it wants to SEND or RECEIVE
data from the other chip.
6. Ask the other IC to ACKNOWLEDGE (using one bit) that it recognized its
address and is ready to communicate.
7. After the other IC acknowledges all is OK, data can be transferred.
8. The first IC sends or receives as many 8-bit words of data as it wants. After every
8-bit data word the sending IC expects the receiving IC to acknowledge the
transfer is going OK.
9. When all the data is finished the first chip must free up the bus and it does that by
a special message called 'STOP'. It is just one bit of information transferred by a
special ‘wiggling’ of the SDA/SCL wires of the bus.

The bus rules say that when data or addresses are being sent, the DATA wire is only
allowed to be changed in voltage (so, '1', '0') when the voltage on the clock line is LOW.

37
The 'start' and 'stop' special messages BREAK that rule, and that is how they are
recognized as special.

Any device with the ability to initiate messages is called a ‘master’. It might know
exactly what other chips are connected, in which case it simply addresses the one it
wants, or there might be optional chips and it then checks what’s there by sending each
address and seeing whether it gets any response (acknowledge).

4.4.3 Theory of Operation

I²C is a low to medium speed serial bus with unimpressive list of features:

1. Resistant to glitches and noise


2. Supported by a large and diverse range of peripheral devices
3. A well-known robust protocol
4. A long track record in the field
5. A respectable communication distance which can be extended to longer distances
with bus extenders
6. Compatible with a number of processors with integrated I²C ports (micro 8,16,32
bits) in 8048, 80C51 or 6800 and 68xxx architectures
7. Easily emulated in software by any microcontroller
8. Available from an important number of component manufacturers

Figure 4.6 I²C hardware architecture

38
4.4.4 Bus Terminology

Transmitter - the device that sends data to the bus. A transmitter can either be a device
that puts data on the bus of its own accord (a ‘master-transmitter’), or in response to a
request from data from another devices (a ‘slave-transmitter’).

Receiver - the device that receives data from the bus.

Master - the component that initializes a transfer, generates the clock signal, and
terminates the transfer. A master can be either a transmitter or a receiver.

Slave - the device addressed by the master. A slave can be either receiver or transmitter.

Multi-master - the ability for more than one master to co-exist on the bus at the same
time without collision or data loss.

Arbitration - the prearranged procedure that authorizes only one master at a time to take
control of the bus.

Synchronization - the prearranged procedure that synchronizes the clock signals


provided by two or more masters.

SDA - data signal line (Serial DAta)

SCL - clock signal line (Serial CLock)

4.4.5 START and STOP Conditions

Within the procedure of the I²C bus, unique situations arise which are defined as START
(S) and STOP (P) conditions.

39
Figure 4.7 I²C bus Overview

START: A HIGH to LOW transition on the SDA line while SCL is HIGH

STOP: A LOW to HIGH transition on the SDA line while SCL is HIGH

The master always generates START and STOP conditions. The bus is considered to
be busy after the START condition. The bus is considered to be free again a certain time
after the STOP condition. The bus stays busy if a repeated START (Sr) is generated
instead of a STOP condition. In this respect, the START (S) and repeated START (Sr)
conditions are functionally identical. The S symbol will be used as a generic term to
represent both the START and repeated START conditions, unless Sr is particularly
relevant.

Detection of START and STOP conditions by devices connected to the bus is easy if
they incorporate the necessary interfacing hardware. However, microcontrollers with no
such interface have to sample the SDA line at least twice per clock period to sense the
transition.

4.4.6 Hardware configuration

Figure shows the hardware configuration of the I²C bus. The ‘bus’ wires are named SDA

40
(serial data) and SCL (serial clock). These two bus wires have the same configuration.
They are pulled-up to the logic ‘high’ level by resistors connected to a single positive
supply, usually +3.3 V or +5 V but designers are now moving to +2.5 V and towards 1.8
V in the near future.

All the connected devices have open-collector (open-drain for CMOS - both terms
mean only the lower transistor is included) driver stages that can transmit data by pulling
the bus low, and high impedance sense amplifiers that monitor the bus voltage to receive
data. Unless devices are communicating by turning on the lower transistor to pull the bus
low, both bus lines remain ‘high’. To initiate communication a chip pulls the SDA line
low. It then has the responsibility to drive the SCL line with clock pulses, until it has
finished, and is called the bus ‘master’.

4.4.7 Bus Communication

Communication is established and 8-bit bytes are exchanged, each one being
acknowledged using a 9th data bit generated by the receiving party, until the data transfer
is complete. The bus is made free for use by other ICs when the ‘master’ releases the
SDA line during a time when SCL is high. Apart from the two special exceptions of start
and stop, no device is allowed to change the state of the SDA bus line unless the SCL line
is low. If two masters try to start a communication at the same time, arbitration is
performed to determine a “winner” (the master that keeps control of the bus and continue
the transmission) and a “loser” (the master that must abort its transmission). The two
masters can even generate a few cycles of the clock and data that ‘match’, but eventually
one will output a ‘low’ when the other tries for a ‘high’. The ‘low’ wins, so ‘loser’ device
withdraws and waits until the bus is freed again. There is no minimum clock speed; in
fact any device that has problems to ‘keep up the pace’ is allowed to ‘complain’ by
holding the clock line low. Because the device generating the clock is also monitoring
the voltage on the SCL bus, it immediately ‘knows’ there is a problem and has to wait
until the device releases the SCL line.

41
4.4.8 Address scheme

Any I²C device can be attached to the common I²C bus and they talk with each other,
passing information back and forth. Each device has a unique 7-bit or 10-bit I²C address.
For 7-bit devices, typically the first four bits are fixed, the next three bits are set by
hardware address pins (A0, A1, and A2) that allow the user to modify the I²C address
allowing up to eight of the same devices to operate on the I²C bus. These pins are held
high to VCC, sometimes through a resistor, or held low to GND. The last bit of the initial
byte indicates if the master is going to send (write) or receive (read) data from the slave.
Each transmission sequence must begin with the start condition and end with the stop
condition. On the 8th clock pulse, SDA is set ‘high’ if data is going to be read from the
other device, or ‘low’ if data is going to be sent (write). During its 9th clock, the master
releases SDA line to accomplish the Acknowledge phase. If the other device is connected
to the bus, and has decoded and recognized its ‘address’, it will acknowledge by pulling
the SDA line low. The responding chip is called the bus ‘slave’.

Figure 4.8 I²C Address scheme

42
4.4.9 Terminology for bus transfer

Figure 4.9 I²C Read Write operations

1. F (FREE) - the bus is free; the data line SDA and the SCL clock are both in the
high state.
2. S (START) or SR (Repeated START) - data transfer begins with a start condition
(not a start bit). The level of the SDA data line changes from high to low, while the
SCL clock line remains high. When this occurs, the bus is ‘busy’.
3. C (CHANGE) - while the SCL clock line is low, the data bit to be transferred can
be applied to the SDA data line by a transmitter. During this time, SDA may
change its state, as along as the SCL line remains low.
4. D (DATA) - a high or low bit of information on the SDA data line is valid during
the high level of the SCL clock line. This level must be maintained stable during
the entire time that the clock remains high to avoid misinterpretation as a Start or
Stop condition.
5. P (STOP) - data transfer is terminated by a stop condition, (not a stop bit). This
occurs when the level on the SDA data line passes from the low state to the high
state, while the SCL clock line remains high. When the data transfer has been
terminated, the bus is free once again.

43
4.5LCD Unit

A liquid crystal display (LCD) is a thin, flat display device made up of any number of
color or monochrome pixels arrayed in front of a light source or reflector. It is prized by
engineers because it uses very small amounts of electric power, and is therefore suitable
for use in battery-powered electronic devices.

Each pixel consists of a column of liquid crystal molecules suspended between two
transparent electrodes, and two polarizing filters, the axes of polarity of which are
perpendicular to each other. Without the liquid crystals between them, light passing
through one would be blocked by the other. The liquid crystal twists the polarization of
light entering one filter to allow it to pass through the other.

The molecules of the liquid crystal have electric charges on them. By applying small
electrical charges to transparent electrodes over each pixel or sub pixel, the molecules are
twisted by electrostatic forces. This changes the twist of the light passing through the
molecules, and allows varying degrees of light to pass (or not to pass) through the
polarizing filters. Before applying an electrical charge, the liquid crystal molecules are in
a relaxed state. Charges on the molecules cause these molecules to align themselves in a
helical structure, or twist (the "crystal"). In some LCDs, the electrode may have a
chemical surface that seeds the crystal, so it crystallizes at the needed angle. Light
passing through one filter is rotated as it passes through the liquid crystal, allowing it to
pass through the second polarized filter. A small amount of light is absorbed by the
polarizing filters, but otherwise the entire assembly is transparent.

When an electrical charge is applied to the electrodes, the molecules of the liquid
crystal align themselves parallel to the electric field, thus limiting the rotation of entering
light. If the liquid crystals are completely untwisted, light passing through them will be
polarized perpendicular to the second filter, and thus be completely blocked. The pixel
will appear unlit. By controlling the twist of the liquid crystals in each pixel, light can be
allowed to pass though in varying amounts, correspondingly illuminating the pixel.

44
Figure 4.10 LCD Display

4.5.1 Pin description of LCD

PIN SYMBOL I/ DESCRIPTIONS


O
1 VSS ----- GROUND
---
2 VCC ----- +5V POWER SUPPLY
---
3 VEE ----- POWER SUPPLY TO CONTROL CONTRAST
----
4 RS I RS=O TO SELECT COMMAND REGISTER

RS=1 TO SELECT DATA REGISTER


5 R/W I R/W=0 FOR WRITE,R/W=1 FOR READ
6 E I/O ENABLE
8TO 14 DB0 TO DB14 I/O 8 BIT DATA BUSES
Table 4.3 Pin description of LCD

4.5.2 LCD COMMAND CODES

1. 80 Force cursor to beginning to 1st line

45
2. C0 Force cursor to beginning to 2nd line
3. 38 2 lines and 5x7 matrix
4. 1C Shift the entire display to the right
5. 18 Shift the entire display to the left
6. 14 Shift cursor position to right
7. 10 Shift cursor position to left
8. F Display on, cursor blinking
9. E Display on, cursor blinking
10. C Display on, cursor off
11. A Display off, cursor on
12. 8 Display off, cursor off
13. 7 Shift display left
14. 5 Shift display right
15. 6 Increment cursor (shift cursor to right)
16. 4 Decrement cursor (shift cursor to left)
17. 2 Return home
18. 1 Clear display screen

4.6Keil (IDE) MicroVision3

Keil Software development tools are used to create products for practically every
industry: consumer electronics, industrial control, networking, office automation,
automotive, space exploration. Micro Vision Two is a second generation IDE that
simplifies project development and application testing. With Micro Vision Two, we can
easily create embedded applications in a mixture of C and assembly. Real-time
applications benefit from our highly optimized C libraries and real-time kernels.

MicroVision3 provides a centralized front-end interface for the compiler, assembler,


linker, debugger, and other development tools. The Project Window in MicroVision3
displays the current target, groups, and source files that comprise our project. Rather than
creating a single target for each project, MicroVision2allows multiple targets for each

46
project file. So, with a single project file, we can create a target for simulating, a target
for our emulator, and a production target for programming into EPROM {E-PROM}.

Each target is composed of one or more groups which are in turn composed of one or
more source files. Groups let us divide the source files into functional blocks or assign
source files to different team members. Options may be configured at each level of the
project. This gives us a great deal of freedom and flexibility when organizing our
application. In addition to the on-line help, MicroVision3 provides on-line versions of the
development tool manuals as well as the device manuals.

Keil C Compilers are based on the ANSI standard and include extensions necessary to
support the 8051, 251, and 166 microcontroller families. The optimizer in our compiler
is tuned for each specific architecture and provides the highest level of code density and
execution speed.

The Keil C compilers give full us control over our embedded platform. We decide
which register banks are used, when to access certain memory areas, which variables are
stored in bits, when and how to use special function registers, and so on. Without ever
writing any assembly code we may even write interrupt service routines in C. Code
generated by the Keil C Compiler compares with that of a professional assembly
programmer. This is due to the level of optimizations that are performed. One such
optimization is global register optimization.

By analyzing which registers are used in each function, the compiler can better
optimize register usage program-wide and generate smaller, faster programs. This is
accomplished by iterative compilation steps during the make process.

The MicroVision3 debugger is designed to make testing your programs as efficient as


possible. While editing and debugging your programs, text and code attributes are
displayed in the source window. As you step through your program, the current line is
marked with a yellow arrow. Code coverage shows you which lines of your program have
been executed. Green means the line has been run. Grey means is has not.

47
Breakpoints are clearly marked in the source window. Red for enabled, white for
disabled. These attributes make following program flow easier than ever. The features of
the Micro Vision Two debugger don’t stop there. When simulating your programs, you
not only get source-level, symbolic simulation. You also get on-chip peripheral
simulation. Dialog boxes display the condition of all peripherals and on-chip
components.

The debugger supports a C macro language that you may use to simulate external
hardware. We may create functions to simulate digital and analog input signals for your
application. This lets you get straight to testing and debugging before the target hardware
is available. With nothing more than the simulator and the macro language, you can
create a high-fidelity simulation of your end product.

Summary

In this chapter we have discussed the basics of serial communication. MAX232 has been
discussed with it pin configuration and characteristics. The various registers used in serial
communication have explained. The I²C protocols used for communication have
explained. The LCD unit also discussed here.

CHAPTER-5

48
HARDWARE DESIGN

5.1 RTC (REAL TIME CLOCK)

5.1.1 General description

The DS1307 serial real-time clock (RTC) is a low-power, full binary-coded decimal
(BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred
serially through an I²C, bidirectional bus. The clock/calendar provides seconds, minutes,
hours, day, date, month, and year information. The end of the month date is automatically
adjusted for months with fewer than 31 days, including corrections for leap year. The
clock operates in either the 24-hour or 12-hour format with AM/PM indicator. The
DS1307 has a built-in power-sense circuit that detects power failures and automatically
switches to the backup supply. Timekeeping operation continues while the part operates
from the backup supply.

5.1.2 Typical operating circuit

Figure 5.1 RTC connections with controller

5.1.3 Features

49
1. Real-Time Clock (RTC) Counts Seconds, Minutes, Hours, Date of the Month,
Month, Day the week, and Year with Leap-Year Compensation Valid Up to 2100.
2. 56-Byte, Battery-Backed, General-Purpose RA with Unlimited Writes. I²C Serial
Interface.
3. Programmable Square-Wave Output Signal.
4. Automatic Power-Fail Detect and Switch Circuit.
5. Consumes Less than 500nA in Battery-Backup Mode with Oscillator Running .
6. Optional Industrial Temperature Range: -40°C to +85°C .
7. Available in 8-Pin Plastic DIP or SO.
8. Underwriters Laboratories (UL) Recognized

5.1.4 Pin description

Figure 5.2 Pin diagram of DS1307 IC

50
Table 4.4 Pin description of DS1307

51
5.2 OrCAD schematic for system PCB connections

J26 J20
VCC J1 LS2
1
J8 5 2
R9
3 3
1 Q2 4
1
2
3
4
J24 2 Q1 1
3 2

9
8
7
6
5
4
3
2
1
16
15
14
13
12
11
10
1
2 R8
CON3 J21
LS1
J23 VCC 1
5 2
R 11
3 3

1
2
3
4
5
6
7
8
1
2
8 1 Q4 4
9 2 Q3 1
10 3 J10 J9 2
11 4 SW 2 J6 U1 J7 J2
12 5 1 1 CONN TR B LK 8 C O N N TR BLK 2 R 10
1
F
0

13 6 2 2 39 21 1
14 7 3 3 38 P 0 .0 /A D 0 P 2 .0 /A 8 2 2 2 J22
4 4 37 P 0 .1 /A D 1 P 2 .1 /A 9 2 3 3 LS3
5 5 36 P 0 .2 /A D 2 P 2 .2 /A 1 0 2 4 4 1
P 0 .3 /A D 3 P 2 .3 /A 1 1 2 5 R 13
6 6 35 5 5 2
SW 1 7 7 34 P 0 .4 /A D 4 P 2 .4 /A 1 2 2 6 6 Q6 3 3
8 8 33 P 0 .5 /A D 5 P 2 .5 /A 1 3 2 7 7 Q5 4
1
F
0

9 32 P 0 .6 /A D 6 P 2 .6 /A 1 4 2 8 8 J3 1
J5 P 0 .7 /A D 7 P 2 .7 /A 1 5 2
CON8 1 10 1 R 12
C7 P 1 .0 P 3 .0 /R XD
C O N 91 2 11 2
2 3 P 1 .1 P 3 .1 /T XD 12 3
3 4 P 1 .2 P 3 .2 /IN T 0 13 4 BT1
C9 C8 P 1 .3 P 3 .3 /IN T 1
4 5 14 5
5 6 P 1 .4 P 3 .4 /T 0 15 6
C2 6 7 P 1 .5 P 3 .5 /T 1 16 7
CAP 7 8 P 1 .6 P 3 .6 /W R 17 8
8 P 1 .7 P 3 .7 /R D J18 BA TTE R Y
R1 19 30
C3 18 XTA L1 A L E /P R O G 2 9
XTA L2 PSEN J16
C6
13
11
10

31
8

1
3
4
5
2
6

9 E A /V P P 1 2 C5
1
2

C1 RST 3 4
V-
V+
C 1-
C 2-
C 1+
C 2+
T 1 IN
T 2 IN
R 1 IN
R 2 IN

CAP 5 6
AT89C 51 R7 7 8 J19
RD E2 S I S T O R
J15 1
M A X232
R 1O U T
R 2O U T
T1O U T
T 2O U T

2
U2 3
C4 4
5
9
7

LED
12
14

C 10
6
1
2
3
4
5
6

R2 R3 R4 R5 J17
D1
R6
1 2 CON6
3 4
5 6
7 8
R E S IS T O R
LED
2
4

2
4

2
4

2
4

J11 J12 J13 J14

T it le
< T it le >
VCC
1
3

1
3

1
3

1
3

S iz e D ocum ent N um ber R ev


A <D oc> <R ev C ode>

D a te : F rid a y , A p r il 0 3 , 2 0 0 9 Sheet 1 of 1

52
5.3 Block diagram

Figure 5.1 Block diagram of the authentication process

5.4 Relay

Relays are components which allow a low-power circuit to switch a relatively high
current on and off, or to control signals that must be electrically isolated from the
controlling circuit it self. Newcomers to electronics sometimes want to use a relay for this
type of application, but are unsure about the details of doing so. To make a relay operate,
you have to pass a suitable pull-in and holding current (DC) through its energizing coil.
And generally relay coils are designed to operate from a particular supply voltage often
12V or 5V, in the case of many of the small relays used for electronics work. In each case
the coil has a resistance which will draw the right pull-in and holding currents when it is
connected to that supply voltage. So the basic idea is to choose a relay with a coil
designed to operate from the supply voltage we are using for your control circuit(and
with contacts capable of switching the currents you want to control), and then provide a
suitable relay driver circuit so that your low-power circuitry can control the current
through the relay’s coil. Typically this will be somewhere between 25mA and 70mA.

Often your relay driver can be very simple, using little more than an NPN or PNP
transistor to control the coil current. All your low-power circuitry has to do is provide

53
enough base current to turn the transistor on and off, as you can see from diagrams A and
B.

In A, NPN transistor Q1 (say a BC337 or BC338) is being used to control a relay


(RLY1) with a 12V coil, operating from a +12V supply. Series base resistor R1 is used to
set the base current for Q1, so that the transistor is driven into saturation (fully turned on)
when the relay is to be energized. That way, the transistor will have minimal voltage
drop, and hence dissipate very little power as well as delivering most of the12V to the
relay coil.

Figure 5.4 Driving circuit for relay

Summary

In this chapter general descriptions of all the important section have been given. Circuit
diagram of related sections and important portion have also been given. Pin descriptions
of various IC’s are given for proper understanding of connections. For connections
OrCAD schematic design is given. Working of sections like RTC and relay have been
explained with the help a block diagram.

54
CHAPTER-6

RESULTS AND DISCUSSION

6.1 Result and Conclusion

The project report began with the introduction to the basic functioning of Microcontroller
based Identification, Authentication and Setup of Security system. Project deals with
Microcontroller as central controlling units for various other sections like Biometrics
FIM 3030 module, RTC (real time clock) section, LCD, Relay section, push button
section etc. Interfacing between all sections required for system and microcontroller
P89c51 has been done successfully. For registration interfacing between biometrics
module and personal computer has also been done successfully. When a new person who
is not register with the system try to have access, system refuses access and displays
message “Unidentified FP”. For the person who is registered with the system can get
access through doors according to their designation. Doors opening and closing has been
achieved successfully.

There are many mature biometric systems are available now. Proper design and
implementation of the biometric system can indeed increase the overall security;
especially the smartcard based solutions seem to be very promising. Making a secure
biometric systems is, however, not as easy as it might appear. The word biometrics is
very often used as a synonym for the perfect security. This is a misleading view. There
are numerous conditions that must be taken in account when designing a secure biometric
system. First, it is necessary to realize that biometrics is not secrets. This implies be
careful that biometric measurements cannot be used as capability tokens and it is not
secure to generate any cryptographic keys from them. Second, it is necessary to trust the
input device and make the communication link secure. Third, the input device needs to
check the live ness of the person being measured and the device itself should be verified
for example by a challenge-response protocol.

55
6.2 Future scopes

The above developed system is quit versatile in nature. So many applications can be
added with the same system by just little modification required.

1. Attendance system module can also be interfaced with the same existing system
which keeps the record (Identity, Time, Date etc.) of that person and
corresponding data base can be maintained. IC 74LS244 can be used for
multiplexing RxD and TxD to creating the hardware for attendance system.

2. Same system can be implemented at high security area, where only selected
persons are allowed.

3. The end part of the system, i.e., finger print scanner can be replaced by RF Id
scanner and ID cards containing persons ID no. (Tag) can be given to the
persons. During scanning data base related to person’s position can be
maintained. Only little changes are required in main programming with
appropriate hardware.

4. Present project hardware is implemented on general purpose PCB. As schematic


diagram of project is given, which is designed in OrCAD. Also errors have been
removed. In future PCB can be created for the same by making schematics foot
print layout and burning Cu plate PCB Board.

56
REFERENCES
1. Muhammad Ali Mazidi, Janice Gillispi Mazidi and Rolin D. Mckinlay, The 8051
Microcontroller and Embedded Systems: Using assembly and C 2nd Edition,
Delhi: Pearson Prentic Hall, 2006.
2. http://www.nxp.com/acrobat_download/datasheets/P89CV51RB2_RC2_RD2_2.pd
f
3. http://www.atmel.com/dyn/resources/prod_documents/doc0265.pdf
4. http://www.info.bioenabletech.com/Products/nitgen/fim3030lv_hv/FIM30NDataS
heetv1.01.pdf
5. http://www.nxp.com/acrobat_download/applicationnotes/AN10216_1.pdf
6. http:/www.fi.muni.cz/reports/files/older/FIMU-RS-2000-08.pdf
7. http://www.maxim-ic.com/search/parts.mvp?pn=max220-max249
8. http://www.datasheets.maxim-ic.com/en/ds/DS1307.pdf
9. http://www.misterfixit.com/switches/relay.htm
10. http://www.rentron.com/PicBasic/relay-circuit.gif
11. http://www.lcdinterfacing.googlepages.com/lcdprogrammingwith8051
12. http://www.mcu-programming.blogspot.com/2006/09/lcd-interfacing.html
13. http://www.atmel.com/litrature
14. http://www.en.wikipedia.org/wiki/Fingerprint_recognition
15. http://www.sparkfun.com/datasheets/Sensors/Biometric/FIM3040LV%20Data%20
sheet.pdf
16. http://www.keil.com/uvision/
17. http://www.electrofriends.com/wp-content/uploads/2008/11/pin-8051.gif
18. http://www.rentron.com/PicBasic/relay-circuit.gif
19. http://daneshnameh.roshd.ir/mavara/img/daneshnameh_up/7/79/max232a.gif

57
APPENDIX

EMBEDED C LANGUAGE PROGRAM

// Dr. B R Ambedkar National Institute of Technology Jalandhar

//Department of Electronics & Communication Engineering

//“Microcontroller 8051 based Identification, Authentication and Setup of Security


System using FIM 3030 Biometrics Module.

// Manu Puri (05104028), Naresh Kumar (05104032) & Pramod Kumar (05104040)

// Connect Port1L with I2c Interface(JP18)

// Connect Port1H with lcd Control(J2)

// Connect Port2 with Switches

// Connect Port0 with lcd Data(JP2)

// Connect Port3 with Relays

#include<reg51.h>

#include<intrins.h>

unsigned int i,a,b,c,j,x;

typedef unsigned char uchar;

typedef unsigned long ulong;

typedef unsigned int uint;

#define TIMER_RELOAD (-921)

#define port_delay() _nop_(), _nop_(), _nop_(), _nop_()

58
#define AVG 10

char arr0[16]=" NIT JALANDHAR ";

char arr1[16]="Conn Established";

char arr2[16]="---Identified---";

char display1[16] =" Unidentified FP";

char display2[16] ="Sorry Try again ";

char hourr[15];

char minutee[15];

char secondd[15];

char datee[15];

char monthh[15];

char person[15][10];

char con_est[25];

char identified[10];

char
initial[25]={0x7E,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01};

char
identify[25]={0x7E,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12};

sbit R1 = P2 ^ 4; //row1`

sbit R2 = P2 ^ 5;

sbit R3 = P2 ^ 6;

sbit R4 = P2 ^ 7;

sbit C1 = P2 ^ 0; // column 1

59
sbit C2 = P2 ^ 1;

sbit C3 = P2 ^ 2;

sbit C4 = P2 ^ 3;

sbit rel2= P3 ^ 4;

sbit rel1= P3 ^ 2;

sbit rel3 = P3 ^ 5;

sbit ICLK = P1 ^ 3;

sbit IDAT = P1 ^ 1;

sbit RS = P1 ^ 5;

sbit E= P1 ^ 4;

void delay();

void key_scan();

void instwrt();

void datawrt();

void lcd_Init();

void longdelay();

void verylongdelay();

void Refresh();

void check();

uint count;

uchar rdata,edata;

uint time;

uchar second,minute,hour,day,date,month,year;

60
unsigned int col,row,net;

void timer0(void)

interrupt 1 using 1

count++;

TH0 = (uchar)(TIMER_RELOAD>>8);

TL0 = (uchar)TIMER_RELOAD;

void delay1(uint n)

n = count + n;

while (n != count);

void dispstr(uchar *str, uchar stcol, uchar encol)

uint q;

if(stcol <= 15)

P0 = 0x80 + stcol;

else

P0 = 0xB0 + stcol;

RS = 0;

E = 1;

E = 0;

61
delay1(1);

RS = 1;

q=0;

for(; stcol <= encol; stcol++)

if(stcol == 16)

P0 = 0xB0 + stcol;

RS = 0;

E = 1;

E = 0;

delay1(1);

RS = 1;

P0 = str[q];

q++;

E = 1;

E = 0;

delay1(1);

void dispnum(uint no, uchar stcol, uchar encol)

62
uchar temp[5];

uchar i;

for (i = 0; i < 2; i++)

temp[i] = no % 10;

no /= 10;

if(stcol <= 15)

P0 = 0x80 + stcol;

else

P0 = 0xB0 + stcol;

RS = 0;

E = 1;

E = 0;

delay1(1);

RS = 1;

i = 1;

for(; stcol <= encol; stcol++)

P0 = temp[i] + 0x30;

i--;

E = 1;

E = 0;

63
delay1(1);

void clrlcd()

RS = 0;

P0 = 0x01;

E = 1;

E = 0;

delay1(6);

void str1307(void)

IDAT = 1 ;

_nop_() , _nop_() , _nop_() ;

ICLK = 1 ;

_nop_() , _nop_() , _nop_() ;

IDAT = 0 ;

_nop_() , _nop_() , _nop_() ;

ICLK = 0 ;

_nop_() , _nop_() , _nop_() ;

void stp1307(void)

64
{

IDAT = 0 ;

_nop_() , _nop_() , _nop_() ;

ICLK = 1 ;

_nop_() , _nop_() , _nop_() ;

IDAT = 1 ;

_nop_() , _nop_() , _nop_() ;

ICLK = 0 ;

_nop_() , _nop_() , _nop_() ;

void clock(void)

_nop_() ; _nop_() ; _nop_() ;

ICLK = 1 ;

_nop_() ; _nop_() ; _nop_() ;

ICLK = 0 ;

_nop_() ; _nop_() ; _nop_() ;

void ack1307(void)

IDAT = 0 ;

clock() ;

65
void nack1307(void)

IDAT = 1 ;

clock() ;

void opdat(char rtcdata)

char i ;

for ( i = 0 ; i < 8 ; i++ )

if ( ( rtcdata >> ( 7 - i ) ) & 0x01 ) IDAT = 1 ;

else IDAT = 0 ;

clock() ;

void waitack(void)

IDAT = 1 ;

_nop_() , _nop_() , _nop_() ;

while ( IDAT ) ;

ICLK = 1 ;

_nop_() , _nop_() , _nop_() ;

ICLK = 0 ;

66
}

char getdat(void)

char i , dat ;

// watch() ;

IDAT = 1 ;

_nop_() , _nop_() , _nop_() ;

for ( i = 0 ; i < 8 ; i++ )

ICLK = 1 ;

dat = ( ( ( dat << 1 ) & 0xfe ) | IDAT ) ;

_nop_() , _nop_() , _nop_() ;

ICLK = 0 ;

_nop_() , _nop_() , _nop_() ;

return dat ;

void getrtc(void)

char rdata ;

str1307() ;

opdat(0xd0) ;

waitack() ;

67
opdat(0x00) ;

waitack() ;

stp1307() ;

_nop_() , _nop_() , _nop_() ;

str1307() ;

opdat(0xd1) ;

waitack() ;

rdata = getdat() ;

ack1307() ;

second = ( rdata & 0x7f) ;

rdata = getdat() ;

ack1307() ;

minute = ( rdata & 0x7f) ;

rdata = getdat() ;

ack1307() ;

hour = ( rdata & 0x3f) ;

rdata = getdat() ;

ack1307() ;

day = ( rdata & 0x07) ;

rdata = getdat() ;

ack1307() ;

date = ( rdata & 0x3f) ;

rdata = getdat() ;

68
ack1307() ;

month = ( rdata & 0x1f) ;

rdata = getdat() ;

nack1307() ;

year = rdata ;

stp1307() ;

void setrtc(void)

char rdata ;

str1307() ;

opdat(0xd0) ;

waitack() ;

opdat(0x00) ;

waitack() ;

rdata = ( second & 0x7f) ;

opdat(rdata) ;

waitack() ;

rdata = ( minute & 0x7f) ;

opdat(rdata) ;

waitack() ;

rdata = ( hour & 0x3f) ;

opdat(rdata) ;

69
waitack() ;

rdata = ( day & 0x07) ;

opdat(rdata);

waitack();

rdata = ( date & 0x3f);

opdat(rdata) ;

waitack() ;

rdata = ( month & 0x1f);

opdat(rdata);

waitack() ;

rdata = year ;

opdat(rdata) ;

waitack() ;

stp1307() ;

unsigned char bcdtime(unsigned char x)

return ( ( ( x / 10 ) << 4 ) + ( x % 10 ) ) ;

unsigned char binarytime(unsigned char x)

return ( ( ( x >> 4 ) * 10 ) + ( x & 0xf ) ) ;

70
void getrtc1(void)

getrtc() ;

year = binarytime( year );

month = binarytime( month );

date = binarytime( date );

hour = binarytime( hour );

minute = binarytime( minute );

second = binarytime( second );

void setrtc1(void)

year = bcdtime( year ) ;

month = bcdtime( month ) ;

date = bcdtime( date ) ;

hour = bcdtime( hour ) ;

minute = bcdtime( minute ) ;

second = bcdtime( second ) ;

setrtc() ;

void io_open(void)

71
TMOD = 0x01; // timer 0 mode 1

IE = 0x82; //1001 0010,enterupt enable,es=serial comm.,timer 0(high)

TL0 = (uchar)TIMER_RELOAD;

TH0 = (uchar)TIMER_RELOAD >> 8;

TR0 = 1;

void initlcd(void)

E = 0;

RS = 0;

delay1(20);

P0 = 0x30; //8 bit interface,1 line select

E = 1;

delay1(1);

E = 0;

delay1(6);

P0 = 0x30;

E = 1;

delay1(1);

E = 0;

delay1(6);

72
P0 = 0x30;

E = 1;

delay1(1);

E = 0;

delay1(6);

P0 = 0x38; //funtion set,2 line select

E = 1;

delay1(1);

E = 0;

delay1(6);

P0 = 0x0c8; //display off

E = 1;

delay1(1);

E = 0;

delay1(6);

P0 = 0x01; //clear display;

E = 1;

delay1(1);

E = 0;

73
delay1(6);

P0 = 0x06; //entry mode set

E = 1;

delay1(1);

E = 0;

delay1(6);

P0 = 0x0c; //display on

E = 1;

delay1(1);

E = 0;

delay1(6);

/*void key_scan()

P2 = 0x0F; // to make col as input and row as output

do

R1 = 0;

R2 = 0;

R3 = 0;

R4 = 0;

74
getrtc1();

Refresh();

} while (C1==1&C2==1&C3==1&C4==1);

if(C1==0)

col=0x0;

else if(C2==0)

col=0x1;

else if(C3==0)

col=0x2;

else

col=0x3;

P2 = 0xF0;

do

C1 = 0;

C2 = 0;

C3 = 0;

C4 = 0;

} while (R1==1&R2==1&R3==1&R4==1);

if(R1==0)

row=0x0;

else if(R2==0)

row=0x4;

75
else if(R3==0)

row=0x8;

else

row=0xC;

net = row+col;

} */ // ACTUAL SCAN FUNCTION

void key_scan()

P2= 0x00;

do

getrtc1();

Refresh();

} while(C1==0&C2==0&C3==0&C4==0);

if(C1==1)

col=0x0;

else if(C2==1)

col=0x1;

else if(C3==1)

col=0x2;

else

col=0x3;

net=col;

76
}

void main()

P2 = 0x0F;

io_open();

initlcd();

clrlcd ();

delay1(1000);

rel1=1;

rel2=1;

rel3=1;

minute = 20;

hour = 13;

second = 1;

date = 26;

month = 5;

year = 9;

setrtc1();

a=0;

b=0;

c=0;

77
TMOD=0X21;

TH1=0XFD;

SCON=0X50;

TR1=1;

while(1)

getrtc1();

Refresh();

TMOD=0X21;

TH1=0XFD;

SCON=0X50;

TR1=1;

if (~(C1==1&C2==1&C3==1&C4==1))

key_scan();

if (net==0)

for (j=0;j<25;j++)

SBUF = initial[j];

while(~TI);

TI=0;

for (j=0;j<25;j++)

78
{

while(!RI);

con_est[j] = SBUF;

RI=0;

if(con_est[8]==0x01);

P0=0x01;

instwrt();

for (j=0;j<16;j++)

P0=arr1[j];

datawrt();

longdelay();

else if (net==1)

for (j=0;j<25;j++)

SBUF = identify[j];

while(~TI);

79
TI=0;

for (j=0;j<25;j++)

while(!RI);

identified[j] = SBUF;

RI=0;

if(identified[8]==0x01)

for (j=0;j<10;j++)

while(!RI);

identified[j] = SBUF;

RI=0;

P0=0x01;

instwrt();

for (i=0;i<16;i++)

P0=arr2[i];

datawrt();

80
P0=0xC5;

instwrt();

for (j=1;j<10;j++)

person[a][j]=identified[j];

P0=identified[j];

datawrt();

} if(identified[0]=='a'| identified[0]=='A')

rel1=0;

rel2=0;

rel3=0;

for(j=0;j<3;j++)

verylongdelay();

rel1=1;

rel2=1;

rel3=1;

else if(identified[0]=='t'|identified[0]=='t')

rel1=0;

rel2=0;

for(j=0;j<3;j++)

81
verylongdelay();

rel1=1;

rel2=1;

else

rel1=0;

for(j=0;j<3;j++)

verylongdelay();

rel1=1;

hourr[a]=hour;

minutee[a]=minute;

secondd[a]=second;

datee[a] = date;

monthh[a] = month;

a=a+1;

else

P0=0x01;

instwrt();

dispstr("Unidentified FP",0,15);

82
}

longdelay();

longdelay();

P0=0x01;

instwrt();

else if (net==2)

if (b>0)

b=b-1;

check();

else

b=a;

verylongdelay();

else if (net==3)

b=0;

for(i=0;i<a;i++)

check();

83
verylongdelay();

b=b+1;

void delay()

for(x=0;x<4000;x++);

void longdelay()

for (x=0;x<20000;x++);

for (x=0;x<20000;x++);

void verylongdelay()

longdelay();

longdelay();

longdelay();

void instwrt(void)

84
RS=0;

E=1;

E=0;

delay();

void datawrt(void)

RS=1;

E=1;

E=0;

delay();

void Refresh()

dispstr(" NIT JALANDHAR ",0,15);

dispnum(hour,16,17);

dispnum(minute,19,20);

dispnum(second,22,23);

dispnum(date,27,28);

dispnum(month,30,31);

dispstr(":",18,18);

dispstr(":",21,21);

dispstr("Dt",25,26);

85
dispstr("/",29,29);

void check()

P0=0x01;

instwrt();

for (j=1;j<10;j++)

P0=person[b][j];

datawrt();

dispnum(hour,16,17);

dispnum(minutee[b],19,20);

dispnum(secondd[b],22,23);

dispnum(date,27,28);

dispnum(month,30,31);

dispstr(":",18,18);

dispstr(":",21,21);

dispstr("Dt",25,26);

dispstr("/",29,29);

longdelay();

longdelay();

86

S-ar putea să vă placă și