Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1 EMBEDDED SYSTEMS
Embedded systems are electronic devices that incorporate microprocessors with in their implementations. The main purposes of the microprocessors are to simplify the system design and provide flexibility. Having a microprocessor in the device helps in removing the bugs, making modifications, or adding new features are only matter of rewriting the software that controls the device. Or in other words embedded computer systems are electronic systems that include a microcomputer to perform a specific dedicated application. The computer is hidden inside these products. Embedded systems are ubiquitous. Every week millions of tiny computer chips come pouring out of factories finding their way into our everyday products. Embedded systems are self-contained programs that are embedded within a piece of hardware. Whereas a regular computer has many different applications and software that can be applied to various tasks, embedded systems are usually set to a specific task that cannot be altered without physically manipulating the circuitry. Another way to think of an embedded system is as a computer system that is created with optimal efficiency, thereby allowing it to complete specific functions as quickly as possible. Embedded systems designers usually have a significant grasp of hardware technologies. They use specific programming languages and software to develop embedded systems and manipulate the equipment. When searching online, companies offer embedded systems development kits and other embedded systems tools for use by engineers and businesses. Embedded systems technologies are usually fairly expensive due to the necessary development time and built in efficiencies, but they are also highly valued in specific industries. Smaller businesses may wish to hire a consultant to determine what sort of embedded systems will add value to their organization.
1.1.1 CHARACTERISTICS:
Two major areas of differences are cost and power consumption. Since many embedded systems are produced in tens of thousands to millions of units range, reducing cost
is a major concern. Embedded systems often use a (relatively) slow processor and small memory size to minimize costs. The slowness is not just clock speed. The whole architecture of the computer is often intentionally simplified to lower costs. For example, embedded systems often use peripherals controlled by synchronous serial interfaces, which are ten to hundreds of times slower than comparable peripherals used in PCs. Programs on an embedded system often run with realtime constraints with limited hardware resources: often there is no disk drive, operating system, keyboard or screen. A flash drive may replace rotating media, and a small keypad and LCD screen may be used instead of a PC's keyboard and screen. Firmware is the name for software that is embedded in hardware devices, e.g. in one or more ROM/Flash memory IC chips. Embedded systems are routinely expected to maintain 100% reliability while running continuously for long periods, sometimes measured in years. Firmware is usually developed and tested too much harsher requirements than is generalpurpose software, which can usually be easily restarted if a problem occurs.
1.1.2PLATFORM:
There are many different CPU architectures used in embedded designs. This in contrast to the desktop computer market which is limited to just a few competing architectures mainly the Intel/AMD x86 and the Apple/Motorola/IBM Power PCs which are used in the Apple Macintosh. One common configuration for embedded systems is the system on a chip, an application-specific integrated circuit, for which the CPU was purchased as intellectual property to add to the IC's design.
1.1.3 TOOLS:
Like a typical computer programmer, embedded system designers use compilers, assemblers and debuggers to develop an embedded system. Those software tools can come from several sources: Software companies that specialize in the embedded market Ported from the GNU software development tools. Sometimes, development tools for a personal computer can be used if the embedded processor is a close relative to a common PC processor. Embedded system designers also use a few software tools rarely used by typical computer programmers. Some designers keep a utility program to turn data files into code, so that they can include any kind of data in a program. Most designers also have utility programs to add a checksum or CRC to a program, so it can check its program data before executing it. 2
1.1.5 DEBUGGING:
Debugging is usually performed with an in-circuit emulator, or some type of debugger that can interrupt the micro controllers internal microcode. The microcode interrupt lets the debugger operate in hardware in which only the CPU works. The CPU-based debugger can be used to test and debug the electronics of the computer from the viewpoint of the CPU. Developers should insist on debugging which shows the high-level language, with breakpoints and single stepping, because these features are widely available. Also, developers should write and use simple logging facilities to debug sequences of real-time events. PC or mainframe programmers first encountering this sort of programming often become confused about design priorities and acceptable methods. Mentoring, code-reviews and ego less programming are recommended.
START-UP:
All embedded systems have start-up code. Usually it disables interrupts, sets up the electronics, tests the computer (RAM, CPU and software), and then starts the application code. Many embedded systems recover from short-term power failures by restarting (without recent self-tests). Restart times under a tenth of a second are common. Many designers have found one of more hardware plus software-controlled LEDs useful to indicate errors during development (and in some instances, after product release, to produce troubleshooting diagnostics). A common scheme is to have the electronics turn off the LED(s) at reset, whereupon the software turns it on at the first opportunity, to prove that the hardware and start-up software have performed their job so far. After that, the software blinks the LED(s) or sets up light patterns during normal operation, to indicate program execution progress and/or errors. This serves to reassure most technicians/engineers and some users.
1.2 MICROCONTROLLERS
Microcontrollers as the name suggests are small controllers. They are like single chip computers that are often embedded into other systems to function as processing/controlling unit. For example the remote control you are using probably has microcontrollers inside that do decoding and other controlling functions. They are also used in automobiles, washing machines, microwave ovens, toys ... etc, where automation is needed. Micro-controllers are useful to the extent that they communicate with other devices, such as sensors, motors, switches, keypads, displays, memory and even other micro5
controllers. Many interface methods have been developed over the years to solve the complex problem of balancing circuit design criteria such as features, cost, size, weight, power consumption, reliability, availability, manufacturability. Many microcontroller designs typically mix multiple interfacing methods. In a very simplistic form, a micro-controller system can be viewed as a system that reads from (monitors) inputs, performs processing and writes to (controls) outputs. Embedded system means the processor is embedded into the required application. An embedded product uses a microprocessor or microcontroller to do one task only. In an embedded system, there is only one application software that is typically burned into ROM. Example: printer, keyboard, video game player
Microprocessor - A single chip that contains the CPU or most of the computer Microcontroller - A single chip used to control other devices
Microcontroller differs from a microprocessor in many ways. First and the most important is its functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. In short that means that microprocessor is the very heart of the computer. On the other hand, microcontroller is designed to be all of that in one. No other external components are needed for its application because all necessary peripherals are already built into it. Thus, we save the time and space needed to construct devices.
Microcontroller: CPU, RAM, ROM, I/O and timer are all on a single chip 6
fix amount of on-chip ROM, RAM, I/O ports for applications in which cost, power and space are critical single-purpose
Fig: 1.3.1 SMART CARD Magnetic stripe technology remains in wide use in the United States. However, the data on the stripe can easily be read, written, deleted or changed with off-the-shelf equipment. Therefore, the stripe is really not the best place to store sensitive information. To protect the consumer, businesses in the U.S. have invested in extensive online mainframe-based computer networks for verification and processing. In Europe, such an infrastructure did not develop -- instead, the card carries the intelligence. The microprocessor on the smart card is there for security. The host computer and card reader actually "talk" to the microprocessor. The microprocessor enforces access to the data
on the card. If the host computer read and wrote the smart card's random access memory (RAM), it would be no different than a diskette. Smarts cards may have up to 8 kilobytes of RAM, 346 kilobytes of ROM, 256 kilobytes of programmable ROM, and a 16-bit microprocessor. The smart card uses a serial interface and receives its power from external sources like a card reader. The processor uses a limited instruction set for applications such as cryptography. The most common smart card applications are: Credit cards Electronic cash Computer security systems Wireless communication Loyalty systems (like frequent flyer points) Banking Satellite TV Government identification Smart cards can be used with a smart-card reader attachment to a personal computer to authenticate a user. Web browsers also can use smart card technology to supplement Secure Sockets Layer (SSL) for improved security of Internet transactions. Visa's Smart Card FAQ shows how online purchases work using a smart card and a PC equipped with a smart-card reader. Smart-card readers can also be found in mobile phones and vending machines. The different types of smart cards classified according to the applications are as follows: MEMORY-BASED SMART CARDS: The memory-based smart cards are used for applications in which the function of the card is fixed. These cards need a card reader to manipulate the data on the card. Memorybased smart cards communicate to the reader using some synchronous protocols. Memorybased smart cards have no processing power and cannot manage the data stored in them. These cards are widely used as prepaid phone cards. Memory based smart cards contain only non-volatile memory storage components, and perhaps some specific security logic. MICROPROCESSOR-BASED SMART CARDS: The microprocessor-based smart cards have greater memory storage as compared to those cards without microprocessor. The security of data on the microprocessor cards is greater than any other storage device because it has the microprocessor embedded in the plastic card along with the memory. The microprocessor-based smart cards available today have an eight 8
bit processor and 512 bytes random access memory (RAM) and 16 KB read-only memory. Some of the microprocessor-based smart cards use cryptography for securing a digital identity. The microprocessor-based smart cards have a card operating system (COS) that manages the data on the card. The card operating system makes it possible to make the smart cards multi-functional. Microprocessor cards contain volatile memory and microprocessor components. The card is made of plastic, generally PVC, but sometimes ABS. The card may embed a hologram to avoid counterfeiting. Using smart cards is also a form of strong security authentication for single sign-on within large companies and organizations. Smart cards are classified according to the way in which the data on them is read and written. Integrated Circuit Cards come in these forms: CONTACT SMART CARD: The contact smart cards are named so because they come in contact with the reader. These smart cards are the size of a credit card. A metallic chip is embedded inside the plastic card with a microprocessor and a memory or only with a memory. The contact smart cards are widely used in network security, access control, e-commerce, and electronic cash and as health cards. It is easy to identify because of its gold connector plate. Although the ISO Standard (7816-2) defined eight contacts, only 6 are actually used to communicate with the outside World. The Contact Card is the most commonly seen ICC to date largely because of its use in France and now other parts of Europe as a telephone prepayment card.. Most contact cards contain a simple integrated circuit although various experiments have taken place using two chips. The chip itself varies considerably between different manufacturers and for a whole gambit of applications. Let us consider first the purpose for the 6 contacts used by the ICC.
Vcc is the supply voltage that drives the chips and is generally 5 volts. It should be noted however that in the future we are likely to see a move towards 3 volts taking advantage of advanced semiconductor technology and allowing much lower current levels to be consumed by the integrated circuit. Vss is the substrate or ground reference voltage against which the Vcc potential is measured. Reset is the signal line that is used to initiate the state of the integrated circuit after power on. This is in itself an integral and complex process that we shall describe later in more detail. The clock signal is used drive the logic of the IC and is also used as the reference for the serial communications link. There are two commonly used clock speeds 3.57 MHZ and 4.92 MHZ. The lower speed is most commonly used to date in Europe but this may change in the future. One may be tempted to ask why these strange frequencies were chosen, why not just a straight 5 MHZ. The reason lies in the availability of cheap crystals to form the clock oscillator circuits. Both of these frequencies are used in the television world for the colour sub carrier frequency. The PAL system operates using 4.92 MHZ whilst the 3.57 MHZ is used by the American NTSC standard. The Vpp connector is used for the high voltage signal that is necessary to program the EPROM memory. Last, but by no means least is the serial input/output (SIO) connector. This is the signal line by which the chip receives commands and interchanges data with the outside world. CONTACT LESS SMART CARD: As the name suggests, the contact less cards do not directly come in contact with the card. These cards have an antenna built in the card. The antenna of the contact less cards is used to communicate to the card reader for reading and writing data on the card. The working of these cards is based on radio frequency identification technology. These cards are used as parking cards, student identification and electronics passports. The Contact less card may contain its own battery, particularly in the case of a "Super Smart Card" which has an integrated keyboard and LCD display. In general however the operating power is supplied to the contact less card electronics by an inductive loop using low frequency electronic magnetic radiation. The communications signal may be transmitted in a similar way or can use capacitive coupling or even an optical connection.
reader. The antenna of the card is used or the contact pads are used to manipulate data on the smart card.
at 5 volts as specified in the ISO standard. Whilst a 3 volt IC may be designed to operate between 3 volts and 5 volts, running a 5 volt IC at 3 volts is a non starter. A current consumption of 200mA is far too high for modern electronic equipment particularly when the equipment is portable and driven by a battery power supply. Most IC cards have a power consumption of between 10mA and 20mA (at 3.58MHz). ETSI in the development of their standards have adopted a far more rigorous specification of 20mA maximum for normal use and a 10mA maximum for use in portable equipment. They further defined the concept of sleep mode (not covered by ISO 7816-3) where the IC chip can reside in a latent mode preserving volatile memory contents with a maximum power consumption of 200uA.
CLOCK SIGNAL:
Although the integrated circuit could contain its own clock circuit for driving the internal logic, in practice most IC chips are supplied with an external clock by the interface device. It should be noted that the speed of the serial communications on the I/O line is effectively defined by the frequency of this clock. The ISO standard aligns with the use of two widely used external clock frequencies, 3.579545 MHz and 4.9152 MHz. The former frequency is the more widely used (being based on the NTSC colour sub carrier frequency) and results in a clock divider of 372 in order to produce a 9600 bit per second (not exact but within tolerance) serial communication speed. The latter frequency has a simple divisor of 512 in order to achieve a 9600 bit per second communication speed. The standard defines the situation after reset whilst allowing the frequency to be selectively changed by means of protocol type selection.
The reset signal is asserted by the interface device and is used to start up the program contained in the IC ROM. The ISO standard defines three reset modes, internal reset, active low reset and synchronous high active reset. Most microprocessor ICs operate using the active low reset mode were the IC transfers control to the entry address for the program when the reset signal returns to the high voltage level. The synchronous mode of operation is more commonly met with the memory card ICs as used for telephone applications. The sequence of operations for activating and deactivating the IC is defined in order to minimize the likelihood of damage to the IC. In particular the inadvertent corruption of the non-volatile memory (EPROM or EEPROM) must be avoided. The activation sequence for the interface device is defined as follows, Take RST low Apply VCC Put I/O in receive mode Put VPP in idle mode Apply clock Take RST high (active low reset) The IC deactivation sequence for the interface device is as follows, Take RST low Take clock low Deactivate VPP Put I/O in the low state Deactivate VCC
computers, televisions, instrument panels, and other devices ranging from aircraft cockpit displays, to every-day consumer devices such as video players, gaming devices, clocks, watches, calculators, and telephones. Among its major features are its lightweight construction, its portability, and its ability to be produced in much larger screen sizes than are practical for the construction of cathode ray tube (CRT) display technology. Its low electrical power consumption enables it to be used in battery-powered electronic equipment. It is an electronically-modulated optical device made up of any number of pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in color or monochrome. The earliest discovery leading to the development of LCD technology, the discovery of liquid crystals, dates from 1888. By 2008, worldwide sales of televisions with LCD screens had surpassed the sale of CRT units.
PIN DESCRIPTION:
PIN DESCRIPTION:
PIN 1 2 3 4 SYMBOL VSS VCC VEE RS I/O ---I DESCRIPTION Ground +5V power supply Power supply to control contrast RS=0 to select command register RS=1 to select data register 5 R/W I R/W=0 for write R/W=1 for read
14
6 7 8 9 10 11 12 13 14
Enable The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus
RS (REGISTER SELECT):
There are two important registers inside the LCD. When RS is low (0), the data is to be treated as a command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data that is sent is a text data which should be displayed on the screen. For example, to display the letter "T" on the screen you would set RS high.
RW (READ/WRITE):
The RW line is the "Read/Write" control line. When RW is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are write commands, so RW will almost be low.
EN (ENABLE):
The EN line is called "Enable". This control line is used to tell the LCD that you are sending it data. To send data to the LCD, your program should first set this line high (1) and then set the other two control lines and/or put data on the data bus. When the other lines are completely ready, bring EN low (0) again. The 1-0 transition tells the 44780 to take the data currently found on the other control lines and on the data bus and to treat it as a command.
15
The 8-bit data pins, D0-D7 are used to send information to the LCD or read the content of the LCDs internal registers. To display letters and numbers, we send ASCII codes for the letters A-Z, a-z and numbers 0-9 to these pins while making RS=1. There are also instruction command codes that can be sent to the LCD to clear the display or force the cursor to the home position or blink the cursor. We also use RS=0 to check the busy flag bit to see if the LCD is ready to receive the information. The busy flag is D7 and can be read when R/W = 1 and RS=0, as follows: if R/W = 1, RS = 0. When D7=1 (busy flag = 1), the LCD is busy taking care of internal operations and will not accept any new information. When D7 = 0, the LCD is ready to receive new information. Note: it is recommended to check the flag before writing any data to LCD. LCD COMMAND CODES: CODE (HEX) 1 2 4 6 5 7 8 A C E F 10 14 18 1C 80 C0 38 COMMAND TO LCD INSTRUCTION REGISTER CLEAR DISPLAY SCREEN RETURN HOME DECREMENT CURSOR(SHIFT CURSOR TO LEFT) INCREMENT CURSOR(SHIFT CURSOR TO RIGHT) SHIFT DISPLAY RIGHT SHIFT DISPLAY LEFT DISPLAY OFF,CURSOR OFF DISPLAY OFF,CURSOR ON DISPLAY ON,CURSOR OFF DISPLAY ON CURSOR BLINKING DISPLAY ON CURSOR BLINKING SHIFT CURSOR POSITION TO LEFT SHIFT CURSOR POSITION TO RIGHT SHIFT THE ENTIRE DISPLAY TO THE LEFT SHIFT THE ENTIRE DISPLAY TO THE RIGHT FORCE CURSOR TO BEGINNING OF 1ST LINE FORCE CURSOR TO BEGINNING OF 2ND LINE 2 LINES AND 5x7 MATRIX
16
ADVANTAGES: LCD interfacing with 8051 is a real-world application. In recent years the LCD is finding widespread use replacing LEDs (seven segment LEDs or other multi segment LEDs). This is due to following reasons: The declining prices of LCDs. The ability to display numbers, characters and graphics. This is in contrast to LEDs, which are limited to numbers and a few characters. An intelligent LCD displays two lines, 20 characters per line, which is interfaced to the 8051. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU to keep displaying the data. Ease of programming for characters and graphics. 1.5 LIGHT EMITTING DIODE A light-emitting diode (LED) is a semiconductor diode that emits incoherent narrow spectrum light when electrically biased in the forward direction of the pn-junction, as in the common LED circuit. This effect is a form of electroluminescence.
17
Like a normal diode, the LED consists of a chip of semi-conducting material impregnated, or doped, with impurities to create a p-n junction. As in other diodes, current flows easily from the p-side, or anode, to the n-side, or cathode, but not in the reverse direction. Charge-carrierselectrons and holesflow into the junction from electrodes with different voltages. When an electron meets a hole, it falls into a lower energy level, and releases energy in the form of a photon.
Fig: 1.5.2 P-N JUCTION The wavelength of the light emitted, and therefore its color, depends on the band gap energy of the materials forming the p-n junction. In silicon or germanium diodes, the electrons and holes recombine by a non-radiative transition which produces no optical emission, because these are indirect band gap materials. The materials used for the LED have a direct band gap with energies corresponding to near-infrared, visible or near-ultraviolet light. LED development began with infrared and red devices made with gallium arsenide. Advances in materials science have made possible the production of devices with evershorter wavelengths, producing light in a variety of colors. LEDs are usually built on an n-type substrate, with an electrode attached to the p-type layer deposited on its surface. P-type substrates, while less common, occur as well. Many commercial LEDs, especially GaN/InGaN, also use sapphire substrate. Most materials used for LED production have very high refractive indices. This means that much light will be reflected back in to the material at the material/air surface interface. Therefore Light extraction in LEDs is an important aspect of LED production, subject to much research and development. Solid state devices such as LEDs are subject to very limited wear and tear if operated at low currents and at low temperatures. Many of the LEDs produced in the 1970s and 1980s 18
are still in service today. Typical lifetimes quoted are 25,000 to 100,000 hours but heat and current settings can extend or shorten this time significantly. Conventional LEDs are made from a variety of inorganic semiconductor materials; the following table shows the available colors with wavelength range and voltage drop. Color Infrared Red Orange Yellow Green Blue Violet Purple Ultraviolet White Wavelength (nm) > 760 610 < < 760 590 < < 610 570 < < 590 500 < < 570 450 < < 500 400 < < 450 multiple types < 400 Broad spectrum Voltage (V) V < 1.9 1.63 < V < 2.03 2.03 < V < 2.10 2.10 < V < 2.18 1.9 < V < 4.0 2.48 < V < 3.7 2.76 < V < 4.0 2.48 < V < 3.7 3.1 < V < 4.4 V = 3.5
ADVANTAGES OF LEDS: LEDs have many advantages over other technologies like lasers. As compared to laser diodes or IR sources LEDs are conventional incandescent lamps. For one thing, they don't have a filament that will burn out, so they last much longer. Additionally, their small plastic bulb makes them a lot more durable. They also fit more easily into modern electronic circuits. The main advantage is efficiency. In conventional incandescent bulbs, the light-production process involves generating a lot of heat (the filament must be warmed). Unless you're using the lamp as a heater, because a huge portion of the available electricity isn't going toward producing visible light. LEDs generate very little heat. A much higher percentage of the electrical power is going directly for generating light, which cuts down the electricity demands considerably. LEDs offer advantages such as low cost and long service life. Moreover LEDs have very low power consumption and are easy to maintain. DISADVANTAGES OF LEDS: LEDs performance largely depends on the ambient temperature of the operating environment. 19
LEDs must be supplied with the correct current. LEDs do not approximate a "point source" of light, so cannot be used in applications needing a highly collimated beam. But the disadvantages are quite negligible as the negative properties of LEDs do not apply and the advantages far exceed the limitations.
1.6 Keil IDE Softwares used are: Keil vision software for c programmingVision3 adds many new features to the Editor like Text Templates, Quick Function Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based startup and debugger setup. Vision3 is fully compatible to Vision2 and can be used in parallel with Vision2. What is Vision3? Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and debug embedded programs. It encapsulates the following components: A project manager. A make facility. Tool configuration. Editor. A powerful debugger. To help you get started, several example programs (located in the \C51\Examples, \C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided. HELLO is a simple program that prints the string "Hello World" using the Serial Interface. MEASURE is a data acquisition system for analog and digital systems. TRAFFIC is a traffic light controller with the RTX Tiny operating system. SIEVE is the SIEVE Benchmark. DHRY is the Dhrystone Benchmark. WHETS is the Single-Precision Whetstone Benchmark. Additional example programs not listed here are provided for each device architecture. BUILDING AN APPLICATION IN vision To build (compile, assemble, and link) an application in Vision2, you must: Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2). Select Project - Rebuild all target files or Build target. 20
Vision2 compiles, assembles, and links the files in your project. Creating Your Own Application in Vision2 To create a new project in Vision2, you must: Select Project - New Project. Select a directory and enter the name of the project file. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device Database. Create source files to add to the project. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files to the project. Select Project - Options and set the tool options. Note when you select the target device from the Device Database all special options are set automatically. You typically only need to configure the memory map of your target hardware. Default memory model settings are optimal for most applications. Select Project - Rebuild all target files or Build target. Debugging an Application in Vision2 To debug an application created using Vision2, you must: Select Debug - Start/Stop Debug Session. Use the Step toolbar buttons to single-step through your program. You may enter G, main in the Output Window to execute to the main C function. Open the Serial Window using the Serial #1 button on the toolbar. Debug your program using standard options like Step, Go, Break, and so on. Starting Vision2 and creating a Project Vision2 is a standard Windows application and started by clicking on the program icon. To create a new project file select from the Vision2 Menu-Project New Project. This opens a standard Windows dialog that asks you for the new project file name. It is suggested that use a separate folder for each project. You can simply use the icon Create New Folder in this dialog to get a new empty folder. Then select this folder and enter the file name for the new project, i.e. Project1. Vision2 creates a new project file with the name PROJECT1.UV2 which contains a default target and file group name. You can see these names in the Project Window Files.
21
Now use from the menu Project Select Device for Target and select a CPU for your project. The Select Device dialog box shows the Vision2 device database. Just select the microcontroller you use. We are using for our examples the Philips 80C51RD+ CPU. This selection sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool Configuration- Building Projects and Creating a HEX Files. Typical, the tool settings under Options Target are all you need to start a new application. You may translate all source files and line the application with a click on the Build Target toolbar icon. When you build an application with syntax errors, Vision2 will display errors and warning messages in the Output Window Build page. A double click on a message line opens the source file on the correct location in a Vision2 editor window. Once you have successfully generated your application you can start debugging.
Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write, or code execution access. The Vision2 simulator traps and reports illegal memory accesses. In addition to memory mapping, the simulator also provides support for the integrated peripherals of the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are configured from the Device Database selection Information about selecting a device. You may select and display the on-chip peripheral components using the Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes.
Start Debugging:
You start the debug mode of Vision2 with the Debug Start/Stop Debug Session command. Depending on the Options for Target Debug Configuration, Vision2 will load the application program and run the startup code Vision2 saves the editor screen layout and restores the screen layout of the last debug session. If the program execution stops, Vision2 opens an editor window with the source text or shows CPU instructions in the disassembly window. The next executable statement is marked with a yellow arrow. During debugging, most editor features are still available. For example, you can use the find command or correct program errors. Program source text of your application is shown in the same windows. The Vision2 debug mode differs from the edit mode in the following aspects:
22
The Debug Menu and Debug Commands described below are available. The additional debug windows are discussed in the following. The project structure or tool parameters cannot be modified. All build Commands are disabled.
Disassembly Window:
The Disassembly window shows your target program as mixed source and assembly program or just assembly code. A trace history of previously executed instructions may be displayed with Debug View Trace Records. To enable the trace history, set Debug
SOURCE CODE:
Click on the Keil uVision Icon on Desktop The following fig will appear
Click on the Project menu from the title bar Then Click on New Project
23
Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\
Then Click on Save button above. Select the component for u r project. i.e. Atmel Click on the + Symbol beside of Atmel
Then Click either YES or NOmostly NO Now your project is ready to USE Now double click on the Target1, you would get another option Source group 1 as shown in next page.
25
Click on the file option from menu bar and select new
The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder.
26
Now start writing program in either in C or ASM For a program written in Assembly, then save it with extension . asm and for C based program save it with extension .C
Now right click on Source group 1 and click on Add files to Group Source
Now you will get another window, on which by default C files will appear.
27
Now select as per your file extension given while saving the file Click only one time on option ADD Now Press function key F7 to compile. Any error will appear if so happen.
If the file contains no error, then press Control+F5 simultaneously. The new window is as follows
Then Click OK Now Click on the Peripherals from menu bar, and check your required port as shown in fig below
28
29
The 8051 is an 8-bit microcontroller originally developed by Intel in the late 1970s. It includes an instruction set of 255 operation codes (opcodes), 32 input/output lines, three usercontrollable timers, an integrated and automatic serial port, and 256 bytes of on-chip RAM. The 8051 is similar but has only two timers and 128 bytes of on-chip RAM. The 8051 was designed such that control of the MCU and input/output between the MCU and external devices is accomplished primarily using Special Function Registers . Each SFR has an address between 128 and 255. Additional functions can be added to new 30
derivative MCUs by adding additional SFRs while remaining compatible with the original 8051. This allows the developer to use the same software development tools with any device that is 8051-compatible. Over time, other semiconductor firms adopted the "8051 core" for their microcontrollers, using the same instruction set and underlying SFRs. This allowed the 8051 architecture to become an industry-wide standard. Now, more than 20 years later, dozens of semiconductor companies produce hundreds of microcontrollers that are based on the original 8051 core. The additional features that each semiconductor- firm offers in their MCUs are accessed by utilizing new SFRs in addition to the standard 8051 SFRs that are found in all 8051compatible MCUs. Pin diagram description of 8051 microcontroller
Pi n
8051 Function
P1.0 T2
I/O
external input 2 P1.1 T2(EX) I/O Port 1, bit 1; Timer external reload/captur e 3 P1.2 I/O Port 1, bit 2 PWM Pulse2
31
widthmodulated output 4 P1.3 I/O Port 1, bit 3 ALE Address latch disable 5 P1.4 I/O Port 1, bit 4 PGM Program pulse 6 P1.5 I/O Port 1, bit 5 PGM EN PLS DIS
Programmin g voltage
enable 7 P1.6 I/O Port 1, bit 6 DMA ACK DMA acknowledge 8 P1.7 I/O Port 1, bit 7 LPT Line
printer out 9 10 Reset P3.0 RXD 11 P 3.1 TXD I/O Input I/O Reset system Port 3, bit 0 Serial receive Port 3, bit 1 Serial transmit 12 P3.2 INT0 I/O Port 3, bit 2 External interrupt 0 SER IN
Serial port in SER Serial out DMA REQ DMA request OUT port
13
P3.3 INT1
I/O
14
P3.4 T0 32
I/O
external input 16 P3.6 WR I/O Port 3, bit 6 Write strobe for external memory 17 P3.7 RD I/O Port 3, bit 7 Read strobe
for external memory 18 XTAL 1 Input Inverting oscillator amplifier (crystal) 19 XTAL 2 Outpu t Inverting oscillator amplifier (crystal) 20 VSS Input Circuit ground 21 P2.0 A8 22 P2.1 A9 23 P2.2 A10 I/O I/O I/O Port 2, bit 0 Address bit 8 Port 2, bit 1 Address bit 9 Port 2, bit 2 Address 10 24 P2.3 A11 I/O Port 2, bit 3 Address 11 25 P2.4 A12 33 I/O Port 2, bit 4 Address bit bit bit
12 26 P2.5 A13 I/O Port 2, bit 5 Address 13 27 P2.6 A14 I/O Port 2, bit 5 Address 14 28 P2.7 A15 I/O Port 2, bit 6 Address 15 29 PSEN Outpu t Program store enable Read strobe bit bit bit
for external program memory 30 ALE Outpu t 31 EA Input Address latch enable External access enable for program memory 32 P0.7 AD7 I/O Port 0, bit 7 Address/data bit 7 33 P0.6 AD6 I/O Port 0, bit 6 Address/data bit 6 34 P0.5 AD5 I/O Port 0, bit 5 Address/data bit 5 35 P0.4 34 I/O Port 0, bit 4
AD4
Address/data bit 4
36
P0.3 AD3
I/O
37
P0.2 AD2
I/O
38
P0.1 AD1
I/O
39
P0.0 AD0
I/O
40
VCC
Input
Supply voltage
Table 2.2
CPU:
The CPU, or central processing unit, executes program instructions. Types of instructions include arithmetic (addition, subtraction), logic (AND, OR, NOT), data transfer
35
(move), and program branching (jump) operations. An external crystal provides a timing reference for clocking the CPU.
ROM:
ROM (read-only memory) is the read-only memory that is programmed into the chip in the manufacturing process. In the 8051-BASIC, the ROM contains the BASIC-52 interpreter program that the 8051 executes on boot-up. As far as the hardware is concerned, this is the only difference between the ordinary 8051 and the 8051-BASIC.
RAM:
RAM (random-access memory) is where programs store information for temporary use. Unlike ROM, the CPU can write to RAM as well as read it. Any information stored in RAM is lost when power is removed from the chip. The 8051 has 256 bytes of RAM. BASIC-52 uses much of this for its own operations, with a few bytes available to users.
I/O Ports:
I/O (Input/output) Ports enable the 8051 to read and write to external memory and other components. The 8051 has four 8-bit I/O ports (Ports 0-3). As the name suggests, the ports can act as inputs (to be read) or outputs (to be written to). Many of the port bits have optional, alternate functions relating to accessing external memory, using the on-chip timer/counters, detecting external interrupts, and handling serial communications. BASIC-52 assigns alternate functions to the remaining port bits. Some of these functions are required by BASIC-52, while others are optional. If you dont use an alternate function, you can use the bit for any control, monitoring, or other purpose in your application
addresses and data on the same signal lines is called a multiplexed address/data bus. Its a popular arrangement that many devices use, since it requires fewer pins on the chip, compared to giving each data and address line its own pin. Port is eight lines hold the higher byte of the address to be read or written to. These lines make up the high address bus (A8-A15). Together, the 16 address lines can access 64 kilobytes (65,536 bytes) of memory, from 00000000 00000000 to 11111111 11111111 in binary, or 0000h to FFFFh in hexadecimal. Besides pins to hold the data and addresses, the 8051 must also provide control signals to initiate the read and write operations. Control signals include WR (write), RD (read), PSEN (program store enable), and ALE (address latch enable). Some of the address lines may also function as control signals that help to select a chip during a memory access.
writes to external memory, it places the lower address byte on AD0-AD7 and strobes ALE, which causes the external latch to save the lower address byte for the rest of the read or write cycle. After a short delay, the 8051 replaces the address on AD0-AD7 with the data to be written or read.
External interrupts:
38
INT0 and INT1 are external interrupt inputs, which detect logic levels or transitions that interrupt the CPU and cause it to branch to a predefined program location. BASIC-52 uses INT0 for its optional direct-memory-access (DMA) function.
Programming functions.
BASIC-52s programming commands use three additional port bits (ALEDIS, PGM PULSE, and PGM EN) to control programming voltages and timing for storing BASIC-52 programs in EPROM or other non volatile memory
39
When the smart card and the card reader come into contact, each identifies itself to the other by sending and receiving information. If the messages exchanged do not match, no further processing takes place. So, unlike ordinary bank cards, smart cards can defend themselves against unauthorized users and uses in innovative security measures.
COMMUNICATING WITH A SMART CARD READER: The reader provides a path for your application to send and receive commands from the card. There are many types of readers available, such as serial, PC Card, and standard keyboard models. Unfortunately, the ISO group was unable to provide a standard for communicating with the readers so there is no one-size-fits-all approach to smart card communication. Each manufacturer provides a different protocol for communication with the reader.
First you have to communicate with the reader. Second, the reader communicates with the card, acting as the intermediary before sending the
the data and return it to the reader, which will then return the data to its originating source. The following classes are used for communicating with the reader:
ISO command classes for communicating with 7816 protocol Classes for communicating with the reader Classes for converting data to a manufacturer-specific format An application for testing and using the cards for an intended and specific purpose
Readers come in many forms, factors and capabilities. The easiest way to describe a reader is by the method of its interface to a PC. Smart card readers are available that interface to RS232 serial ports, USB ports, PCMCIA slots, floppy disk slots, parallel ports, infrared IRDA ports and keyboards and keyboard wedge readers. Card readers are used to read data from - and write data to - the smart card. Readers can easily be integrated into a PC utilizing Windows 98/Me, 2000, or XP platforms. However, some computer systems already come equipped with a built-in smart card reader. Some card readers come with advanced security features such as secure PIN entry, secure display and an integrated fingerprint scanners for the next-generation of multi-layer security and three-factor authentication. Another difference in reader types is on-board intelligence and capabilities. An extensive price and performance difference exists between an industrial strength reader that
40
supports a wide variety of card protocols and the less expensive win-card reader that only works with microprocessor cards and performs all processing of the data in the PC. The options in terminal choices are just as varied. Most units have their own operating systems and development tools. They typically support other functions such as magneticstripe reading, modem functions and transaction printing. To process a smart card the computer has to be equipped with a smart card reader possessing the following mandatory features:
Smart Card Interface Standard - ISO 7816 is an international standard that describes the
interface requirements for contact-type smart cards. These standards have multiple parts. For instance, part 1, 2 and 3 are applicable to card readers. Part 1 defines the physical characteristics of the card. Part 2 defines dimension and location of smart card chip contacts. Part 3 defines the electronic signals and transmission protocols of the card. Card readers may be referred to as conforming to ISO 7816 1/2/3, or in its simplified term, ISO 7816.
Driver - This refers to the software used by the operating system (OS) of a PC for managing a
smart card and applicable card reader. To read a smart ID card, the driver of the card reader must be PC/SC compliant which is supported by most card reader products currently available. It should be noted that different OS would require different drivers. In acquiring card readers, the compatibility between the driver and the OS has to be determined and ensured.
41
support the appropriate protocol such as the asynchronous T=0, T=1 or synchronous I2C protocols. It won't take long before smart card readers become an integral part of every computer - and, subsequently, the lives of computer users. Computer systems with keyboards that have smart card reader/writer integration are also available. Smart card readers are also accessible in the form of USB dongle. USB dongles are frequently used with GSM phones, which contain a SIM smart card. Additionally, phone numbers can be edited on a PC using the USB smart card dongle.
1.
#0206!
2.
#01!
3. 4.
#03! #10AAAANN!
#82! (No Device Type set ) #8D! (Memory Over Flow) 5. Write Data #11AAAANNFFFF DD..D! #82! (No Device Type set ) #83! (Positive Ack) #89! (Invalid Security Code) #86! (Invalid Command) #85! (Invalid Parameters #8D! (Memory Over Flow) #90!(Already Protected) 6. Protect Data #12AAAANNFFFF DD! #83! (Positive Ack) #82! (No Device Type) #89! (Invalid Security Code) #86! (Invalid Command) #85! (Invalid Parameters #8D! (Memory Over Flow) 7. Communication Protocol: Baud Rate : 9,600 bps
Parity
: None
Stop Bit
:1
Start Bit
:0
Data Note:
:8 bits will
Please give correct security code while writing your cards other wise they
damage. This card will allow 8 times of writing false security code later it wont accept to write the card but you can read. AAAA NN FFFF DD = = = = Address location of the chip in Hex Number of bytes to read or to write Security Code Data to read / write or protect in BCD format
43
PIN CONFIGURATION
DESCRIPTION
The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to supply TIA/EIA-232-F voltage levels from a 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.
44
MAX232:
The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals. The drivers provide RS-232 voltage level outputs (approx. 7.5 V) from a single + 5 V supply via on-chip charge pumps and external capacitors. This makes it useful for implementing RS-232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range, as power supply design does not need to be made more complicated just for driving the RS-232 in this case. The receivers reduce RS-232 inputs (which may be as high as 25 V), to standard 5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of 0.5 V. The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors 0.1 F in place of the 1.0 F capacitors used with the original device. RS232: In telecommunications, RS-232 (Recommended Standard 232) is a standard for serial binary data signals connecting between a DTE (Data Terminal Equipment) and a DCE (Data Circuitterminating Equipment). It is commonly used in computer serial ports. A charge pump is a kind of DC to DC converter that uses capacitors as energy storage elements to create either a higher or lower voltage power source. Charge pump circuits are capable of high efficiencies, sometimes as high as 90-95% while being electrically simple circuits. Charge pumps use some form of switching device(s) to control the connection of voltages to the capacitor. For instance, to generate a higher voltage, the first stage involves
45
the capacitor being connected across a voltage and charged up. In the second stage, the capacitor is disconnected from the original charging voltage and reconnected with its negative terminal to the original positive charging voltage. Because the capacitor retains the voltage across it (ignoring leakage effects) the positive terminal voltage is added to the original, effectively doubling the voltage. The pulsing nature of the higher voltage output is typically smoothed by the use of an output capacitor. This is the charge pumping action, which typically operates at tens of kilohertz up to several megahertz to minimize the amount of capacitance required. The capacitor used as the charge pump is typically known as the "flying capacitor". Another way to explain the operation of a charge pump is to consider it as the combination of a DC to AC converter (the switches) followed by a voltage multiplier. The voltage is load-dependent; higher loads result in lower average voltages. Charge pumps can double voltages, triple voltages, halve voltages, invert voltages, fractionally multiply or scale voltages such as x3/2, x4/3, x2/3, etc. and generate arbitrary voltages, depending on the controller and circuit topology. The term 'charge pump' is also used in phase-locked loop (PLL) circuits. This is a completely different application. In a PLL the phase difference between the reference signal (often from a crystal oscillator) and the output signal is translated into two signals - UP and DN. The two signals control switches to steer current into or out of a capacitor, causing the voltage across the capacitor to increase or decrease. In each cycle, the time during which the switch is turned on is proportional to the phase difference, hence the charge delivered is dependent on the phase difference also. The capacitor acts to smooth out abrupt changes on the voltage and to ensure the PLL's closed-loop stability. The voltage on the capacitor is used to tune a voltage-controlled oscillator (VCO), generating the desired output signal frequency. The charge pump in a PLL design is constructed in integrated-circuit (IC) technology, consisting of pull-up, pull-down transistors and on-chip capacitors and resistors. 2.4 TRANSISTOR AS A SWITCH The transistor is the fundamental building block of modern electronic devices, and its presence is ubiquitous in modern electronic systems. Because a transistor's collector current is proportionally limited by its base current, it can be used as a sort of current-controlled switch. A relatively small flow of electrons sent through the base of the transistor has the ability to exert control over a much larger flow of electrons through the collector.
46
When used as an AC signal amplifier, the transistors Base biasing voltage is applied so that it operates within its "Active" region and the linear part of the output characteristics curves are used. However, both the NPN & PNP type bipolar transistors can be made to operate as an "ON/OFF" type solid state switch for controlling high power devices such as motors, solenoids or lamps. If the circuit uses the Transistor as a Switch, then the biasing is arranged to operate in the output characteristics curves seen previously in the areas known as the "Saturation" and "Cut-off" regions as shown below. TRANSISTOR CURVES:
The shaded area at the bottom represents the "Cut-off" region. Here the operating conditions of the transistor are zero input base current (Ib), zero output collector current (Ic) and maximum collector voltage (Vce) which results in a large depletion layer and no current flows through the device. The transistor is switched "Fully-OFF". The lighter blue area to the left represents the "Saturation" region. Here the transistor will be biased so that the maximum amount of base current is applied, resulting in maximum collector current flow and minimum collector emitter voltage which results in the depletion layer being as small as possible and maximum current flows through the device. The transistor is switched "Fully-ON". Then we can summarize this as: Cut-off Region: Both junctions are Reverse-biased, Base current is zero or very small resulting in zero Collector current flowing, the device is switched fully "OFF". Saturation Region: Both junctions are Forward-biased, Base current is high enough to give a Collector-Emitter voltage of 0v resulting in maximum Collector current flowing, the device is switched fully "ON".
47
An NPN Transistor as a switch being used to operate a relay is given above. With inductive loads such as relays or solenoids a flywheel diode is placed across the load to dissipate the back EMF generated by the inductive load when the transistor switches "OFF" and so protect the transistor from damage. If the load is of a very high current or voltage nature, such as motors, heaters etc, then the load current can be controlled via a suitable relay as shown. The circuit resembles that of the Common Emitter circuit we looked at in the previous tutorials. The difference this time is that to operate the transistor as a switch the transistor needs to be turned either fully "OFF" (Cut-off) or fully "ON" (Saturated). An ideal transistor switch would have an infinite resistance when turned "OFF" resulting in zero current flow and zero resistance when turned "ON", resulting in maximum current flow. In practice when turned "OFF", small leakage currents flow through the transistor and when fully "ON" the device has a low resistance value causing a small saturation voltage (Vce) across it. In both the Cut-off and Saturation regions the power dissipated by the transistor is at its minimum. Transistor switches are used for a wide variety of applications such as interfacing large current or high voltage devices like motors, relays or lamps to low voltage digital logic IC's or gates like AND Gates or OR Gates.
48
CHAPTER - 3 BIOMETRICS 3.1 Introduction : In the realm of computer security, biometrics refers to authentication techniques that rely on measurable physiological and individual characteristics that can be automatically verified. In other words, we all have unique personal attributes that can be used for distinctive identification purposes, including a fingerprint, the pattern of a retina, and voice characteristics.
Biometrics refers to the automatic identification of a person based on his or her physiological or behavioral characteristics. This identification method is preferred over traditional methods involving passwords and PINs (personal identification numbers) for several reasons, including the person to be identified is required to be physically present at the point of identification and/or identification based on biometric techniques obviates the need to remember a password or carry a token. With the increased use of computers as vehicles of information technology, restricting access to sensitive/personal data is necessary. By replacing PINs, biometric techniques can potentially prevent unauthorized access to or fraudulent use of the following: ATMs Cellular phones Smart cards Desktop PCs Workstations Computer networks Various types of biometric systems are being used for real-time identification. The most popular are based on face recognition and fingerprint matching; however, other biometric systems use iris and retinal scans, speech, facial feature comparisons and facial thermograms, and hand geometry.
sixteen century, but the fundamentals of modern fingerprint identification methods were provided at the end of nineteenth century. The studies of Sir F. Galton and E. Henry led to formally accept fingerprints as valid signs of identity by law enforcement agencies.
Fingerprints can be acquired as color prints or via sensors which store the ridges on a medium (glass, paper, sensor surface, etc.). During the classification process, fingerprint images are optionally allocated to a certain category based on the global orientation of the ridges while the location of the minutiae is marked as well. The comparison determines whether two fingerprint images are identical, i.e. whether they belong to the same person (finger). The complete process of a fingerprint image analysis (comparison of patterns) can be divided into six steps as shown in the figure.
50
1. Scanning of a fingerprint image. The quality of the scanned image is the decisive factor for automatic identification purposes. It is desirable to use a high-definition fingerprint scanner which is able to tolerate different skin types, damages, dryness, as well as the humidity of the finger surface. 2. Image quality improvement. By using image quality improvement, an optical improvement of the structures (ridges) on the scanned image can be achieved. 3. Image processing. It means the preparatory phase for feature extraction and classification purposes. 4. Feature classification. The fact is that all fingerprints show certain global similarities, which allow for rough classification into three principal finger classes. However, classification is a rather difficult process both for algorithm-based decisions as well as for man-made decisions since some fingerprints cannot be clearly allocated to a concrete finger class. Nowadays, pattern classification is only used in dactyloscopic systems, e.g. AFIS (Automated Fingerprint Identification System) of the Federal Office of Criminal Investigation (BKA). This method is not feasible for access systems. 5. Feature extraction. In this phase, the location of the minutiae (ridge bifurcations and ridge endings) in the fingerprint is detected and extracted. In practice, scanned fingerprint images show differing qualities. The algorithm performance is negatively influenced by a poor image quality. 6. Verification phase. In the verification phase two feature vectors are being compared. The algorithm performance strongly depends on the quality (significance) of the extracted minutiae and on the comparison process. Below, we will describe in more detail the fingerprint scanning, feature classification and fingerprint comparison processes.
In case of a color print, rolling the finger on a surface generates the image of the ridges, e.g. on paper after that the finger is moistened with ink. An example of such rolled fingerprint images can be seen in the figure. By evenly rolling the finger from one side of the nail to the 51
other, all line-related data is reliably recorded in the image. Afterwards, these images can be scanned or electronically photographed. In dactyloscopy, this method has already been used for well over 100 years. Thus, since a complete "overall imaging" of the finger is done, in addition to a higher number of ridges and minutiae, "macro features" (i.e. delta and nucleus) are recorded as well. Even though they are part of each and every ridge pattern (with the exception of the "arch" pattern which does not have a delta), they are not always printed.
A disadvantage of this method is a possible distortion, which may occur through pressing and rolling the finger while taking the fingerprint. Furthermore, a quality feedback is not possible which may lead to a decrease in the quality of the fingerprints. From the users point of view, this is an unpleasant and slow method. It is also unsuitable for partially automated access controls.
The term life image of a finger is a comprehensive term for images that are obtained directly by placing the finger on a suitable sensor. There are a vast number of various methods, which can be used for scanning ridges. They include: Optical sensors. Electrical field sensors, Polymer TFT sensors (TFT Thin Film Transistor). Thermal sensors. Capacitive sensors. Contactless 3D-sensors and Ultrasound sensors.
A biometric sensor is the hardware component of a biometric system, which initially supplies biometric measurements. Depending on the biometric method in use, there are different kinds 52
of sensors. Optical sensors use light for obtaining fingerprint images. Electrical field sensors measure local variations of the electrical field, which is generated on the finger surface relief upon the emission of a small electrical signal. Polymer TFT sensors measure the light, which is emitted upon contact when the finger is laid on the polymer substrate. Thermal sensors register the thermal finger image. In capacitive sensors, the sensor and the finger surfaces together form a capacitor. The capacity thereof changes based on the skin relief (skin ridges and grooves). These local changes are measured and thus represent the fingerprint. The above-mentioned sensors are used in connection with the data-processing module as on-line systems. They substitute the off-line method in which fingerprints are, for example, taken on paper before they are digitized later on. Image quality strongly depends on the "contrasts" that were achieved between the ridges and the adjacent grooves. Since there is a feedback to image-processing algorithms for on-line methods, it is relatively easy to immediately check the quality of fingerprint images that were just obtained.
The life image is usually recorded by lightly placing the finger on the surface of the sensor. Since it is not so user-friendly, the finger's surface is only rolled in the context of AFISsystems (as in the dactyloscopic method). Of course, in this case, only such ridges can be captured that are recorded as a result of being directly in contact with the sensor surface. Hence, compared to rolled fingerprint images, the life image generates the image of a smaller section of the finger's surface but, in addition, it might also have smaller distortions of the image.
Currently, the most frequently used life image technology is the optical method. Upon placing the finger on the sensor's glass pane (prism), the elevations of the papillary lines are in contact with the glass; the grooves, on the other hand, are not in contact with it. Basically, the recording device consists of a light source (LED) and a CCD camera, both of which are located within the device on the other side of the glass pane. The light of the LED illuminates 53
the glass at a certain angle and the photo-element receives the reflected light. The course of the beam runs in such a way that the incoming light on the contact ridges is scattered as if on a mirror surface and then reflected back on the CCD camera. There where the grooves are behind the glass pane, the light passes through; these spots remain dark. An example for such a fingerprint image can be seen in the figure shown below.
3.1.4 Pattern Classification : The global pattern of papillary lines occurring in the central area of the tip of the finger constitutes a specific configuration, which is sufficient for a rough systematic classification. For fingerprint classification purposes, only a part of the entire image, called Pattern Area, is used. The Pattern Area is defined as the inner area, which is limited by two lines, so-called Type Lines.
54
Two singular points are part of this central area of the fingerprint image: (a) The delta (several of which may exist; only sample arches do not have deltas) (b) The nucleus. Delta, which is sometimes also called "outer border, is usually located at the fringe of the fingerprint image. An image of papillary lines is called a delta if it is similar to the Greek capital letter delta. It is formed by two parting ridges or by a ridge bifurcation and a third ridge that is convex and coming from another direction. Some examples of a delta configuration are shown in the figure below.
It is rather hard to define the nucleus of an individual fingerprint due to vast variations in the curving of the inner lines. Therefore, a specific point is simply chosen as the nucleus as though it was the center of the corresponding pattern. The following figure shows some examples of a nucleus configuration.
Another important quantitative factor in classifying images is the number of lines. This means the number of lines that touch or cross the imaginary connection between the nucleus and the 55
delta. Due to the great complexity of various line configurations, it is often difficult to clearly determine the number of lines. The following figure shows three simple examples for the
number of lines. According to the definitions given above, fingerprint categories can be described as follows: In loops, one or more ridges enter into the central area, they form a curve, touch or cross the imaginary lines between the delta and the nucleus and return to the same side from which they came. There are three decisive characteristics for classifying lines as a loop: (a) at least one suitably curved papillary line, (b) a delta, and (c) a number of lines other than zero. Depending on the orientation of the line's curve, a differentiation is made between right (clockwise) and left (anticlockwise) loops. Approximately 60 to 65 % of human fingerprints belong into this category.
Whorls have at least two deltas. In their nucleus, ridges form a twist. Even though this definition is very general, it expresses the main characteristic of this category. Whorls can be split up into further categories: (a) flat whorls, (b) whorls with a medium slant, (c) double whorls, and (d) random whorls. About 30 to 35 % of all fingerprints belong into this category.
Arches are a rather special type of fingerprint. Less than 5 % of all fingerprints belong into this category. Arches can be split up into two categories: (a) flat arches and (b) high arches. In flat arches, the ridges enter at the side, form moderate and nearly parallel waves in the center and exit on the opposite side. In high arches, the wave is stronger in the middle. The route of all lines is no longer parallel and part of the lines seemingly exerts pressure from below. The following figure shows some examples for individual categories
56
Obviously, due to the vast variation in the spectrum of fingerprints, the classification is always a big problem both for experts as well as for automatic systems. The allocation into categories is a very complex task. Dactyloscopy experts need a lot of experience in order to do their work reliably. The following figure demonstrates examples of fingerprint images, which are very difficult to classify.
3.1.5 Fingerprint Image Comparison : Data about the fingerprint category and further global characteristics, such as the number and position of the centers, deltas, and ridges, does provide enough information for a certain differentiation of fingerprints. However, the true individuality of fingerprints is determined by the anatomic characteristics of the ridges (minutiae) and their respective orientation. Whether they can be recorded in their entirety depends on the conditions when the fingerprint was taken as well as on its quality. The most frequently occurring minutiae are Ridge ending and Ridge bifurcation. Ridge ending defines the end of a line, while ridge bifurcation is defined as a point in the ridge where the line is separated into two branches. Minutiae are usually stable and robust with regard to conditions occurring during the scanning process. The below figure shows some examples. Minutiae can be characterized by their type, by x- and y-coordinates in a coordinate system, and by their direction.
57
If two fingerprints belong into the same category and have a certain number of identical minutiae, it is quite safe to say that they come from the same finger.
The general definition for the identicalness of any two fingerprint images consists of four criteria and says: The general pattern configuration has to be identical, The minutiae have to be qualitatively identical (qualitative factor), The quantitative factor says that a certain number of minutiae must be found There has to be a mutual minutiae relationship specifying that corresponding minutiae must have a mutual relationship. In practice, a large number of complex identification protocols for fingerprint image comparisons have been proposed. These protocols are derived from the traditional dactyloscopic methodology and prescribe an exact procedure for trained specialists.
Even though various protocols differ in the process flow of the comparison procedure and the definition of the decision, the basic steps remain the same. Typically, comparison is done in 58
an iterative three-phase-process. It is hardest to compare two fingerprints that have similar feature configurations. If, however, both fingerprints are totally different as far as their feature configuration is concerned, it is impossible that these images are from the same finger. In the next step, significant minutiae are examined, the central area is located, and the minutiae are compared with each other. Afterwards, the decisive comparison of the minutiae is carried out where all minutiae of the fingerprints are compared with each other. A decision is made based on identified pairs and their configuration.
Due to variations in fingerprint qualities, not all points are always clear or defined with the same quality. In such cases, experts use their discretion and experience in deciding whether images are identical or not. For instance, ridge bifurcations could be identified as ridge endings if little pressure was exerted in taking the fingerprint. Obviously, the experience of the experts always plays a certain key role when comparing fingerprints. As an example, the below figure shows the comparison of 18 such minutiae.
Image of the Fingerprint Identification Procedure In this section, the individual steps of the application "Fingerprint Image Recognition by Comparing Minutiae" are documented in pictures.
59
60
The main intension of this project is to design a Unique Id Card system Design for Personal Data Transactions. In order to fulfill this application there are few steps that has been performed i.e. 1) 2) 3) 4) Designing the power supply for the entire circuitry. Selection of microcontroller that suits our application. Selection of smart card. Selection of keypad 61
5)
Selection of EEPROM
Complete studies of all the above points are useful to develop this project.
In-order to work with any components basic requirement is power supply. In this section there is a one required voltage level. That is 1) 5V DC power supply
Now the aim is to design the power supply section which converts 230V AC in to 5V DC. Since 230V AC is too high to reduce it to directly 5V DC, therefore we need a stepdown transformer that reduces the line voltage to certain voltage that will help us to convert it in to a 5V DC. Considering the efficiency factor of the bridge rectifier, we came to a conclusion to choose a transformer, whose secondary voltage is 3 to 4 V higher than the required voltage i.e. 5V. For this application 0-9V transformers is used, since it is easily available in the market.
The output of the transformer is 9V AC; it feed to rectifier that converts AC to pulsating DC. As we all know that there are 3 kind of rectifiers that is 1) half wave 2) Full wave and 3) Bridge rectifier Here we short listed to use Bridge rectifier, because half wave rectifier has we less in efficiency. Even though the efficiency of full wave and bridge rectifier are the same, since there is no requirement for any negative voltage for our application, we gone with bridge rectifier. Since the output voltage of the rectifier is pulsating DC, in order to convert it into pure DC we use a high value (1000UF/1500UF) of capacitor in parallel that acts as a filter. The most easy way to regulate this voltage is by using a 7805 voltage regulator, whose output voltage is constant 5V DC irrespective of any fluctuation in line voltage.
62
As we know that there so many types of micro controller families that are available in the market. Those are 1) 8051 Family 2) AVR microcontroller Family 3) PIC microcontroller Family 4) ARM Family In this project we are using AVR family micro controller i.e. ATmega8515. There are minimum five requirements for proper operation of microcontroller. Those are: 1) power supply section 2) pull-ups for ports 3) Reset circuit 4) Crystal circuit 5) ISP circuit (for program dumping)
4.2.3. SELECTION OF SMART CARD: A smart card, chip card, or integrated circuit card (ICC), is any pocket-sized card with embedded integrated circuits which can process data. In my project I am using 1k memory smart cards for my small application this much size is sufficient. And I selected the smart card reader which is mostly available in market. And I selected the reader which I can communicate through serially. 4.3 SELECTION OF KEYPAD: A keypad is a set of buttons arranged in a block which usually bear digits and other symbols but not a complete set of alphabetical letters. If it mostly contains numbers then it can also be called a numeric keypad. Keypads are found on many alphanumeric keyboards and on other devices such as calculators, combination locks and telephones which require largely numeric input 4.4 SELECTION OF EEPROM: EEPROM (also written E2PROM and pronounced "e-e-prom," "double-e prom" or simply "e-squared") stands for Electrically Erasable Programmable Read-Only Memory and is a type of non-volatile memory used in computers and other electronic devices to store small amounts of data that must be saved when power is removed, e.g., calibration tables or device configuration. 63
When larger amounts of static data are to be stored (such as in USB flash drives) a specific type of EEPROM such as flash memory is more economical than traditional EEPROM devices. EEPROM s are realized as arrays of floating-gate transistors. There are different types of electrical interfaces to EEPROM devices. Main categories of these interface types are:
Serial bus Parallel bus In my application if I use parallel EEPROM I have to use more microcontroller pins which are unnecessary. Thats why I selected serial I2C based EEPROM. MICROCONTROLLER CONNECTIONS: To microcontroller all the components like EEPROM, keypad, smart card and LCD is connected. LCD is connected to PORTA and we are using 20X4 LCD in 4 bit mode. EEPROM is connected means SDA of memory is PORT D.4 and SCL is connected PORTD.5 of the microcontroller. The smart card reader is connected to PD0, PD1 pins and KEYPAD is connected to PORTC. Here we are using leds and buzzer for indication purpose. Red led is connected to PORTB.0, Green led is connected to PORTB.1 and buzzer is connected to PORTB.3. DESCRIPTION OF THE PROJECT: In this project I have 5 modules 1) LCD 2) KEYPAD 3) EEPROM 4) SMART CARD 5) BIOMETRIC MODULE Using these modules I developed one application. This application is nothing but UNIQUE ID CARD DESIGN FOR PERSONAL DATA TRANSACTIONS. The main aim of the project is to develop multiple applications by using single card. In this application initially system is asking for smartcard. After inserting smartcard, microcontroller is checking weather card is valid or not. If card is not valid buzzer will ON. If card is valid one menu is displayed on the LCD. User has to follow the menu with the help of the keypad. In this we are implementing four different applications. Whenever we are selecting any option from keypad it is asking one password. We have to enter password from the keypad. If the password is correct we are entering into selected option. After entering into selected option user has to follow the instruction. 64
CHAPTER 5 ADVANTAGES, DISADVANTAGES AND APPLICATION 5.1 ADVANTAGES: Every citizen of the country is accounted. All the information about that person can be saved in the smartcard and can be accessed and updated when needed.
If this smart card has more information like health record, travel details (Check at immigration, airports, and hotels) this will be of great use.
This will really boost the IT infrastructure of the country, for instance every hotel or every shop should be connected to this system and records of every citizen should be updated. This can be very helpful in keeping a watch or tracking security issues.
Right now we have many identification systems, like the Voters card, Passport, Driving license, but once this system is introduced, we should follow one and only Identification system and this should be the Unique Identification Smart Card. For every purpose the card should be access, checked and updated.
No need to carry health records if the card has a provision to store health records.
Every prime location should be identified (Like Airports, Railway stations, Hotels, Universities and the entry should be secured through these smart cards.
Updates from different departments Suppose the IT department wants to update you about your returns they can do it from their system and when you read your card you get the updates.
5.2 DISADVANTAGE:
While smart card technology is designed to keep personal information encrypted and secure, security breaches are still a potential threat. Physical damage, such as scratches to magnetic strips, can render cards unreadable. Unusual changes in electrical voltage can likewise erase or change information from smart cards, as can heat or exposure to strong UV rays. Thieves attempting to access others' cards have exploited these shortcomings.
65
Some attacks on smart cards have involved physical removal of memory processors, which can then be reverse-engineered. Continuing advances in smart card technology, however, are making newer cards less vulnerable to such attacks.
5.3 APPLICATIONS: The most common smart card applications are: Credit cards Personal identity Electronic cash Computer security systems Wireless communication Loyalty systems (like frequent flyer points) Banking Satellite TV Government identification
5.4 FUTURE SCOPE: Introduction of secured hybrid network which can unify banking networks, personal details like adaar card, driving license, student college id, pan card, voter id card etc..,makes it an easily carried electronic wallet.
66
CHAPTER-6 CODING
//*************************************************************// //*** UNIQUE ID CARD DESIGN FOR PERSONAL DATA TRANSACTIONS ****// //*************************************************************// #include<reg51.h> #include<string.h> #include"20x4lcd.h" #include"uart.h" #include "eeprom1.h" sbit sw = P3^5; sbit row0 = P2^0; sbit row1 = P2^1; sbit row2 = P2^2; sbit row3 = P2^3; sbit col0 = P2^4; sbit col1 = P2^5; sbit col2 = P2^6; unsigned char Cnt; unsigned char key[4][3] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'}; unsigned char ckey,r; unsigned char keypad(); sbit enrol = P3^6;
sbit identifysw = P3^7; sbit smartcard = P3^2; sbit fpmodule = P3^3; sbit buz = P2^7;
unsigned char identify_finger(void); code unsigned char enroll[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05}; // ok code unsigned char generate_ch[13]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X04,0x02,0X01,0X00, 0X08}; generate_ch1[13]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X04,0x02,0X02,0X0 0,0X09}; code unsigned char un_cmd[12]={0xef,0x01,0xff,0xff,0xff,0xff, 0x01,0x00,0x03,0x05,0x00,0x09 }; code unsigned char store[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X06,0X06,0X02,0x00}; code unsigned char identify[17]={0xef,0x01,0xff,0xff,0xff,0xff,0x01,0x00,0x08,0x1b,0x01,0x00,0x00,0x01,0x0 1,0x00,0x27}; idata unsigned char buf[50],ch,ch1,j=0,count1=0,count2=0,PA,PB,PC,PD,count,tempdata[10],psw[10],key1; unsigned int balance,amount; unsigned char keypad() { unsigned char K,c0,c1,c2,r=0; while(1) { row0=0x00; row1=0x00; row2=0x00; row3=0x00; col0=0x01; col1=0x01; col2=0x01; do { c0=col0; 68
c1=col1; c2=col2; }while((c0!=0x01)||(c1!=0x01)||(c2!=0x01)); // To check all keys are relesead or not do { c0=col0; c1=col1; c2=col2; }while((c0==0x01)&&(c1==0x1)&&(c2==0x01)); // To check any key is pressed or not while(1) { row0=0x00; // If row0 is pressed row1=0x01; row2=0x01; row3=0x01; c0=col0; c1=col1; c2=col2; if((c0!=1)||(c1!=1)||(c2!=1)) { r=0; break; } row0=1; row1=0; row2=1; row3=1; c0=col0; c1=col1; c2=col2;
if((c0!=1)||(c1!=1)||(c2!=1)) { r=1; 69
break; } row0=1; row1=1; row2=0; row3=1; c0=col0; c1=col1; c2=col2; if((c0!=0x01)||(c1!=0x01)||(c2!=0x01)) { r=2; break; } row0=1; row1=1; row2=1; row3=0; c0=col0; c1=col1; c2=col2; if((c0!=1)||(c1!=1)||(c2!=1)) { r=3; break; } } if((c0==0)&&(c1==1)&&(c2==1)) { K=key[r][0]; return K; } else if((c0==1)&&(c1==0)&&(c2==1)) 70
{ K=key[r][1]; return K; } else { K=key[r][2]; return K; } } } void convert(unsigned int temp1_value) { unsigned int value,d1,d2,d3; value=temp1_value/10; d3=temp1_value%10; d1=value/10; d2=value%10; lcddata(d1+48); lcddata(d2+48); lcddata(d3+48); } void serial(void) interrupt 4 { if(RI) { if(smartcarden==1) { if((SBUF !=13)&&(SBUF != 10)) { buf[j] = SBUF; ch=buf[j]; j++; } 71
} else { fp[j]= SBUF; j++; } RI = 0; } } void clearfp(void) { unsigned char cl=0; while(cl<20) { fp[cl]=' '; cl++; } j=0; } void main() { UART_init(); delay(50); buz=1; lcd_init(); delay(50); lcdcmd(0x84); msgdisplay(" WELCOME " ); delay(500); eeprom_write(0,'1'); delay(200); eeprom_write(1,'2'); delay(200); eeprom_write(2,'3'); 72
delay(200); eeprom_write(3,'*'); delay(200); eeprom_write(10,'4'); delay(200); eeprom_write(11,'5'); delay(200); ` eeprom_write(12,'6'); delay(200); eeprom_write(13,'*'); delay(200); eeprom_write(20,'7'); delay(200); eeprom_write(21,'8'); delay(200); eeprom_write(22,'9'); delay(200); eeprom_write(23,'*'); delay(200);*/ start: TH1=-6; smartcard=1; fpmodule=0; smartcarden=0; EA =1; ES =1; back: delay(100); lcdcmd(0x01); msgdisplay("SMART CARD BASE" ); lcdcmd(0xC0); msgdisplay("MULTIPURPOSE CARD" ); delay(1000); usernum=0; 73
while(1) { if(enrol == 0) { while(enrol == 0); lcdcmd(1); msgdisplay("Enrolling"); enroll_finger(); goto back; } if(identifysw == 0) { while(identifysw == 0); lcdcmd(1); msgdisplay("Identification"); if(!identify_finger()) goto back; else goto start1; //goto again; } } start1: lcdcmd(0x01); msgdisplay("INSERT CARD" ); //delay(500); TH1=-3; fpmodule=1; smartcard=0; smartcarden=1; delay(500); j=0; while(j==0) { 74 //identify //checking for enrolling
if(sw == 0) { lcdcmd(1); msgdisplay("1 -> USER1"); lcdcmd(0xc0); msgdisplay("2 -> USER2"); lcdcmd(0x94); msgdisplay("3 -> POLLING OFFICER"); while(sw == 0); ckey = keypad(); delay(300); if(ckey == '*') { lcdcmd(1); msgdisplay("1 -> USER1"); lcdcmd(0xc0); msgdisplay("2 -> USER2"); lcdcmd(0x94); msgdisplay("3 -> POLLING OFFICER"); lcdcmd(0x8c); for(i=0;eeprom_read(i)!='*';i++) lcddata(eeprom_read(i)); lcdcmd(0xcc); for(i=10;eeprom_read(i)!='*';i++) lcddata(eeprom_read(i)); lcdcmd(0xd4); for(i=20;eeprom_read(i)!='*';i++) lcddata(eeprom_read(i)); delay(2500); goto start; } key1 = ckey; zc: lcdcmd(1); 75
msgdisplay("ENTER OLD PASSWORD:"); delay(200); lcdcmd(0xc0); i=0; while(1) { zy: ckey = keypad(); if(ckey == '#') { tempdata[i] = '\0'; break; } else if(ckey == '*') { if(i == 0) goto zy;
i=i-1; lcdcmd(0x10); lcddata(' '); lcdcmd(0x10); } else { tempdata[i] = ckey; i=i+1; lcddata('*'); delay(300); } }
if(key1 == '1') { j=0; for(i=0;eeprom_read(i) != '*';i++) { psw[j] = j++; delay(200); } psw[j] = '\0'; delay(300); if(!(strcmp(psw,tempdata))) goto new; else goto xz; } /************ USER2 ***************/ eeprom_read(i);
if(key1 == '2') { j=0; for(i=10;eeprom_read(i) != '*';i++) { psw[j] = j++; delay(200); } psw[j] = '\0'; delay(300); if(!(strcmp(psw,tempdata))) goto new; else goto xz; 77 eeprom_read(i);
/************ POLLING OFFICER ***************/ if(key1 == '3') { j=0; for(i=20;eeprom_read(i) != '*';i++) { psw[j] = j++; delay(200); } psw[j] = '\0'; delay(300); if(!(strcmp(psw,tempdata))) goto new; else goto xz; } else goto zc; new: lcdcmd(0x94); msgdisplay("ENTER NEW PASSWORD:"); delay(200); lcdcmd(0xd4); i=0; while(1) { zy1: ckey = keypad(); if(ckey == '#') { psw[i] = '\0'; 78 eeprom_read(i);
break; } else if(ckey == '*') { if(i == 0) goto zy1; i=i-1; lcdcmd(0x10); lcddata(' '); lcdcmd(0x10); }
else { psw[i] = ckey; i=i+1; lcddata('*'); delay(300); } } /************ USER1 ***************/ if(key1 == '1') { for(i=0;psw[i] != '\0';i++) { eeprom_write(i,psw[i]); delay(300); } eeprom_write(i,'*'); delay(300);
delay(1000); goto start; } /************ USER2 ***************/ else if(key1 == '2') { i=10; for(j=0;psw[j] != '\0';j++) { eeprom_write(i,psw[j]); delay(300); i++; } eeprom_write(i,'*'); delay(300); lcdcmd(0xd4); msgdisplay("PSWD CHANGED"); delay(1000); goto start; }
/************ POLLING OFFICER ***************/ else if(key1 == '3') { i=20; for(j=0;psw[j] != '\0';j++) { eeprom_write(i,psw[j]); delay(300); i++; } eeprom_write(i,'*'); 80
delay(300); lcdcmd(0xd4); msgdisplay("PSWD CHANGED"); delay(1000); goto start; } else goto start; xz: buz=0; lcdcmd(0x94); msgdisplay("WRONG PASSWORD"); delay(1500); buz=1; goto start; } } delay(1000); buf[j]='\0'; j=0; lcdcmd(0x01); msgdisplay("Card Testing.."); delay(100); if(!strcmp(buf,"Enter password:")) { delay(500); lcdcmd(0xC0); //lcddata('1'); j=0; send_to_modem("EES"); ch_send_to_modem(13); ch_send_to_modem(10); while(j==0); delay(500); 81 //ENTER SECURITY CODE
lcdcmd(0x01); msgdisplay("CARD ACCEPTED.."); delay(500); j=0; send_to_modem("READ 50 1"); ch_send_to_modem(13); ch_send_to_modem(10); delay(200); //READING THE DATA
if((ch1 == 'A')&&(usernum==1)) { count = 1; count1=count1+1; lcdcmd(1); msgdisplay("CARD AUTHORIZED"); delay(800); lcdcmd(0xc0); msgdisplay("ENTER PASSWORD:"); delay(200); lcdcmd(0x94); i=0; while(1) { ckey = keypad(); delay(200); if(ckey == '#') { tempdata[i]='\0'; break; } else if(ckey == '*') { 82
lcdcmd(0x10); i--; psw[i] = ckey; } else { tempdata[i] = ckey; lcddata('*'); //lcddata(ckey); i++; } } j=0; for(i=0;eeprom_read(i) != '*';i++) { psw[j] = eeprom_read(i); j++; } psw[j]='\0'; if(strcmp(tempdata,psw)) { count1--; buz=0; lcdcmd(0x01); msgdisplay("WRONG PSWD: "); delay(1500); buz=1; goto end; } } /*************** USER2 *************/ else
if((ch1 == 'B')&&(usernum==2)) 83
{ count = 2; count2=count2+1; lcdcmd(1); msgdisplay("CARD AUTHORIZED"); delay(800); lcdcmd(0xc0); msgdisplay("ENTER PASSWORD:"); delay(200); lcdcmd(0x94); i=0; while(1) { ckey = keypad(); delay(200); if(ckey == '#') { tempdata[i]='\0'; break; } else if(ckey == '*') { lcdcmd(0x10); i--; psw[i] = ckey; } else { tempdata[i] = ckey; lcddata('*'); //lcddata(ckey); i++; } } 84
j=0; for(i=10;eeprom_read(i) != '*';i++) { psw[j] = eeprom_read(i); j++; } psw[j]='\0'; if(strcmp(tempdata,psw)) { count2--; buz=0; lcdcmd(0x01); msgdisplay("WRONG PSWD: "); delay(1500); buz=1; goto end; } } /*************** POLLING OFFICER else if((ch1 == 'C')&&(usernum==3)) { lcdcmd(1); msgdisplay("WELCOME TO"); delay(800); lcdcmd(0xc0); msgdisplay("POLLING OFFICER:"); lcdcmd(0x94); msgdisplay("ENTER PASSWORD:"); delay(200); lcdcmd(0xD4); i=0; while(1) { 85 *************/
ckey = keypad(); delay(200); if(ckey == '#') { tempdata[i]='\0'; break; } else if(ckey == '*') { lcdcmd(0x10); i--; psw[i] = ckey; } else { tempdata[i] = ckey; lcddata('*'); //lcddata(ckey); i++; } } j=0; for(i=20;eeprom_read(i) != '*';i++) { psw[j] = eeprom_read(i); j++; } psw[j]='\0'; if(strcmp(tempdata,psw)) { count2--; buz=0; lcdcmd(0x01); msgdisplay("WRONG PSWD: "); 86
delay(1500); buz=1; goto end; } lcdcmd(1); msgdisplay("PA lcdcmd(0xd4); convert(PA); lcdcmd(0xda); convert(PB); lcdcmd(0xe0); convert(PC); delay(2500); PA=PB=PC=0; goto end; } else { buz=0; lcdcmd(1); msgdisplay("CARD "); lcdcmd(0xc0); msgdisplay(" UNAUTHORIZED"); delay(1500); buz=1; goto end; } lcdcmd(1); lcdcmd(0x80); msgdisplay("1: POLLING UR VOTE "); lcdcmd(0XC0); msgdisplay("2: BANKING TRANS"); lcdcmd(0XD0); msgdisplay("ACTN"); 87 PB PC");
lcdcmd(0X94); msgdisplay("3: PERSONEL INFORMAT"); ckey = keypad(); //lcddata(ckey); delay(300); if(ckey == '1') goto voting; else if(ckey == '2') goto banking; else if(ckey == '3') goto personal; else { buz=0; lcdcmd(1); msgdisplay("WRONG TASK"); delay(1000); buz=1; goto end; } } else { buz=0; lcdcmd(0x01); msgdisplay("Card Error"); lcdcmd(0xc0); msgdisplay("Re Insert Card"); j=0; while(j==0); buz=1; delay(1000); 88
goto start; } voting: if(count == 1) { lcdcmd(1); msgdisplay("WELCOME USER1:"); delay(500); } if(count == 2) { lcdcmd(1); msgdisplay("WELCOME USER2:"); delay(500); } if(count1 >= 2) { buz=0; count1 = 0; lcdcmd(1); msgdisplay("NO PERMISSION"); lcdcmd(0xc0); msgdisplay("FOR SECOND TIME"); delay(1500); buz=1; goto end; } if(count2 >= 2) { buz=0; count2 = 0; lcdcmd(1); msgdisplay("NO PERMISSION"); lcdcmd(0xc0); 89
msgdisplay("FOR SECOND TIME"); delay(1500); buz=1; goto end; } lcdcmd(0xc0); msgdisplay("PLZ POLL UR VOTE"); //delay(500); ckey=keypad(); //lcddata(ckey); //delay(300); if(ckey == '1') { PA++; lcdcmd(0x94); msgdisplay("VOTE FOR PARTY A"); delay(1000); goto end; } else if(ckey == '2') { PB++; lcdcmd(0x94); msgdisplay("VOTE FOR PARTY B"); delay(1000); goto end; } else if(ckey == '3') { PC++; lcdcmd(0x94); msgdisplay("VOTE FOR PARTY C"); 90
banking: if(count1 > 0) count1=count1-1; if(count2>0) count2=count2-1; if(count == 1) { lcdcmd(1); msgdisplay("WELCOME USER1:"); }
if(count == 2) { lcdcmd(1); msgdisplay("WELCOME USER2:"); } delay(500); lcdcmd(1); msgdisplay("1:WITH DRAWL"); lcdcmd(0xc0); msgdisplay("2:MINI STATEMENT"); lcdcmd(0x94); msgdisplay("3:DEPOSIT AMOUNT"); lcdcmd(0xd4); msgdisplay("SELECT TASK:"); delay(500); ckey=keypad(); //lcddata(ckey); 91
delay(300); if(ckey=='2') { j=0; send_to_modem("READ 40 1"); ch_send_to_modem(13); ch_send_to_modem(10); while(j==0); lcdcmd(0x01); msgdisplay("Avl Balance"); lcddata(' '); balance=buf[0]*10; lcdcmd(0xc3); convert(balance); msgdisplay("/-"); delay(1000); goto end; } else if(ckey=='1') { j=0; send_to_modem("READ 40 1"); ch_send_to_modem(13); ch_send_to_modem(10); while(j==0); lcdcmd(0x01); msgdisplay("Avl Balance"); lcddata(' '); balance=buf[0]*10; if(balance==10) { buz=0; delay(1000); 92 //READING THE DATA //READING THE DATA
lcdcmd(0x01); msgdisplay("N0 Balance.."); lcdcmd(0xC0); msgdisplay("PLS RECHARGE"); delay(1000); buz=1; goto end; } convert(balance); j=0; lcdcmd(0xC0); msgdisplay("ENTER AMOUNT:"); i=0; amount=0; while(1) { tempdata[i]=keypad(); if((tempdata[i]=='#')||(tempdata[i]=='*')) { tempdata[i]='\0'; break; } lcddata(tempdata[i]); amount=amount*10+tempdata[i]-48; delay(100); i=i+1; } delay(1000); if(amount<=balance) { balance=balance-amount; balance=balance/10; if(balance==0) balance=1; 93
j=0; send_to_modem("WRITE 40 "); ch_send_to_modem(balance); ch_send_to_modem(13); ch_send_to_modem(10); while(j==0); delay(1000); goto end; } Else { buz=0; lcdcmd(0x01); msgdisplay("INSUFFICEINT BAL"); delay(1000); buz=1; buz=1; goto end; } } else if(ckey=='3') { lcdcmd(0x01); msgdisplay("AMOUNT DEPOSIT"); lcdcmd(0xC0); msgdisplay("IN UR ACCOUNT"); delay(500); j=0; send_to_modem("WRITE 40 "); ch_send_to_modem(80); ch_send_to_modem(13); ch_send_to_modem(10); while(j==0); 94 //READING THE DATA //READING THE DATA
delay(1000); goto end; } else { buz=0; lcdcmd(0x01); msgdisplay("WRONG "); lcdcmd(0xc0); msgdisplay(" TRANSACTION "); delay(1500); buz=1; goto end; } personal: if(count1 > 0) count1=count1-1; if(count2>0) count2=count2-1; if(count == 1) { lcdcmd(1); msgdisplay("READING..."); j=0; send_to_modem("READ 70 25"); ch_send_to_modem(13); ch_send_to_modem(10); delay(1500); buf[j]='\0'; j=0; /*lcdcmd(1); msgdisplay(buf); delay(1500); */ Cnt=0; 95 //READING THE DATA
lcdcmd(1); /* for(i=0;buf[i] != '\0';i++) { if(buf[i] == ' ') { Cnt= Cnt+1; if(Cnt == 1) lcdcmd(0xc0); if(Cnt == 2) lcdcmd(0x94); if(Cnt == 3) lcdcmd(0xd4); i++; } lcddata(buf[i]); } */ delay(2500); lcdcmd(1); msgdisplay("K.Srikanth"); lcdcmd(0xc0); msgdisplay("Reg. no:11099C054"); lcdcmd(0x94); msgdisplay("B.E, ECE IV year"); lcdcmd(0xd4); msgdisplay("SCSVMV UNIVERSITY"); delay(1500); goto end; } if(count == 2) { lcdcmd(1); msgdisplay("READING...");
j=0; 96
send_to_modem("READ 70 26"); ch_send_to_modem(13); ch_send_to_modem(10); delay(1500); buf[j]='\0'; j=0; /*lcdcmd(1); msgdisplay(buf); delay(1500); */ Cnt=0; lcdcmd(1); /* for(i=0;buf[i] != '\0';i++) { if(buf[i] == ' ') { Cnt= Cnt+1; if(Cnt == 1) lcdcmd(0xc0); if(Cnt == 2) lcdcmd(0x94); if(Cnt == 3) lcdcmd(0xd4); i++; } lcddata(buf[i]); } */ delay(2500); msgdisplay("CH.Uday Kiran"); lcdcmd(0xc0); msgdisplay("Reg. no:11099C021"); lcdcmd(0x94); msgdisplay("B.E, ECE IV year"); lcdcmd(0xd4); 97
msgdisplay("SCSVMV UNIVERSITY"); delay(1500); goto end; } end: lcdcmd(0x01); j=0; msgdisplay("PLZ REMOVE CARD"); buz=1; while(j==0); delay(2000); lcdcmd(0xc0); msgdisplay("THANK YOU!!!"); delay(1000); goto start; } unsigned char enroll_finger(void) { i=0; clearfp(); while(i<12) { ch_send_to_modem(enroll[i]); i++; } j=0; fp[9]=0x01; while(j==0); delay(200); if(fp[9]==0x00) {
} 98
else { lcdcmd(0xc0); msgdisplay("ENROLL FAILED"); buz = 0; delay(800); buz =1; //goto end; return 0; } clearfp(); j=0; i=0; while(i<13) { ch_send_to_modem(generate_ch[i]); i++; } j=0; fp[9]=0x01; while(j==0); delay(200); if(fp[9]==0x00) { } else { lcdcmd(0xc0); msgdisplay("ENROLL FAILED"); buz = 0; delay(500); buz =1; delay(200); delay(200); 99
//goto end; return 0; } i=0; clearfp(); while(i<12) { ch_send_to_modem(enroll[i]); i++; } j=0; fp[9]=0x01; while(j==0); delay(200); if(fp[9]==0x00) { } else { lcdcmd(0xc0); msgdisplay("ENROLL FAILED");
buz = 0; delay(500); buz =1; delay(200); delay(200); //goto end; return 0; } clearfp(); j=0; i=0; while(i<13) 100
{ ch_send_to_modem(generate_ch1[i]); i++; } j=0; fp[9]=0x01; while(j==0); delay(200); if(fp[9]==0x00) { } else { lcdcmd(0xc0); msgdisplay("ENROLL FAILED"); buz = 0; delay(500); buz =1; delay(200); delay(200); //goto end; return 0; } clearfp(); j=0; i=0; while(i<12) { ch_send_to_modem(un_cmd[i]); i++; } j=0; fp[9]=0x01; while(j==0); 101
delay(200); if(fp[9]==0x00) { } else { lcdcmd(0xc0); msgdisplay("ENROLL FAILED"); buz = 0; delay(500); buz =1; delay(200); delay(200); //goto end; return 0; } clearfp(); j=0; i=0; while(i<12) { ch_send_to_modem(store[i]); i++; } ch_send_to_modem(rec); ch_send_to_modem(0x00); ch_send_to_modem(dummy); j=0; fp[9]=0x01; while(j==0); delay(200); if(fp[9]==0x00) { lcdcmd(0x01); 102
msgdisplay("successfully "); lcdcmd(0xc0); msgdisplay("Enrolled "); delay(200); if(rec==0) msgdisplay("User1"); if(rec==1) msgdisplay("User2"); if(rec==2) { lcdcmd(0x94); msgdisplay("Polling officer"); } buz=0; delay(100); buz=1; rec++; dummy++; delay(200); delay(200); //goto end; return 1; } else { lcdcmd(0xc0); msgdisplay("ENROLL FAILED");
//goto end; //goto end; return 0; } //end: //delay(10); } unsigned char identify_finger(void) { i=0; clearfp(); while(i<12) { ch_send_to_modem(enroll[i]); i++; } j=0; fp[9]=0x01; while(j==0); delay(200); if(fp[9]==0x00) { } else { lcdcmd(0xc0); msgdisplay("UnAuthorized...."); delay(200); buz = 0; delay(500); buz =1; ES=0; //goto return 0; 104
} clearfp(); j=0; i=0; while(i<13) { ch_send_to_modem(generate_ch[i]); i++; } j=0; fp[9]=0x01; while(j==0); delay(200); if(fp[9]==0x00) { } else { lcdcmd(0xc0); msgdisplay("UnAuthorized...."); delay(200); buz = 0; delay(500); buz =1; ES=0; //goto end; return 0; } clearfp(); i=0; j=0; while(i<17) { ch_send_to_modem(identify[i]); 105
i++; } j=0; while(j==0); delay(200); if(fp[9]==0x00) { lcdcmd(0x01); msgdisplay("Successfully "); lcdcmd(0xc0); msgdisplay("Identified User:"); usernum=fp[11]+1;; lcddata(fp[11]+49); buz=0; delay(100); buz=1; delay(200); delay(200); //goto end; return 1; } else { lcdcmd(0xc0); msgdisplay("UnAuthorized...."); delay(200); buz = 0; delay(500); buz =1; ES=0; delay(200); //goto end; return 0; } 106
//end: //delay(10); }
CONCLUSION:
Finally we would like to aim at: 107
Increasing Security. Excluding Sophisticated communication systems. Reduction of cyber crime. Minimizing cards usage.
Smart card are now being deployed that recognize this vulnerability and are making a significance impact in promoting social inclusion.With this new methodology we wish to eradicate cyber crime and our vision is to multiplex n number of cards such as credit/ATM cards, pan card, passport, driving licence etc into a single unique card.
References:
ATMEL 8051 micro controller primer by Steven F.Barret & Daniel J.Pack. IETE (The Institute of Electronics And Telecommunication and Communication Engineers), Hyderabad. Guidance Under P.Shyam Sundar Sir, (RESEARCH & DEVELOPMENT Dept), OSMANIA University. Embedded Systems by Raj Kamal microcontroller and c compiler design PDF retrieved 2012-09-19 Maxim max 232 DATASHEET PDF BUZZER- Wikipedia Electronic components Resistors inspectors technical guide How stuff works.com how capacitors work The life and times of LED- a 100 year history the optoelectronics research centre. 8051 Core overview Open cores .retrieved 2012 -9- 19
108