Top Banner
JOMO KENYATTA UNIVERSITY Of AGRICULTURE AND TECHNOLOGY FACULTY OF ENGINEERING Department of Electrical and Electronics Engineering P.O.BOX 62000-00200, NAIROBI EEE 2501: FINAL YEAR PROJECT REPORT TITLE: MICRO CONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) Author: GEORGE NGUGI KIBIA E26-0668/03 Supervisor: MR. BAARIU A.M This report is submitted in partial fulfillment of the requirement for the award of BSc. Degree in Electronics and Computer Engineering of Jomo Kenyatta University of Agriculture and Technology. MARCH 2009
72
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: project

JOMO KENYATTA UNIVERSITY Of

AGRICULTURE AND TECHNOLOGY

FACULTY OF ENGINEERING

Department of Electrical and Electronics Engineering

P.O.BOX 62000-00200, NAIROBI

EEE 2501: FINAL YEAR PROJECT REPORT

TITLE:

MICRO CONTROLLER BASED VEHICLE PARKING SYSTEM

(MICROBVPS)

Author:

GEORGE NGUGI KIBIA

E26-0668/03

Supervisor:

MR. BAARIU A.M

This report is submitted in partial fulfillment of the requirement for the award of BSc. Degree in Electronics and Computer

Engineering of Jomo Kenyatta University of Agriculture and Technology.

MARCH 2009

Page 2: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 2

DECLARATION

I, George Ngugi Kibia, registration number E26-0668/03, do hereby declare that this is my original work

and that it has neither been submitted nor transferred by any other student for a degree or any other

course in this institution or any other institution of learning.

George Ngugi Kibia

Signature……………………………….Date…………………………………………

CERTIFICATION

This project has been proposed, developed supervised and submitted for examination with my approval

as the University supervisor.

Mr. Baariu A.M

Signature………………………………. Date………………………………………..

Lecturer,

Page 3: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 3

Acknowledgement

I thank God, the Almighty for the gift of life and for enabling me to pursue my undergraduate

studies with good health both mentally and physically.

I also kindly thank and acknowledge the efforts of the people who have helped me from the

onset to the completion of my course and project.

First of all I am grateful to my supervisor, Mr. Baariu A.M for his insight, professional

assistance, kind guidance and constructive criticism regarding my work. This was a driving

force and immensely contributed to completion of my project.

I also thank my parents and siblings whose constant support and encouragement steered

me through the development of my project. It is through their help too that I’m able to finish

the course.

Lastly, I express my heart felt gratitude to the lecturers in the Electrical and Electronics

Department who parted helpful knowledge to me and thus enabled me to successfully

develop my project.

To my friends THANK YOU GUYS.

Thank you all and may God bless us all and grant us long life.

Page 4: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 4

Dedication

To my loving parents and siblings:

For your unconditional love, support and encouragement throughout my education.

Page 5: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 5

TABLE OF CONTENTS

Declaration...............................................................................................................2

Certification..............................................................................................................2

Acknowledgment......................................................................................................3

Dedication................................................................................................................4

Abstract....................................................................................................................7

1. CHAPTER INTRODUCTION.................................................................................................8

1.1 Background information..................................................................................................8

1.2 Problem statement…………………………………………………………………………...8 1.3 Goals and objectives…………………………………………………………………………8

1.4 Justification......................................................................................................................9

1.4.1 Advantages.............................................................................................................9

2. CHAPTER: LITEATURE REVIEW......................................................................................10 2.1 Types of parking.............................................................................................................10 2.2 General information on Road Side parking lots..............................................................10 2.3 Shortcomings of roadside parking..................................................................................13

2.4 Improvements......................................................................................................14 3. CHAPTER 3: METHODOLOGY............................................................................................15 3.1 Microcontroller..................................................................................................................15 3.1.1 Introduction..............................................................................................................15 3.1.2 Description...............................................................................................................16 3.1.3 Features...................................................................................................................16 3.1.4 Pin Description.........................................................................................................18 3.1.5 Oscillator Characteristics.........................................................................................20 3.2 The 8255 Programmable Peripheral Interface.................................................................20 3.2.1 Introduction...............................................................................................................20 3.2.2 Uses..........................................................................................................................20 3.2.3 Pin Description..........................................................................................................22 3.2.4 Operational Description............................................................................................24 3.3 Light Dependent Resistor (LDR)........................................................................................25 3.3.1 Introduction...............................................................................................................25 3.3.2 Uses of light dependent Resistors............................................................................26 3.3.3 Light dependent resistors circuits.............................................................................26 3.4 NE555 Timer......................................................................................................................27 3.4.1 Introduction...............................................................................................................27 3.4.2 Monostable mode.....................................................................................................28 3.4.2.1 Monostable circuit..........................................................................................28 3.4.2.2 Doing the Calculations...................................................................................29 3.4.2.3 Varying the Time Period................................................................................29 3.5 LED Seven Segment Display.............................................................................................31 3.5.1 Introduction...............................................................................................................31 3.5.2 Types of Seven Segment LEDS...............................................................................32 3.5.3 Using Lookup Table ...............................................................................................33 3.6 Liquid Crystal Display (LCD)..............................................................................................36 3.6.1 LCD Pin Descriptions.................................................................................................36 3.7 Motors................................................................................................................................39 3.7.1 Introduction................................................................................................................39 3.7.2 Stepper Motor............................................................................................................40 3.7.2.1 Fundamentals of Operation...........................................................................40 3.7.2.2 Stepper Motor Characteristics........................................................................41 3.7.3 Unipolar Stepper Motor.............................................................................................42

Page 6: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 6

3.8 74157 Multiplexer...........................................................................................................44 3.8.1 Introduction............................................................................................................44 4. CHAPTER FOUR: CIRCUIT DESIGN.................................................................................46 4.1 Hardware Description..................................................................................................46 4.1.1 Display Section....................................................................................................47 4.1.2 Lift Section...........................................................................................................48 4.1.3 Motor Section.......................................................................................................49 4.1.4 Floor Sensor Section...........................................................................................50 4.1.5 LCD Section........................................................................................................51 4.2 Software Development................................................................................................53 4.3 Program Flow chart.....................................................................................................54 5. CHAPTER FIVE CONCLUSION AND RECOMMENDATIONS.............................55

5.1 Experimental Results......................................................................................55

5.2 System Application..........................................................................................55

5.3 Problems Encountered....................................................................................56

5.4 Recommendations ..........................................................................................56

6. CHAPTER SIX BUDGET ESTIMATE.....................................................................58

7. CHAPTER SEVEN TIME SCHEDULE...................................................................59

REFERENCES......................................................................................................60

APPENDIX A Terms and Abbreviations

APPENDIX B List of figures and tables

APPENDIX C Project Program code

APPENDIX D Pin configuration of parts

APPENDIX E Project Circuit Diagram

Page 7: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 7

ABSTRACT

The problem of the increasing number of vehicles is receiving considerable attention with the

construction of new parking lots in major cities around the world including Nairobi: Kenya. The

theoretical and practical modeling of the Microcontroller Based Vehicle Parking System will

improve the management of multistoried parking lots.

In the Microcontroller Based Vehicle Parking System (MICROBVPS) I have developed an

embedded system that manages a multistory parking using digital integrated circuits. The

system incorporates the following major sections: Microcontroller, Display section, Sensor

section, Motor and lift section which are interconnected in a logical way to perform the control

with greater flexibility and reliability. A software program is written in assembly language and a

hardware interface developed to implement the controller. It also involves the use of modern

sensor devices to bring about the detection intelligence.

The system is controlled by sensors which are activated by LDRs placed in the lift and

on each floor. The sensors send a signal to the microcontroller which uses an internally stored

program is to detect what floor the car is at and decrement/ increments a counter at the ground

floor on exit/entrance. The system uses a stepper motor to move vehicles among the different

floors of a multistory building.

The system when implemented in a real multistoried parking, it will help in managing the

parking lot in an efficiency and less costly way at the same time saving time and fuel cost

spent by motorists when looking for a place to park.

The system is also economical.

Page 8: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 8

CHAPTER ONE

1. INTRODUCTION

1.1 BACKGROUND INFORMATION

Owning and driving a car should not only be a luxury but also an enjoyable thing. This is not

encouraged by the constant hustle and headaches one goes through when trying to get a parking

space in a congested town or city. Parking lots should be well managed and provide relevant

information to motorist in the shortest time possible. This information could be the number of available

parking spaces and the location.

1.2 PROBLEM STATEMENT

Due to the limited number of parking spaces in Nairobi Central Business District (NCBD) and

major cities around the world, it has become necessary to have car parks in office blocks and at times

multistory buildings used exclusively for car parks.

It‟s for this reason that a system that can manage the car park efficiently using lifts instead of

the traditional concrete ramp needs to be developed and implemented.

1.3 GOALS AND OBJECTIVES

1. To have an efficient and well managed vehicle parking system in line with “KENYAS VISION

2030” of having and maintaining a sustainable economic growth of 10%.This system would

eliminate time wasted while looking for parking and also to create employment.

2. To design a system that can display how many cars are parked in each floor and the ones that

are available for cars to be parked.

3. To have sensors in each floor and in the lift to detect presence of a car.

4. To have a Welcome screen at the entrance of the car park entrance.

5. To provide a lift in a storied parking lots to move cars from ground floor to respective floors for

parking and vice versa.

Page 9: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 9

1.4 JUSTIFICATION

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM will help to minimize the car

parking time in places where many vehicles need to be parked; this system proves to be useful in

reducing wastage of space and provide a well coordinated parking system. This

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM enables the parking of vehicles, floor

after floor and thus reducing the space used. Here any number of cars can be parked according to

specific requirement and a system provided to show number of cars parked and those remaining. For

example you can have different floors with different requirements for access e.g. carwash parking,

members parking, VIP parking where you are required to enter a password for entry etc. This makes

the system modernized and even saves space.

1.4. Advantages

1. Security

The vehicle is safe from damage. Theft is impossible. Since the inside of the Park System can

be monitored via CCTV at a centralised location, the vehicle cannot be broken into, and the vehicle

is safe from adverse weather conditions and vandalism as well.

2. Speed

Parking time is reduced unlike the case where we have a single one way ramp and the driver

drives in different floors looking for an empty parking space. This wastes a lot of time which can

be saved by the driver knowing in advance which floor has an available parking.

3. Fewer Emissions

The Park System takes ecological and social aspects into consideration as well, and creates

additional parking space for the future. Fewer emissions (up to 35% less CO2 and 44% less

Benzene) and the total elimination of traffic caused by people looking for a space in a roadside

car park have a positive impact on the environment. The smaller footprint of a Park System

compared to a roadside car park will save precious real estate which can be used for other

purposes.

Page 10: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 10

CHAPTER TWO

LITERATURE REVIEW

2.1TYPES OF PARKING

Parking lot (called a car park) is a cleared area that is more or less level and is intended for

parking vehicles. Usually, the term refers to a dedicated area that has been provided with a durable or

semi-durable surface. See Fig 1.1

Fig1.1.Adiagonal parking in Nairobi Fig 1.2. Multi storey parking using

ramp (A MICROBVPS to be installed)

In most countries where cars are the dominant mode of transportation, parking lots are a feature

of every city and suburban area. Shopping malls, sports stadiums, mega churches and similar venues

often feature lots of immense area.

2.2 GENERAL INFORMATION ON ROADSIDE PARKING LOTS

The usual parking lot is paved with asphalt. Some are paved with concrete. Many are gravel

lots. A few of the newer lots are surfaced with permeable paving materials.

Parking lots have their own special type of engineering. While parking lots have traditionally

been an overlooked element of development projects by governmental oversight, the recent trend has

been to provide regulations for the configuration and spacing of parking lots, their landscaping, and

drainage and pollution abatement issues.

Parking lots can be small, with just parking spaces for a few vehicles, very large with spaces for

thousands of vehicles, or any size in between. Small parking lots are usually near buildings for small

businesses or a few apartments, although many other locations are possible. Larger parking lots can be

for larger businesses or those with many customers, institutions such as schools, churches, offices, or

hospitals, museums or other tourist attractions, rest areas, strip malls, or larger apartment buildings.

Page 11: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 11

At places where most visitors and employees use their car to access place, the parking lot

usually takes up more land area than the buildings. This is at least true for shopping centres and office

buildings, unless a multi-storey park is used.

In most cases, especially in areas where parking is scarce, one must pay to park in a parking

lot. Entry and exit access is often controlled at these types of lots to ensure those parking pay the

required fee.

In many congested areas where some businesses lack their own parking areas, there are

parking lots where practically any driver can pay a fee to park. These types of parking lots are often

effectively businesses in themselves. Some parking lots have parking meters into which coins must be

paid to park in the adjacent space.

Some spaces in a parking lot may be marked as "reserved" for certain people, including those

who are handicapped. There are often one or more parking spaces for handicapped people, which may

be slightly wider, close to the point of entry for the corresponding store or building. Vehicles with

handicapped tags may park there, but the non-handicapped are not allowed to.

Although many parking lots are rectangular-shaped, there are parking lots of all sorts of shapes.

A parking lot can be in front or back, on the side of the building it services, or any combination of these,

including all around the building, often depending on local building codes. In a very large parking field, it

is easy to get lost or have trouble finding one's vehicle. Such large parking lots often have various

sections marked, for example by numbers or letters, to help identify the location.

The area in parking lots is organized into parking spaces, which are generally marked with paint

lines for each vehicle and often contain a turtarrier, and driving lanes in between so that vehicles can

drive into and out of the spaces. The arrangement of the parking spaces relative to the driving lanes

can feature perpendicular parking spaces, angle parking (most common in North America, especially in

large lots), or parallel parking (least common in parking lots, and usually only for a few spaces), or

possibly some combination of these.

Large parking lots have multiple lanes with rows of parking spaces between each one. Except

for rather small lots, the location of the parking spaces for each vehicle are usually indicated with

pavement markings or lines, similar to center lines on streets. A very common arrangement in large

parking lots is angle parking for two rows of vehicles between driving lanes, with the parked vehicles

facing front to front between the two rows. At the sides of the parking lot, other driving lanes connect

these lanes perpendicularly so that a vehicle can drive into and out of the parking lot at designated

locations.

Page 12: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 12

Fig 1.3: Parking lot layout with angle parking as seen from above.

White arrows show direction of allowed travel in each lane (for right-hand-drive countries; vice

versa in left-hand-drive countries). Several parking spaces closest to the building entrance are reserved

for the handicapped. Cars of various colors are shown parked in some of the spaces. The obtusely

pointed end indicates the front end of each car.

There may be speed limits, stop signs and crosswalks for pedestrians in large parking lots. Tall

overhead lights may illuminate some parking lots at night.

Most spaces in normal parking lots available to the public are sized for vehicles about the size

of a car. The spaces are usually arranged assuming the vehicle can back out of the parking space. In

many rest areas on highways, long parking spaces are also available for trucks or other vehicles with

trailers, into which they can enter at one end and leave at the opposite end to avoid potentially

cumbersome reverse driving.

A common arrangement in paid parking lots is to have a vehicle entry point with a cross gate

where an entering driver presses a button to take a stub with the entry time and to open the cross gate

for access to the lot. When leaving, the driver would pay at an exit point according to how much time

was spent in the lot as determined from the stub.

In order to keep unauthorized people from parking in lots, towing crews sometimes patrol

parking lots after business closing hours, especially at night, to tow away vehicles which should not be

parked there.

Page 13: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 13

2.3 SHORTCOMINGS OF ROAD SIDE PARKING

1. Runoff handling

Parking lots have certain characteristics that set them apart from roadways in terms of their

engineering and operating requirements. The first is that they often cover large contiguous areas with

impermeable paving surface. This means that virtually all of the rain (minus evaporation) that falls

becomes runoff. The parking lot must be built to effectively channel and collect runoff. Traditionally, the

runoff has been shunted directly into storm sewers, streams, or even sanitary sewers. However, larger

municipalities now require retention basins to catch runoff to reduce the stress on sewer systems or

stream ways.

2. Water pollution

Parking lots also tend to be subject to contamination with concentrated spots of pollutants such

as motor oil. While motor vehicles on roadways may drip oil, they do so over a large area. Oil drips on

parking lots are concentrated enough that they can have a deleterious effect on the water quality of the

runoff. Other pollutants, even brake-lining dust, rust particles, and other particulate materials that settle

on the parking lot surface, can be a similar problem. Therefore, an important second function of the

retention basin for parking lots is to act as a temporary storage impoundment to allow particulate

materials to settle out and to slow or even prevent the release of other pollutants into waterways.

3. Alternative paving

An alternative solution today is to use permeable paving surfaces, such as brick, stone, special

paving blocks, or tire-tread woven mats. The intent of these is to allow rain to soak into the ground

through the spaces inherent in the parking lot surface. The ground then may become contaminated in

the surface of the parking lot, but this tends to stay in a small area of ground, which effectively filters

water before it seeps away. This can however create problems if contaminants seep into groundwater,

especially where there is groundwater abstraction 'downstream' for potable water supply.

4. Landscaping

Many areas today also require minimum landscaping in parking lots. This usually principally

means the planting of trees to provide shade. Customers have long preferred shaded parking spaces in

the summer, but parking lot providers have long been antagonistic to planting trees because of the

extra cost of cleaning the parking lot.

Page 14: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 14

However, parking lots represent significant heat islands and, indeed, heat sinks in urban areas.

The heat from paved areas in urban zones has been shown to even have the power to change the

weather locally. By providing trees or other means of shading parking lots, the heat and glare resulting

from them can be significantly reduced.

2.4 IMPROVEMENTS

1. INCREASED PARKING SPACE

Automatic multi-storey car parks provide lower building cost per parking slot, as they

typically require less building volume and less ground area than a conventional facility with the

same capacity.

This would ease congestion and increase parking space by having a certain vehicle

parking capacity increased by a multiple of the number of floors.

2. REDUCED PARKING TIME

Having an efficient park lot monitoring system would reduce the time a driver takes looking for

an empty parking. In this system the stats of the parking lot is displayed at the entrance, thus

enabling him to find another parking lot.

3. REDUCED POLLUTION

These systems reduce fuel wasted while searching for empty spaces and helps in the reduction

of carbon emissions.

The city council can build a special drainage for the parking lot to remove spilt oil in the parking

4. REDUCED CONGESTION

Reduction in congestion in the city due to fewer cars driving around searching for spaces

Page 15: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 15

CHAPTER THREE

3.0 METHODOLOGY

3.1 MICROCONTROLLER:

3.1.1 INTRODUCTION

In this project AT89C51-24 microcontroller was used which is an 8051 derivative.

The first task faced when learning to use a new microcontroller was to become familiar with the

capability of the machine. The features of the microcontroller was best learned by studying the internal

hardware design, also called the architecture of the device, to determine the type, number, and size of

the registers and other circuitry.

The hardware is manipulated by an accompanying set of program instructions, or software. Once

familiar with hardware and software, the microcontroller was applied to the problem at hand. I.e. to

develop the microcontroller based vehicle parking system

The 8051 microcontroller generic part number actually includes a whole family of microcontrollers

that have numbers ranging from 8031 to 8751.The block diagram of the 8051 shows all of the features

unique to microcontrollers:

Internal ROM and RAM

I/O ports with programmable pins

Timers and counters

Serial Data communication

The block diagram below shows the usual CPU components program counter, ALU, working registers,

and the clock circuits.

The 8051 architecture consists of these specific features:

8 bit CPU with registers A and B

16 bit PC & data pointer (DPTR)

8 bit program status word (PSW

8 bit stack pointer (SP)

Internal ROM or EPROM (8751)of 0(8031)to 4k(8051)

Internal RAM of 128 bytes.

4 register banks , each containing 8 registers

80 bits of general purpose data memory

32 input/output pins arranged as four 8 bit ports:P0-P3

two 16 bit timer/counters:T0-T1

Two external and three internal interrupt sources

Page 16: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 16

Oscillator and clock circuits

3.1.2 DESCRIPTION

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM). The device is manufactured using

Atmel‟s high-density nonvolatile memory technology and is compatible with the industry-standard

MCS-51 instruction set and pin out.

The on-chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a

monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and

cost-effective solution to many embedded control applications.

The AT89C51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM,

32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial

port, on-chip oscillator and clock circuitry. In addition, the AT89C51 is designed with static logic for

operation down to zero frequency and supports two software selectable power saving modes. The Idle

Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to

continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator

disabling all other chip functions until the next hardware reset.

3.1.3 FEATURES

Compatible with MCS51 product

4K Bytes of In-System Reprogrammable Flash Memory

Endurance: 1,000 Write/Erase Cycles

Fully Static Operation: 0 Hz to 24 MHz

Three-level Program Memory Lock

128 x 8-bit Internal RAM

32 Programmable I/O Lines

Two 16-bit Timer/Counters

Six Interrupt Sources

Programmable Serial Channel/full duplex

Low-power Idle and Power-down Modes

Page 17: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 17

Fig 3.1: Block diagram showing the usual CPU components program counter, ALU, working registers,

and the clock circuits.

Page 18: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 18

A pin out of the AT89C51-24 packaged in a 40 pin DIPS * Appendix 3.1

3.1.4 PIN DESCRIPTION

VCC

Supply voltage

GND

Ground

PORT 0

Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can sink eight

TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs.

Port 0 may also be configured to be the multiplexed low-order address/data bus during

accesses to external program and data memory. In this mode P0 has internal pull-ups. Port 0 also

receives the code bytes during Flash programming, and outputs the code bytes during program

verification. External pullups are required during program verification.

PORT 1

Port 1 is an 8-bit bi-directional I/O port with internal pullups. The Port 1 output buffers can

sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal

pullups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will

source current because of the internal pullups. Port 1 also receives the low-order address bytes during

Flash programming and verification.

PORT 2

Port 2 is an 8-bit bi-directional I/O port with internal pullups. The Port 2 output buffers can

sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal

pullups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will

source current because of the internal pullups. Port 2 emits the high-order address byte during

fetches from external program memory and during accesses to external data memory that uses 16-bit

addresses (MOVX @ DPTR). In this application, it uses strong internal pull-ups when emitting 1s.

During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the

contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and

some control signals during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional I/O port with internal pullups. The Port 3 output buffers can

sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal

pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will

source current because of the pullups. Port 3 also serves the functions of various special features of

the AT89C51 as listed below:

Page 19: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 19

PORT 3 PIN ALTERNATE FUNCTIONS

P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 T0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

P3.6 WR (external data memory write strobe)

P3.7 RD (external data memory read strobe)

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

RST

Reset input. A high on this pin for two machine cycles while the oscillator is running resets the

device.

ALE/PROG

Address Latch Enable output pulse for latching the low byte of the address during accesses to

external memory. This pin is also the program pulse input (PROG) during Flash programming. In

normal operation ALE is emitted at a constant rate of 1/6 of the oscillator frequency, and may be used

for external timing or clocking purposes. Note however, that one ALE pulse is skipped during each

access to external Data Memory.

If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set,

ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high.

Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.

PSEN

Program Store Enable is the read strobe to external program memory.

When the AT89C51 is executing code from external program memory, PSEN is activated twice each

machine cycle, except that two PSEN activations are skipped during each access to external data

memory.

EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the device to fetch

code from external program memory locations starting at 0000H up to FFFFH.

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

should be strapped to VCC for internal program executions.

This pin also receives the 12-volt programming enable voltage (VP P) during Flash

programming, for parts that require 12-volt VP_P.

XTAL1

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

XTAL2

Page 20: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 20

Output from the inverting oscillator amplifier

3.1.5 OSCILLATOR CHARACTERISTICS

XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be

configured for use as an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used.

To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is

driven. There are no requirements on the duty cycle of the external clock signal, since the input to the

internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high

and low time specifications must be observed.

3.2 THE 8255 PROGRAMMABLE PERIPHERAL INTERFACE

3.2.1 INTRODUCTION

The Intel 8255 (or i8255) Programmable Peripheral Interface chip is a peripheral chip originally

developed for the Intel 8085 microprocessor, and as such is a member of a large array of such chips,

known as the MCS-85 Family. This chip was later also used with the Intel 8086 and its descendants. It

was later made (cloned) by many other manufacturers. It is made in DIP 40 and PLCC 44 pins

encapsulated versions.

3.2.2 USES

This chip is used to give the CPU access to programmable parallel I/O.

The 8255 is used in home computers such as SV-328 and all MSX

. The 8255 chip is used together with a micro controller to expand its I/O capabilities.

The 82C55A is a very powerful tool for interfacing peripheral equipment to the microcomputer

system. It represents the optimum use of available pins and flexible enough to inter face almost

any I/O device without the need for additional external logic.

Each peripheral device in a microcomputer system usually has a “service routine” associated with it.

The routine manages the software interface between the device and the CPU. The functional definition

of the 82C55A is programmed by the I/O service routine and becomes an extension of the system

software. By examining the I/O devices interface characteristics for both data transfer and timing, and

matching this information to the examples and tables in the detailed operational description, a control

word can easily be developed to initialize the 82C55A to exactly “fit” the application.

Page 21: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 21

Fig 3.2 8255 FUNCTIONAL BLOCK DIAGRAM

This block diagram shows the internal architecture of the 8255ppi

+5V

PA7-0

POWER

SUPPLIES GND

PC7-4

BIDIRECTIONAL

DATA BUS (D7-D0) 8 BIT INTERNAL

DATABUS PC3-0

RD

WR

A1 PB7-0

A0

RESET

GROUP A

CONTROL

READ

WRITE

CONTR

OL

LOGIC

DATA BUS BUFFER

GROUP B

CONTROL

GROUP AB

PORT AB

(8)

GROUP B

PORT C (4)

GROUP A

PORT C (4)

GROUP A

PORT A (8)

Page 22: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 22

3.2.3 8255 PIN DESCRIPTION

Data Bus Buffer

This 3 –state bi directional 8 bit is used to interface the 82C55A to the system data bus. Data is

transmitted or received by the buffer upon execution of input or output instructions by the CPU.

Control words and status information are also transferred through the data bus buffer.

Read/Write and control logic

The function of this block is to manage all of the internal and external transfers of both Data

and Control or Status words. It accepts inputs from the CPU Address and Control busses and in turn,

issues commands to both of the Control Groups.

Chip select (CS)

A “low” on this input pin enables the communication between the 8255A and the CPU.

Read (RD).

A “low” on this input pin enables 8255A to send data or status information to the CPU on the

data bus. In essence, it allows the CPU to “read from” the 8255A.

Write (WR).

A “low” on this input pin enables the CPU to wr ite data or control words into the 82C55A.

Port Select 0 and Port Select 1. (A0 and A1)

These input signals, in conjunction with the RD and WR inputs, control the selection of one of

the three ports or the control word register. They are normally connected to the least significant bits of

the address bus (A0 and A1).

A1 A0 RD WR CS INPUT OPERATION

0 0 0 1 0 Port A-Data BUS

0 1 0 1 0 Port A-Data BUS

Page 23: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 23

1 0 0 1 0 Port A-Data BUS

1 1 0 1 0 Control Word-Data bus

A1 A0 RD WR CS OUTPUT OPERATION

0 0 1 0 0 Port A-Data BUS

0 1 1 0 0 Port A-Data BUS

1 0 1 0 0 Port A-Data BUS

1 1 1 O 0 Control Word-Data bus

A1 A0 RD WR CS Disable Function

x X X x 1 Chip is Disabled

x X 1 1 0 Chip is Disabled

TABLE 3.1: Control Signals of the 8255ppi

(RESET) Reset.

A “high” on this input initializes the control register to 9Bh and all ports (A, B, C) are set to the

input mode. “Bus hold” devices internal to the 82C55A will hold the I/O port inputs to a logic “1” state

with a maximum hold current of 400µA.

Group A and Group B Controls

The functional configuration of each port is programmed by the systems software. In essence,

the CPU “outputs” a control word to the 82C55A. The control word contains information such as

“mode”, “bit set”, “bit reset”, etc., that initializes the functional configuration of the 82C55A.Each of the

Control blocks (Group A and Group B) accepts “commands” from the Read/Write Control logic,

receives “control words” from the internal data bus and issues the proper commands to its associated

ports.

Control Group A - Port A and Port C upper (C7 - C4)

Control Group B - Port B and Port C lower (C3 - C0)

The control word register can be both written and read as shown in the “Basic Operation” table. When

the control word is read, bit D7 will always be a logic “1”, as this implies control word mode

information.

Page 24: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 24

Port A, B, and C

The 82C55A contains three 8-bit ports (A, B, and C). All can be configured to a wide variety of

functional characteristics by the system software but each has its own special features or “personality”

to further enhance the power and flexibility of the 82C55A.

Port B One 8-bit data input/output latch/buffer and one 8-bit data input buffer.

Port C One 8-bit data output latch/buffer and one 8-bit data input buffer (no latch for input). This port

can be divided into two 4-bit ports under the mode control. Each 4-bit port contains a 4-bit latch and it

can be used for the control signal output and status signal inputs in conjunction with ports A and B.

3.2.4 OPERATIONAL DESCRIPTION

Mode Selection

There are three basic modes of operation than can be selected by the system software:

Mode 0 - Basic Input/ Output

Mode 1 - Strobed Input/ Output

Mode 2 - Bi-directional Bus

When the reset input goes “high”, all ports will be set to the input mode with all 24 port lines

held at a logic “one” level by internal bus hold devices. After the reset is removed, the 82C55A can

remain in the input mode with no additional initialization required. This eliminates the need to pullup or

pulldown resistors in all-CMOS designs. The control word register will contain 9Bh. During the

execution of the system program, any of the other modes may be selected using a single output

instruction. This allows a single 82C55A to service a variety of peripheral devices with a simple

software maintenance routine. Any port programmed as an output port is initialized to all zeros when

the control word is written.

The modes for Por t A and Port B can be separately defined, while Port C is divided into two

portions as required by the

Port A and Port B definitions. All of the output registers, including the status ip/ ops, will be reset

whenever the mode is changed. Modes may be combined so that their functional definition can be

“tailored” to almost any I/O structure.

Operating Modes

Mode 0 (Basic Input/ Output).

This functional configuration provides simple input and output operations for each of the three ports.

No handshaking is required; data is simply written to or read from a specific port.

Mode 0 Basic Functional Definitions:

• Two 8-bit ports and two 4-bit ports

Page 25: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 25

• Any Port can be input or output

• Outputs are latched

Input are not latched

• 16 different Input/ Output configurations possible

Mode 1 (Strobed Input/ Output).

This functional configuration provides a means for transferring I/O data to or from a specified

port in conjunction with strobes or “hand shaking” signals. In mode 1, port A and port B use the lines

on port C to generate or accept these “hand shaking” signals.

Mode 1 Basic Function Definitions:

• Two Groups (Group A and Group B)

• Each group contains one 8-bit port and one 4-bit control/data port

• The 8-bit data port can be either input or output. Both inputs and outputs are latched.

• The 4-bit port is used for control and status of the 8-bit port.

Mode 2 (Strobed Bi-Directional Bus I/O)

The functional configuration provides a means for communicating with a peripheral device or

structure on a single 8-bit bus for both transmitting and receiving data (bi-directional bus I/O). “Hand

shaking” signals are provided to maintain proper bus discipline similar to Mode 1. Interrupt generation

and enable/disable functions are also available.

Mode 2 Basic Functional Definitions:

• Used in Group A only

• One 8-bit, bi-directional bus Port (Port A) and a 5-bit

3.3 LIGHT DEPENDENT RESISTOR (LDR)

3.3.1 INTRODUCTION

A photo resistor is an electronic component whose resistance decreases with increasing

incident light intensity. It can also be referred to as a light-dependent resistor (LDR), or photoconductor.

A photoresistor is made of a high-resistance semiconductor. If light falling on the device is of high

enough frequency, photons absorbed by the semiconductor give bound electrons enough energy to

Page 26: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 26

jump into the conduction band. The resulting free electron (and its hole partner) conduct electricity,

thereby lowering resistance.

A photoelectric device can be either intrinsic or extrinsic. In intrinsic devices, the only available

electrons are in the valence band, and hence the photon must have enough energy to excite the

electron across the entire band gap. Extrinsic devices have impurities added, which have a ground

state energy closer to the conduction band since the electrons don't have as far to jump, lower energy

photons (i.e. longer wavelengths and lower frequencies) are sufficient to trigger the device.

3.3.2 USES FOR LIGHT DEPENDENT RESISTORS

Light dependent resistors are a vital component in any electric circuit which is to be turned on

and off automatically according to the level of ambient light - for example, solar powered garden lights,

and night security lighting.

An LDR can even be used in a simple remote control circuit using the backlight of a mobile phone to

turn on a device - call the mobile from anywhere in the world, it lights up the LDR, and lighting (or a

garden sprinkler) can be turned on remotely!

3.3.3 LIGHT DEPENDENT RESISTOR CIRCUITS

There are two basic circuits using light dependent resistors

1. Darkness activated

2. Light activated

The two circuits are very similar and just require an LDR, some standard resistors, a variable resistor (aka potentiometer), and any small signal transistor

1. Darkness activated

Fig 3.3: Darkness activated LDR

Page 27: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 27

In the circuit diagram above, the LED lights up whenever the LDR is in darkness. The 10K variable resistor is used to fine-tune the level of darkness required before the LED lights up. The 10K standard resistor can be changed as required to achieve the desired effect, although any replacement must be at least 1K to protect the transistor from being damaged by excessive current. 2. Light activated

Fig 3.4: Light activated LDR

By swapping the LDR over with the 10K and 10K variable resistors (as shown above), the circuit will be activated instead by light. Whenever sufficient light falls on the LDR (manually fine-tuned using the 10K variable resistor), the LED will light up.

Calculating Vout :

V out = Rbottom x V in Rbottom +Rtop

3.4 NE555 TIMER 3.4.1 INTRODUCTION

The 555 is an integrated circuit (chips) implementing a variety of timers and multivibrators

applications. The 555 timer is one of the most popular and versatile integrated circuits ever produced.

Depending on the manufacturer, it includes over 20 transistors, 2 diodes and 15 resistors on a silicon

chips installed in an 8-pin mini dual-in-line package (DIP-8).

The 555 has three operating modes:

• Monostable mode: in this mode, the 555 functions as a “one shot”. Applications include timer,

missing pulse detection, bounce free switches, touch switches, Frequency Divider,

Capacitance Measurement, PWM, etc

Page 28: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 28

Astable Free Running mode: the 555 can operate as an oscillator. Uses include LED and

lamp flashers, pulse generation, logic clocks, tone generation, security alarms, pulse position

modulation, etc

Bistable mode or Schmitt trigger: the 555 can operate as a flipflop, if the DIS pin is not

connected and no capacitor is used. Uses include bounce free latched switches, etc

3.4.2 MONOSTABLE MODE

The waveforms in figure 3.5 illustrate the operation of a monostable. A monostable circuit

produces one pulse of a set length (time period T) in response to a trigger input such as a push button.

The output of the circuit stays in the low state until there is a trigger input, hence the name

"monostable" meaning "one stable state".

FIG: 3.5 The monostable input and output wave form

3.4.2.1 The 555 Monostable Circuit

The circuit diagram of the 555 monostable circuit is given in figure 3.6. Notice that the resistor

value R and the capacitor value C are unspecified. The values of these components determine the

length of time that the monostable output is in the high state, and they may be calculated using the

equation below.

Where T is the time period in seconds, and R and C are the component values in Ohms (Ω) and Farads (F).

Page 29: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 29

FIG 3.6 The 555 monostable circuit

3.4.2.2 Doing the Calculations

Here is a step-by-step guide to calculating the value of resistor R - an example is given in curly braces

{}.

1. Firstly, decide the time period T that you require. This can be very small (milliseconds) or large

(minutes), but it must be expressed in seconds. {I choose T = 10 seconds}

2. Next, guess a value for the capacitor C, expressed in Farads. For starters, try 100μF. {I choose

C = 100μF}

3. Put the values of T and C into the equation below and calculator resistor R...

If the resistor value you calculated is smaller than 1kΩ or larger than 1MΩ, you should re-do the

calculation with a different value for capacitor C until you get a resistor value within the acceptable

range.

3.4.2.3 Varying the Time Period

If you will need to adjust the time period of the monostable circuit in use, you can use a linear

variable resistor for R, as shown in figure 3.7

Because the resistance of a variable resistor goes down to around 0Ω at one end of its range, a 1kΩ

resistor is placed in series with it so that the value of R will never fall below 1kΩ. As the shaft of the

variable resistor is turned from its lowest setting to its highest, T will become longer.

Page 30: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 30

If your chosen variable resistor has three connections, it is a potentiometer, and you should

connect to the centre connection and either of the end connections.

FIG 3.7 Varying the time period with a variable resistor

The Trigger Input

As you can see from figure 3.5, the 555's Trigger input must be taken low to trigger the

monostable. This is achieved in figure 3.6 by placing a button in series with a resistor across the power

supply. Normally, the 10kΩ resistor keeps the Trigger input high, at the voltage Vs, and the

monostable is in its steady state. When the button is pushed, the Trigger input is directly connected to

0V and the time period T starts.

The Reset Input

If you want to make the monostable output go low before the time period has elapsed, simply

take the 555's Reset input briefly low. This can be achieved with a push button in exactly the same

way as with the Trigger input.

Page 31: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 31

TABLE 3.2: 555 TIMER PIN DESCRIPTION TABLE

3.5 LED SEVEN SEGMENT DISPLAY

3.5.1 INTRODUCTION

The Light Emitting Diode (LED) finds its place in many applications of modern electronics. One

of them is the Seven Segment Display. Seven-segment displays contains the arrangement of the LEDs

in “Eight” (8) passion, and a Dot (.) with a common electrode, lead (Anode or Cathode). The purpose of

arranging it in that passion is that we can make any number out of that by switching ON and OFF the

particular LED's.

Nr. Name Purpose

1 GND Ground, low level (0V)

2 TR A short pulse high → low on the trigger starts the timer

3 Q During a timing interval, the output stays at +VCC

4 R A timing interval can be interrupted by applying a reset pulse to low (0V)

5 CV Control voltage allows access to the internal voltage divider (2/3 VCC)

6 THR The threshold at which the interval ends (it ends if U.thr → 2/3 VCC)

7 DIS Connected to a capacitor whose discharge time will influence the timing interval

8 V+, VCC The positive supply voltage which must be between 3 and 15 V

Page 32: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 32

Here is the block diagram of the Seven Segment LED arrangement.

FIG 3.8 Pin configuration of a seven segment display:

3.5.2 TYPES OF SEVEN SEGMENT LEDS

LED‟s are basically of two types

Common Cathode (CC)

All the 8 anode legs uses only one cathode, which is common.

Common Anode (CA)

The common leg for all the cathode is of Anode type.

For discussion purpose, we use CC LED, where by just reversing the logical voltages we can

implement the same for CA LED also.

In a CC LED, all the 8 legs ('a' through 'h') are of anode type and the common cathode will be

connected to the GND of the supply. By energizing any of the legs with +5 Volts will lead to switch the

correspondent segment ON. In the microprocessor binary system, 0Volts will be considered as Binary

0, and 5Volts will be considered as Binary1. Considering these two condition, we can make an

arrangement as the microcontroller gives OUT the 0s and 1s through its ports, which is connected to

Page 33: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 33

the 8 legs of the LED. Of course, we can control the Port Output; implicitly we can Switch-ON required

legs of the display.

Here we discuss 2 methods of interfacing LED with the Microcontroller Intel 8051/8951.

1. Using lookup table. This uses 7 output pins of microcontroller

2. Using 7447 decoder. This method uses 4 output pins of microcontroller

The difference between the two main methods is simple and clear. In both the cases,

microcontroller communicates with external world through its ports. But, in the 1st case, we connect all

the 8 pins of the port directly to the LED and control the voltage through the ports manually to display

the desired number. But, in the second case, we send the BCD of the number that we wanted to

display to a middleware IC 7447, the BCD to LED code converter, which by itself gives out the

correspondent 7 segment codes to the LED.

3.5.3 USING LOOKUP TABLE:

This method uses the port of the microcontroller to display the desired number. The common

cathode pin is connected to GND by external wire, if it is the CC LED and in the case of the common

Anode LED, the Anode pin is connected to +Vcc. Here, other pins of the LED are connected to Port 2

of 8951 via 8255 ppi. A table will be prepared which relates the BCD code to the LED display code

(pattern). This table is known as a Lookup table. The table below explains how a Lookup table is

constructed. Circuit diagram is given below.

Page 34: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 34

FIG 3.9 Circuit diagram for Common Anode 7-Segment Display

FIG 3.10: Circuit diagram for Common CATHODE 7-Segment Display interfaced to 8951

Page 35: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 35

Calculation of lookup table as follows:

The lookup table contains the input pattern for the LED legs, to display the corresponding digits.

The table shows the seven segment requirement pattern to display the Hex number, with the seven

segment conversion.

For example, Let us consider the display of the number 0, where we need to switch ON all the LEDs

which are there at the boundary. I.e. for a CC LED, we should supply 5 volts to these LEDs. The 6

LEDs ('a' through 'f') should get binary 1, the dot and the (middle) hyphen segment should get 0Volts

or the binary Zero. Effectively the Seven segment pattern code will be (0011 1111) 3Fh. That is what

we OUT through the port pins.

For a Common Anode LED, the display pattern will be the complement of that of Common Cathode

pattern.

Table 3.3: For common Cathode (the seven segment requirement pattern to display the Hex number,

with the seven segment conversion)

Hex Number Seven Segment conversion Seven Segment

equivalent dot g f e d c b a

0 0 0 1 1 1 1 1 1 3F

1 0 0 0 0 0 1 1 0 06

2 0 1 0 1 1 0 1 1 5B

3 0 1 0 0 1 1 1 1 4F

4 0 1 1 0 0 1 1 0 66

5 0 1 1 0 1 1 0 1 6D

6 0 1 1 1 1 1 0 1 7D

7 0 0 0 0 0 1 1 1 07

8 0 1 1 1 1 1 1 1 7F

9 0 1 1 0 0 1 1 1 67

Page 36: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 36

Table 3.4: For common Anode: (the seven segment requirement pattern to display the Hex number,

with the seven segment conversion.)

Hex Number Seven Segment conversion Seven Segment

equivalent dot g f e d c b a

0 1 1 0 0 0 0 0 0 C0

1 1 1 1 1 1 0 0 1 F9

2 1 0 1 0 0 1 0 0 A4

3 1 0 1 1 0 0 0 0 B0

4 1 0 0 1 1 0 0 1 99

5 1 0 0 1 0 0 1 0 92

6 1 0 0 0 0 0 1 0 82

7 1 1 1 1 1 0 0 0 F8

8 1 0 0 0 0 0 0 0 80

9 1 0 0 1 1 0 0 0 98

3.6 LIQUID CRYSTAL DISPLAY (LCD)

3.6.1 LCD PIN DESCRIPTIONS:

The LCD discussed in this section has 16 pins. The function of each pin is given in table.

FIG.3.11: 2 LINE X 16 CHARACTER LCD DISPLAY PIN DESCRIPTION

Page 37: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 37

Pin Symbol I/O Description

1 GND - Ground

2 Vcc - +5V power supply

3 VEE - Contrast control

4 RS I command/data register selection

5 R/W I write/read selection

6 E I/O Enable

7-14 DB0-7 I/O The 8-bit data bus

Table 3.5: Pin Description of LCD display

Vcc, Vss, and VEE

While Vcc and Vss provide +5V and ground, respectively, VEE is used for controlling LCD

contrast.

RS - register select:

There are two very important registers inside the LCD. The RS pin is used for their selection as

follows. If RS = 0, the instruction command code register is selected, allowing the user to send a

command such as clear display, cursor at home, etc. If RS = 1 the data register is selected, allowing

the user to send data to be displayed on the LCD.

R/W - read/write:

R/W input allows the user to write information to the LCD or read information from it. R/W = 1

when reading; R/W =0 when writing.

E - enable:

The enable pin is used by the LCD to latch information presented to its data pins. When data is

supplied to data pins, a high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins. This pulse must be a minimum of 450 ns wide.

Page 38: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 38

D0 – D7:

The 8 bit data pins, D0 – D7, are used to send information to the LCD or read the contents of

the LCD‟s 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 instructions 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.

Table 3.6: List of LCD display instruction command codes.

Code (hex) Command to LCD Instruction Register

1 Clear display screen

2 Return home

4 Shift cursor to left

5 Shift display right

6 Shift cursor to right

7 Shift display left

8 Display off, Cursor off

A Display off, Cursor on

C Display on, cursor off

E Display on, cursor blinking

F Display on, cursor blinking

10 Shift cursor position to left

14 Shift cursor position to right

18 Shift the entire display to the left

1C Shift the entire display to the right

80 Force cursor to beginning of 1st line

C0 Force cursor to beginning of 2nd line

38 2 lines and 5x7 matrix

We also use RS = 0 to check the busy flag bit to see if the LCD is ready to receive 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 busy taking care of internal operations and will not accept any new

Page 39: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 39

information. When D7 = 0, the LCD is ready to receive new information. Note: It is recommended to

check the busy flag before writing any data to the LCD.

3.7 MOTORS

3.7.1 INTRODUCTION

An electric motor uses electrical energy to produce mechanical energy. The reverse process is

that of using mechanical energy to produce electrical energy and this is accomplished by a generator or

dynamo. Traction motors used on locomotives and some electric and hybrid automobiles often

performs both tasks if the vehicle is equipped with dynamic brakes. Electric motors are found in

household appliances such as fans, refrigerators, washing machines, pool pumps, floor vacuums, and

fan-forced ovens. They are also found in many other devices such as computer equipment, in its disk

drives, printers, and fans; and in some sound and video playing and recording equipment as DVD/CD

players and recorders, tape players and recorders, and record players. Electric motors are also found in

several kinds of toys such as some kinds of vehicles and robotic toys.

Table 3.7: Comparison of motor types

Type Advantages Disadvantages Typical Application Typical

Drive

AC Induction

(Shaded Pole)

Least expensive

Long life

high power

Rotation slips from

frequency

Low starting torque

Fans Uni/Poly-

phase AC

AC Induction

(split-phase

capacitor)

High power

high starting

torque

Rotation slips from

frequency

Appliances Uni/Poly-

phase AC

AC Synchronous Rotation in-sync

with freq

long-life

(alternator)

More expensive Clocks

Audio turntables

tape drives

Uni/Poly-

phase AC

Stepper DC Precision

positioning

High holding

torque

Slow speed

Requires a

controller

Positioning in

printers and floppy

drives

Multiphase

DC

Brushless DC Long lifespan High initial cost Hard drives Multiphase

Page 40: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 40

electric motor low maintenance

High efficiency

Requires a

controller

CD/DVD players

electric vehicles

DC

Brushed DC

electric motor

Low initial cost

Simple speed

control (Dynamo)

High maintenance

(brushes)

Low lifespan

Treadmill exercisers

automotive starters

Direct (PWM)

3.7.2 STEPPER MOTOR

To control the lift so as to move between floors a stepper motor will be the most convenient type

of motor to use.

A stepper motor (or step motor) is a brushless, synchronous electric motor that can divide a

full rotation into a large number of steps. The motor's position can be controlled precisely, without any

feedback mechanism (see open loop control). Stepper motors are similar to switched reluctance

motors, which are very large stepping motors with a reduced pole count, and generally are closed-loop

commutated.

3.7.2.1 FUNDAMENTALS OF OPERATION

Stepper motors operate differently from normal DC motors, which rotate when voltage is applied

to their terminals. Stepper motors, on the other hand, effectively have multiple "toothed" electromagnets

arranged around a central gear-shaped piece of iron.

The electromagnets are energized by an external control circuit, such as a microcontroller. To

make the motor shaft turn, first one electromagnet is given power, which makes the gear's teeth

magnetically attracted to the electromagnet's teeth. When the gear's teeth are thus aligned to the first

electromagnet, they are slightly offset from the next electromagnet. So when the next electromagnet is

turned on and the first is turned off, the gear rotates slightly to align with the next one, and from there

the process is repeated. Each of those slight rotations is called a "step." In that way, the motor can be

turned to a precise angle.

Page 41: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 41

Working

Fig 3.12 Description of rotation of a stepper motor

The top electromagnet (1) is turned on, attracting the nearest teeth of a gear-shaped iron rotor.

With the teeth aligned to electromagnet 1, they will be slightly offset from electromagnet 2.

The top electromagnet (1) is turned on, attracting the nearest teeth of a gear-shaped iron rotor.

With the teeth aligned to electromagnet 1, they will be slightly offset from electromagnet 2.

Fig 3.13.Step rotation a stepper motor

The bottom electromagnet (3) is energized; another 3.6° rotation occurs.

The left electromagnet (4) is enabled, rotating again by 3.6°. When the top electromagnet (1) is

again enabled, the teeth in the sprocket will have rotated by one tooth position; since there are 25

teeth, it will take 100 steps to make a full rotation in this example.

3.7.2.2 STEPPER MOTOR CHARACTERISTICS

Stepper motors are constant-power devices (power = angular velocity x torque). As motor

speed increases, torque decreases. The torque curve may be extended by using current limiting drivers

and increasing the driving voltage.

Page 42: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 42

Steppers exhibit more vibration than other motor types, as the discrete step tends to snap the

rotor from one position to another. This vibration can become very bad at some speeds and can cause

the motor to lose torque. The effect can be mitigated by accelerating quickly through the problem speed

range, physically damping the system, or using a micro-stepping driver. Motors with a greater number

of phases also exhibit smoother operation than those with fewer phases.

3.7.3 UNIPOLAR STEPPER MOTOR

In the construction of unipolar stepper motor there are four coils. One end of each coil is tide

together and it gives common terminal which is always connected with positive terminal of supply. The

other ends of each coil are given for interface. Specific color code may also be given. Like in my motor

orange is first coil (L1), brown is second (L2), yellow is third (L3), black is fourth (L4) and red for

common terminal.

By means of controlling a stepper motor operation we can

1. Increase or decrease the RPM (speed) of it

2. Increase or decrease number of revolutions of it

3. Change its direction means rotate it clockwise or anticlockwise

To vary the RPM of motor we have to vary the PRF (Pulse Repetition Frequency). Number of applied

pulses will vary number of rotations and last to change direction we have to change pulse

sequence.

These three things just depends on applied pulses. Now there are three different modes to rotate a

unipolar stepper motor

1. Single coil excitation

2. Double coil excitation

3. Half step excitation

The table given below gives the complete idea of how pulses are given in each mode

Page 43: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 43

Table 3.8: Pulses for stepper motor module

Note:- In half step excitation mode motor will rotate at half the specified given step resolution. Means if

step resolution is 1.8 degree then in this mode it will be 0.9 degree. Step resolution means on receiving

on 1 pulse motor will rotate that much degree. If step resolution is 1.8 degree then it will take 200

pulses for motor to compete 1 revolution (360 degree).

The specification of the stepper motor that I have used are.

Max rated voltage: - 5 V

Max rated current per coil: - 0.5 Amp

Step resolution: - 1.8 degree / pulse

Max RPM: - 20 in single/double coil excitation mode and 60 in half step mode

Torque: - 1.5 Kg/cm2

RPM calculation:-

One can calculate the exact RPM at which motor will run. We know that motor needs 200 pulses to

complete 1 revolution. Means if 200 pulses applied in 1 second motor will complete 1 revolution in 1

second. Now 1 rev. in 1 sec means 60 rev. in 1 minute. That will give us 60 RPM. Now 200 pulses in 1

sec means the PRF is 200 Hz. And delay will be 5 millisecond (ms). Now let‟s see it reverse.

* If delay is 10 ms then PRF will be 100 Hz.

* So 100 pulses will be given in 1 sec

Page 44: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 44

* Motor will complete 1 revolution in 2 second

* so the RPM will be 30.

In the same manner delay is changed in the PRF so is the RPM.

3.8 74157 MULTIPLEXER

3.8.1 INTRODUCTION

A multiplexer or mux is a device that performs multiplexing; it selects one of many analog or

digital input signals and outputs that into a single line. A multiplexer of 2n inputs has n select bits, which

are used to select which input line to send to the output.

An electronic multiplexer makes it possible for several signals to share one expensive device or other

resource, for example one A/D converter or one communication line, instead of having one device per

input signal.

An electronic multiplexer can be considered as a multiple-input, single-output switch, and a

demultiplexer as a single-input, multiple-output switch. The schematic symbol for a multiplexer is an

isosceles trapezoid with the longer parallel side containing the input pins and the short parallel side

containing the output pin. The schematic on the right shows a 2-to-1 multiplexer on the left and an

equivalent switch on the right. The sel wire connects the desired input to the output.

74157 QUAD- 2:1 MUX

A 2-to-1 multiplexer has a boolean equation where A and B are the two inputs, S is the selector

input, and Z is the output

Output is the same as input given

The 74157 is a quad 2-input multiplexer which select 4 bits of data from two sources under the control

of a common data select input (S). The four outputs present the selected data in the true (non-

Page 45: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 45

inverted) form. The enable input (E) is active LOW. When E is HIGH, all of the outputs (1Y to 4Y) are

forced LOW regardless of all other input conditions.

Table 3.9 multiplexer pin description

Page 46: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 46

CHAPTER FOUR

4.0 CIRCUIT DESIGN

4.1 HARDWARE DESCRIPTION

Microcontroller Based Vehicle Parking System is composed of the following broadly classified

sections:

1. Microcontroller and Program section

2. Display section

3. Indicator section

4. Lift & motor section

5. Sensor section

6. LCD section

This can be illustrated in the block diagram as below:

FIGURE 4.1. BLOCK DIAGRAM OF MICROCONTROLLER BASED VEHICLE

PARKING SYSTEM

LIFT (STEPPER

MOTOR)

MICROCONTROLLER AND

8255 INTERFACE 7 SEGMENT DISPLAY

LIFT

SENSOR (LDR)

FLOOR

SENSORS (LDR)

LCD DISPLAY

Page 47: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 47

FIG 4.2 PROJECT BLOCK DIAGRAM

4.1.1 DISPLAY SECTION

This section displays the floor number along with the number of cars which has been already

parked in that particular floor. So whenever a car is ready to either come down or go up, the program

either decrements the count or increments the count automatically according to the going up or coming

down of a car. Display section is done by interfacing with 8255(PPI) to AT89C51.Here 2 ports of 8255

are connected to two 7-segment display. Block diagram of this section is shown.

Common Anode mode of connection is shown below.

Page 48: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 48

FIG 4.3: SEVEN SEGMENT CONNECTION TO THE 8255PPI

4.1.2 LIFT SECTION

This lift sensor is placed in the lift. Lift Sensor section contains LDR's and 555 Timers. The

LDR is Darkness activated (discussed earlier) and is used to trigger the 555 Timer in the monostable

mode thus providing a pulse of a specified duration to the MCU.

OPERATION

In the lift section, there is a light beam and LDR to know whether a car has entered the lift or

not. When the GREEN LED of indicator section glows, that means the lift is ready for the car to enter.

When the car enters the lift, the light beam falling on LDR present in the lift gets cut and it gives a signal

that a car has entered the lift. Then the program decides which floor lift has to go and gives a signal to

motor section. Circuit diagram of sensor present in lift is shown below.

Page 49: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 49

FIG 4.4: LIFT SENSOR

R4

DC7

Q3

GN

D1

VCC

8

TR2

TH6

CV5

U1

555 C1220n

R21k

R3100R

R4

100R

+5v

RV1RES-VAR

LDR

output(mux)

D1LED

Q1BC547

4.1.3 MOTOR SECTION

The motor section is the mechanical part of the system which is used for taking the lift up/down.

When the lift has to go up, the program gives a signal to the motor instructing it to rotate clockwise and

if it has to go down, it rotates anticlockwise.

First 4 pins of port A of the 8255 are connected to the motor. Power transistors 2N3055 must be

connected to amplify the MCU output so as to be sufficient to drive the motor. A current limiting resistor

is place in series with each pin and motor terminals (L1-4) to prevent current from flowing back into the

microcontroller thus damaging it.

One end of each coil is tide together and it gives a common terminal which is always connected

to the ground of power supply source.

Page 50: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 50

Circuit diagram of this section is shown below.

FIG 4.5: MOTOR INTERFACE TO THE 8255PPI

4.1.4 FLOOR SENSOR SECTION

This sensor is placed on each floor of the building at the lift entrance. The Sensor section

contains LDR's and 555 Timers. The LDR is LIGHT activated (discussed earlier) and is used to trigger

the 555 Timer in the monostable mode thus providing a pulse of a specified duration to the MCU.

OPERATION

When a person needs to come down from a particular floor to ground floor, he must focus the

headlights of the car onto the LDR placed in that floor. When light falls on the LDR its resistance

decreases. Hence IC 555 triggers and gives a signal. The program identifies that signal and gives a

signal to the motor instructing it which flow to move to: the motor may move clockwise or anticlockwise.

The circuit diagram of the sensor is shown below.

This circuit is different compared to that of lift sensor shown above.

Page 51: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 51

FIG 4.6: FLOOR SENSOR

R4

DC7

Q3

GND

1VC

C8

TR2

TH6

CV5

U1

555 C1220n

R21k

R3100R

R4

100R

+5v

RV2RES-VAR

output (mux)

Q1BC547

4.1.5 LCD SECTION:

The LCD is used to display some messages which are useful to car owners. A 2X16 LCD (Liquid

Crystal Display) is used. This is used to display messages like

WELCOME TO CAR PARKING SYSTEM

LIFT IS BUSY PLEASE WAIT

PLEASE ENTER YOUR PASSWORD

Circuit diagram of LCD section is shown below.

Page 52: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 52

FIG 4.7: LCD interfaced to AT89C51 microcontroller.

FIG 4.8: LCD interfaced to AT89C51 microcontroller via 8255 PPI

Page 53: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 53

4.2 SOFTWARE DEVELOPMENT

INTRODUCTION

Assembly language

A program written in assembly language consists of a series of instructions--mnemonics that

correspond to a stream of executable instructions, when translated by an assembler that can be loaded

into memory and executed.

For example, an x86/IA-32 processor can execute the following binary instruction as expressed in

machine language (see x86 assembly language):

Binary: 10110000 01100001 (Hexadecimal: B0 61)

The equivalent assembly language representation is easier to remember (example in Intel syntax, more

mnemonic):

MOV AL, #61h

This instruction means:

Move the value 61h (or 97 decimal; the h-suffix means hexadecimal; the pound sign means

move the immediate value, not location) into the processor register named "AL".

The mnemonic "mov" represents the opcode 1011 which moves the value in the second operand into

the register indicated by the first operand. The mnemonic was chosen by the instruction set designer to

abbreviate "move", making it easier for the programmer to remember. A comma-separated list of

arguments or parameters follows the opcode; this is a typical assembly language statement.

ASSEMBLER

An ASSEMBLER is a program that transforms assembly language into machine language and

the reverse by a disassembler. Unlike in high-level languages, there is usually a one-to-one

correspondence between simple assembly statements and machine language instructions. Each

computer architecture and processor architecture has its own machine language.

Page 54: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 54

4.3 PROGRAM FLOW CHART (pseudo code)

INITIALIZE LCD DISPLAY

START

IS THERE A CAR?IS THERE

CAR IN F1&F2

CHECK SENSOR AT THE ENTRANCE

MOVE MOTOR

UP TO F1/F2

MOVE MOTOR

UP

MOVE TO

GROUND FLOOR

CHECK IF

FIRST FLOOR

IS FULL?

STOP MOTOR

MOVE TO

SECOND FLOOR

CHECK IF

SECOND

FLOOR IS

FULL?

DISPLAY ALL

FLOORS ARE

FULL

INCREMENT F1

COUNTER

STOP MOTPR

END

INCREMENT F2

COUNTER

Page 55: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 55

CHAPTER FIVE

5.0 CONCLUSION AND RECOMMENDATIONS

5.1 EXPERIMENTAL RESULTS

A Seven segment display at the ground floor which is basically a counter displays the number of

cars in each floor. It informs whether the floors are fully filled with cars or is there a free parking space

in a particular floor or not. There is a lift facility to carry the car up and down the building. Movement of

Lift is controlled by a stepper motor. An indicator with a green and red LED is kept in all the floors to

indicate whether the lift is busy or is it ready to take the car up or down. If the red LED glows that

means the lift is already engaged and the person has to wait for the green LED to glow.

In this project I have provided TWO floors for car parking. Maximum storage capacity of each

floor is ten. Storage capacity can be changed according to any number and the program modified to

user specifications.

When the car enters the lift, an LDR connected to a 555 timer detects the car‟s presence

and sends a signal to the RED LED, this lights the LED indicating that the lift is busy. It also sends a

signal to the microcontroller which determines the direction that the motor rotates; it can be clockwise

or anticlockwise. After the RED LED glows the lift will take the person and the car up to the floor where

there is an available parking. When the lift reaches the first floor, the processor compares the filled

amount to that of the already fed capacity of that floor, and if it finds that the first floor is fully filled, it

goes to the second floor and thus the procedure stops here. As soon as a car is placed in a particular

floor, the display counter at the ground floor increments as to indicate the floor capacity has decreased

by one. After the lift takes a car to a particular floor, it comes back to its normal position i.e. the ground

floor and the motor that drives it stops. Now the processor sends a signal to the GREEN LED indicating

that lift is free.

When a person needs to come down from a particular floor to ground floor, he is expected to

focus the headlight onto the LDR (light activated) placed in that floor. Now the sensor section sends

signal to the motor that the lift has to be sent back to that particular floor and sends a signal to light the

RED LED indicating that the lift is busy. As soon as the lift reaches that particular floor, the car should

come inside the lift, the display counter at the ground floor decrements by one as to indicate the floor

capacity has increased by one. Lift comes back to its normal position and that time, the motor that

drives it, also stops. Now the processor sends a signal to light the GREEN LED indicating that lift is

free.

Page 56: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 56

If there no parking is taking place, the processor carries out the job according to the following

priority:-

1. It checks whether any car has been entered into the lift.

2. It checks whether any car headlights are focused in front of the LDR placed in each floor.

This is a round robin system that continually checks for changes in the above states.

5.2 SYSTEM APPLICATIONS

The system is applicable in multistory parking lots that require an efficient and time saving

parking management system.

Thus the system is applicable in many up coming buildings in Kenya.

The system with some modifications can be used in large manufacturing industries to detect

different items on a conveyer belt and move them to different levels.

5.3 PROBLEMS ENCOUNTERED

A number of problems were encountered during the design of the system and implementation.

1. Some of the components were unavailable in the market for some time thus there was a

delay in the completion of the project in the set time.

2. Use of the breadboard in implementing the circuit designed was also disadvantageous

as some of the components were loose fitting.

3. Simulation of the project in the computer was difficult as no program had all the devices.

4. Programming in assembly language has a lot of demerits. It‟s hard to debug and

compile.

5.4 RECOMMENDATIONS

The set objectives were partially met. A lot was learnt in regard to operation of the

microcontroller, transistor circuits, timer circuits and display circuits. The exercise acted as a good

complement to theoretical knowledge acquired in class.

Page 57: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 57

From research the following recommendation are made:

project work should be started early,

the department should avail some components to the students to cut costs while

saving time on delays as students have to import components,

The department should also stock some apparatus e.g. programmers for

microcontrollers, solder suckers,

Industries should be involved in the proposals for the projects thus the projects

will be worthwhile.

Page 58: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 58

CHAPTER SIX

BUDGET ESTIMATE

ITEM QUANTITY KSH/QTY TOTAL

1 MICROCONTROLLER 8051 1 1000 1000

2 8255PPI 2 600 1200

3 2*16 CHARACTER LCD DISPLAY 1 1700 1700

4 MUX 74157 1 200 200

5 7 SEGMENT DISPLAYS 2 150 300

6 LED(red, yellow, green) 9 10 90

7 LDR 3 50 150

8 555 TIMER 3 50 150

9 RESISTORS 28 5 140

10 CAPACITORS 10 20 200

11 STEPPER MOTOR 1 LAB

12 TRANSISTORS 7

700

13 BUZZER 1 250 250

14 CRYSTAL

50 50

15 PRINTING AND INTERNET

2500

16 BREADBOARD 3 300 900

17 CONNECTING WIRES 300 300

18 40 PIN CONNECTOR 1 140

GRAND TOTAL

9830

Page 59: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 59

CHAPTER SEVEN

7.0 TIME PLAN

Activity Duration

Semester I Semester II

Sep Oct Nov Dec Jan Feb Mar Apr

Project proposal

Drawing time plan

Research

Mini presentation

Order of Components

Software & hardware

development

Simulation &

implementation

Documentation

Final presentation

Page 60: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 60

REFERENCES

BOOKS

1. K.J.Ayala, 8051 micro controller architecture, programming and application: Penram International Pub.

2. Jen Axelson, The Micro controller Idea book: Penram International Pub. 3. Myke Predko, Micro controller Basics and projects: Tata Mcgrowhill pub. 4. M A Mazidi, 8051 micro controller and embedded system: Pearson education 5. Scott Mackenzie, The 8051 microcontroller , 2 Edition,1995 6. Manfred Schleicher and Frank Blasinger, Digital Interfaces and Bus Systems for

Communication practical fundamentals,3rd Edition,2001 7. Ronald J.Tocci, Digital System Principles and Application 8. Gakuru Wahome, Kenya Vision 2030 Transforming National Development,2007 9. Edward Hughes, Electrical machines 10. Charles Kinsley ,Electrical machines 11. B.L.Theraja and A.K.Theraja, A Textbook of Electrical Technology 12. F.C Fitchen, Transistor circuit analysis and design 13. Dave Proehnow and D.J Branning, Experiments in CMOS technology

14. Don Lancaster, CMOS Cook book

WEBSITE LINKS

1. http:// www.datasheetarchieves.com 2. http:// www.wikipedia.com\multiplexer 3. http:// www.wikipedia.com\555 timer 4. http:// www.electronics_lab.com 5. http:// www. 8052\ 8051 Tutorial Index.com 6. http:// www.phillips semiconductors\80c51 family programmers guide and instruction

set.html 7. http:// www.phillips semiconductors\80c51 family hardware.html 8. http:// www.phillips semiconductors\80c51 family architecture.html 9. Programming the 8255 PPI chip[online document],[cited 2006,15th September], 10. Http://www.boondog.com/tutorial/dlltutor/8255.com 11. http://en.wikipedia.org/ 12. http://www.servicemagic.com/ 13. http://home.howstuffworks.com/ 14. http://www.boondog.com/ 15. http://www.codeproject.com/ 16. http://www.zycon.com/ 17. http://zone.ni.com/ 18. http://www.ozitronics.com/

Page 61: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 61

APPENDIX A

TERMS AND ACRONYMS

1. MICROBVPS: Microcontroller Based Vehicle Parking System

2. NCBD: Nairobi Central Business District

3. CCTV : Closed Circuit Television

4. MCU : Microcontroller Unit

5. LDR :Light Dependent Resistor

6. LCD :Light Crystal Display

7. PPI :Programmable Peripheral Interface

8. AT89C51 : Atmega 89c51 microcontroller

9. MUX: Multiplexer

10. LED: Light Emitting Diode

11. ROM: Read Only Memory

12. RAM: Random Access Memory

13. CPU: Central Processing Unit

14. ALU :Arithmetic and Logic Unit

15. RPM: Rotations Per Minute

16. 555 :555 Timer

17. 8255 : 8255 programmable peripheral interface

Page 62: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 62

APPENDIX B LIST OF FIGURES

1. Fig1.1.Adiagonal Parking In Nairobi 2. Fig 1.2. Multi Storey Parking Using Ramp (A Microbvps To Be Installed) 3. Fig 1.3: Parking Lot Layout With Angle Parking As Seen From Above 4. Fig 3.1: Block Diagram Showing The Usual Cpu Components, Program Counter, Alu, Working Registers,

And The Clock Circuits. 5. Fig 3.2 8255 Functional Block Diagram 6. Fig 3.3: Darkness Activated Ldr 7. Fig 3.4: Light Activated Ldr 8. Fig 3.5 The Monostable Input And Output Waveform 9. Fig 3.6 The 555 Monostable Circuit 10. Fig 3.7 Varying The Time Period With A Variable Resistor 11. Fig 3.8 Pin Configuration Of A Seven Segment Display: 12. Fig 3.9 Circuit Diagram For Common Anode 7-Segment Display 13. Fig3.10: Circuit Diagram For Common Cathode 7-Segment Display Interfaced To 8951 14. Fig.3.11: 2 Line X 16 Character Lcd Display 15. Fig 3.12 Description Of Rotation Of A Stepper Motor 16. Fig 3.13.Step Rotation A Stepper Motor 17. Figure 4.1. Block Diagram Of Microcontroller Based Vehicle Parking System 18. Fig 4.2 Project Block Diagram 19. Fig 4.3:Seven Segment Connection To The 8255ppi 20. Fig 4.4: Lift Sensor 21. Fig 4.5 : Motor Interface To The 8255ppi 22. Fig 4.6: Floor Sensor

LIST OF TABLES TABLE

1. Table 3.1: Control Signals Of The 8255ppi 2. Table 3.2: 555 Timer Pin Description Table 3. Table 3.3: For Common Cathode (The Seven Segment Requirement Pattern To Display The

Hex Number, With The Seven Segment Conversion) 4. Table 3.4: For Common Anode (The Seven Segment Requirement Pattern To Display The Hex

Number, With The Seven Segment Conversion) 5. Table 3.5: Pin Description Of Lcd Display 6. Table 3.6: List Of Lcd Display Instruction Command Codes. 7. Table 3.7 : Comparison Of Motor Types 8. Table 3.8:Pulses For Stepper Motor Module 9. Table 3.9 Multiplexer Pin Description

(MICROBVPS

Page 63: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 63

APPENDIX B:

MAIN MICROCONTROLLER PROGRAM:

; JOMO KENYATTA UNIVERSITY OF AGRICULTURE AND TECHNOLOGY

; FACULTY OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING ; EEE 2501: FINAL YEAR PROJECT REPORT

; MICROCONTROLLER BASED VEHICLE PARKING SYSTEM TITLE:

; AUTHOR GEORGE NGUGI KIBIA

; REG NUMBER E26-0668/03

; DATE 25/03/2009

ORG 0000H mov r0,#19h

mov @r0,#0bfh inc r0 mov @r0,#86h inc r0 mov @r0,#0dbh inc r0 mov @r0,#0cfh inc r0 mov @r0,#0e6hinc r0 ; Storing the equivalent codes of common cathode display. mov @r0,#0edh ; inc r0 mov @r0,#fdh inc r0 mov @r0,#87h inc r0 mov @r0,#0ffh inc r0 mov @r0,#0e7h inc r0 mov @r0,#39h inc r0 mov @r0,#00h mov r0,#25h ; Storing the equivalent codes of common anode. mov @r0,#40h inc r0 mov @r0,#0f9h inc r0 mov @r0,#24h inc r0 mov @r0,#30h inc r0 mov @r0,#99h inc r0 mov @r0,#12h inc r0 mov @r0,#02h inc r0 mov @r0,#78h

inc r0 mov @r0,#00h inc r0 mov @r0,#18h inc r0 mov @r0,#0eh mov r0,#45h ; Storing ten 4 digit passwords in common anode. mov @r0,#00h inc r0 mov @r0,#01h inc r0 mov @r0,#02h inc r0 mov @r0,#03h inc r0 mov @r0,#08h inc r0 mov @r0,#00 inc r0 mov @r0,#05h inc r0 mov @r0,#01h inc r0 mov @r0,#01h inc r0 mov @r0,#00 inc r0 mov @r0,#00 inc r0 mov @r0,#01h inc r0 mov @r0,#06h inc r0 mov @r0,#00 inc r0 mov @r0,#05h inc r0 mov @r0,#00 inc r0 mov @r0,#09h inc r0 mov @r0,#08h inc r0

Page 64: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 64

mov @r0,#08h inc r0 mov @r0,#06h inc r0 mov @r0,#03h inc r0 mov @r0,#01h inc r0 mov @r0,#01h inc r0 mov @r0,#07h mov a,#08 STORE: dec a inc r0 mov @r0,a inc r0 movx @r0,a inc r0 movx @r0,a inc r0 movx @r0,a djnz a,STORE ******************************************************************** mov dptr,#2023h ; Configuring two 8255 ports. mov a,#81h movx @dptr,a mov dptr,#2043h mov a,#80h movx @dptr,a mov r3,#00 ; Clears the display. mov r4,#00 mov r5,#00 mov a,r5 call LED_CODES mov dptr,#2040h movx @dptr,a inc dptr movx @dptr,a inc dptr movx @dptr,a mov dptr,#2022h mov a,#30h movx @dptr,a mov sp,#11h call lcdwel ; Calling LCD display subroutine. REPEAT: clr psw.3 clr psw.4 mov dptr,#2022h movx a,@dptr cjne a,#31h,DONE ; Comparing whether car is inside the lift. mov a,#0ah xrl a,r4

jz SIREN ; Call SIREN if second floor is full. call lcdbusy mov a,#10h movx @dptr,a ; send lift is busy signal. call DELAY mov r7,#02 ; number of rotations to motor so that lift goes to first floor. mov r6,#02h

call MOTOR_UP ; Call motor to rotate clockwise.

mov a,#0ah xrl a,r3 jz I_FULL ; If first floor is full then jump to I_FULL inc r3 call DELAY mov a,r3 ; Increment the number of car in first floor and display the number of cars. call LED_CODES mov dptr,#2042h movx @dptr,a mov r7,#02h ; Again load the number of rotations to motor mov r6,#02h call MOTOR_DOWN ; Call motor to rotate anticlockwise. mov dptr,#2022h mov a,#30h movx @dptr,a ; send lift is free signal. call lcdwel sjmp DONE I_FULL: mov r7,#02h ;number of rotations to motor so that lift goes to second floor. mov r6,#02h call MOTOR_UP ; Call motor to rotate clockwise. inc r4 call DELAY mov a,r4 ; Increment the number of car in second floor. call LED_CODES ; Display the number of cars. mov dptr,#2041h movx @dptr,a mov r7,#04h ;Again load the number of rotations to motor. mov r6,#02h call MOTOR_DOWN ; Call motor to rotate anticlockwise. mov dptr,#2022h mov a,#30h

Page 65: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 65

movx @dptr,a ; send lift is free signal. call lcdwel jmp DONE SIREN: mov a,#70h ; Subroutine for SIREN. movx @dptr,a GO: movx a,@dptr jb a.0,GO jmp OVER1 DONE: movx a,@dptr ; Compare if start button of the keyboard is pressed. cjne a,#33h,OVER1 mov a,#0ah xrl a,r5 jz SIREN ; Call SIREN if third floor is full. mov a,#00 movx @dptr,a call lcdbusy setb psw.3 CLEAR: mov r1,#0ah ; Scanning entered password from keyboard mov r0,#04h START: mov dptr,#2020h mov a,#0eh movx @dptr,a WAIT: mov dptr,#2022h movx a,@dptr mov r7,#00 xrl a,r7 jz WAIT mov a,#02 LOOP: mov r6,a mov dptr,#2020h movx @dptr,a mov dptr,#2022h movx a,@dptr jnz COLSCAN inc r7 mov a,r6 rl a jmp LOOP COLSCAN: rrc a jc DONE1 inc r7 inc r7 inc r7 sjmp COLSCAN OVER1: jmp OVER DONE1: mov a,r7 clr psw.3 setb psw.4 mov r0,#19h

add a,r0 mov r0,a mov a,@r0 clr psw.4 setb psw.3 mov dptr,#2021h movx @dptr,a inc dptr UP: movx a,@dptr jnz UP mov a,#0ah xrl a,r7 jz CLEAR mov a,#0bh xrl a,r7 jz BIT_CLEAR mov a,r7 mov @r1,a ; Store each digit entered. inc r1 mov r7,#0ffh HEAR: djnz r7,HEAR mov r7,#0ffh HEAR1: djnz r7,HEAR1 djnz r0,START

mov r7,#0ah ;Checking whether entered 4 digit password is any one of the stored password.

mov r0,#45h CHECK: mov r1,#0ah mov r6,#03h CHECK1:mov a,@r0 xrl a,@r1 jnz NEXT inc r1 inc r0 djnz r6,CHECK1 mov dptr,#2022h mov a,#90h movx @dptr,a clr psw.3 jmp OK ; Jump to OK if password is correct. NEXT: inc r0 djnz r6,NEXT inc r0 djnz r7,CHECK mov dptr,#2022h mov a,#50h movx @dptr,a AGAIN: movx a,@dptr cjne a,#53h,AGAIN clr psw.3 mov a,#30h ;Give SIREN if entered password is wrong. movx @dptr,a REMAIN: movx a,@dptr

Page 66: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 66

xrl a,#33h jz REMAIN mov r0,#0ffh STAY: djnz r0,STAY call lcdwel jmp OVER LED_CODES:setb psw.4 mov r0,#25h add a,r0 mov r0,a mov a,@r0 clr psw.4 ret BIT_CLEAR: dec r1 inc r0 mov r6,#0ffh HEAR2: djnz r6,HEAR2 mov r6,#0ffh HEAR3: djnz r6,HEAR3 jmp START OK: movx a,@dptr cjne a,#91h,OK mov a,#10h movx @dptr,a mov a,#00 mov dptr,#2021h movx @dptr,a call DELAY mov r7,#06h ; number of rotations to motor so that lift goes to third floor. mov r6,#02h call MOTOR_UP ; Call motor to rotate clockwise. inc r5 ;Increment the number of car entered to third floor and display the number of cars. call DELAY mov a,r5 call LED_CODES mov dptr,#2040h movx @dptr,a mov r7,#06h mov r6,#02h call MOTOR_DOWN ; Call motor to rotate anticlockwise. call lcdwel jmp OVER MOTOR_UP:push r5 ;Subroutine for motor to rotate clockwise. mov r5,#70h mov r0,r6 mov dptr,#2020h

mov a,#88h h3: movx @dptr,a rl a mov r2,#30 h1: mov r1,#255 h2: djnz r1,h2 djnz r2,h1 djnz r5,h3 mov r5,#0ffh djnz r6,h3 mov r6,r0 djnz r7,h3 pop r5 ret MOTOR_DOWN:push r5 ;Subroutine for motor to rotate anticlockwise. mov r5,#70h mov r0,r6 mov dptr,#2020h mov a,#88h h6: movx @dptr,a rr a mov r2,#30 h4: mov r1,#255 h5: djnz r1,h5 djnz r2,h4 djnz r5,h6 mov r5,#0ffh djnz r6,h6 mov r6,r0 djnz r7,h6 pop r5 ret DELAY: mov r1,#10h ; Subroutine for Delay DELAY1: mov r2,#0ffh DELAY2: mov r0,#0ffh DELAY3: djnz r0,DELAY3 djnz r2,DELAY2 djnz r1,DELAY1 ret OVER: mov dptr,#2022h mov a,#30h movx @dptr,a movx a,@dptr cjne a,#32h,I_OVER mov a,#10h movx @dptr,a call lcdbusy mov r7,#02h mov r6,#02h call MOTOR_UP ; Call motor to rotate clockwise. dec r3 ; Decrements the number of cars entered to first floor and display

Page 67: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 67

the number of cars in first floor. mov a,r3 call LED_CODES mov dptr,#2042h movx @dptr,a call DELAY mov r7,#02h mov r6,#02h call MOTOR_DOWN ; Call motor to rotate anticlockwise. mov dptr,#2022h mov a,#30h movx @dptr,a call lcdwel I_OVER: movx a,@dptr cjne a,#34h,II_OVER mov a,#10h movx @dptr,a call lcdbusy mov r7,#04h mov r6,#02h call MOTER_UP ; Call motor to rotate clockwise. dec r4 ; Decrements the number of cars entered to second floor and display the number of cars in second floor. mov a,r4 call LED_CODES mov dptr,#2041h movx @dptr,a call DELAY mov r7,#04h mov r6,#02h call MOTOR_DOWN ; Call motor to rotate clockwise. mov dptr,#2022h mov a,#30h movx @dptr,a call lcdwel II_OVER: movx a,@dptr cjne a,#38h,END mov a,#10h movx @dptr,a call lcdbusy mov r7,#06h mov r6,#02h call MOTOR_UP ; Call motor to rotate clockwise. dec r5 ; Decrements the number of cars entered to third floor and display the number of cars in third floor.

mov a,r5 call LED_CODES mov dptr,#2040h movx @dptr,a

call DELAY mov r7,#06h mov r6,#02h call MOTOR_DOWN ; Call motor to rotate anticlockwise. mov dptr,#2022h mov a,#30h movx @dptr,a call lcdwel END: jmp REPEAT lcdwel: push r3 ; Subroutine for LCD to display push r4 „ WELCOME TO CAR PARKING SYSTEM ‟ mov a,#3ch call command mov a,#0eh call command mov a,#01h call command mov a,#06h call command mov a,#80h call command mov a,#'W' call data mov a,#'E' call data mov a,#'L' call data mov a,#'C' call data mov a,#'O' call data mov a,#'M' call data mov a,#'E' call data mov a,#' ' call data mov a,#88h call command mov a,#'T' call data mov a,#'O' call data mov a,#' ' call data mov a,#'C' call data mov a,#'A' call data1 mov a,#'R' call data mov a,#aah call command mov a,#'P'

Page 68: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 68

call data mov a,#'A' call data mov a,#'R' call data mov a,#'K' call data mov a,#'I' call data mov a,#'N' call data mov a,#'G' call data mov a,#' ' call data mov a,#'S' call data mov a,#'Y' call data mov a,#'S' call data mov a,#'T' call data mov a,#'E' call data mov a,#'M' call data pop r4 pop r3 ret command: mov p1,a clr p3.4 setb p3.3 clr p3.3 mov r3,#50 A: mov r4,#255 R: djnz r4,R djnz r3,A ret data: mov p1,a setb p3.4 setb p3.3 clr p3.3 mov r3,#50 AAA: mov r4,#255 AA: djnz r4,AA djnz r3,AAA ret lcdbusy: push r4 ; Subroutine for LCD to display „ LIFT IS BUSY PLEASE WAIT ‟ push r3 mov a,#3ch call command mov a,#0eh call command

mov a,#01h call command mov a,#06h call command mov a,#80h call command mov a,#'L' call data mov a,#'I' call data mov a,#'F' call data mov a,#'T' call data mov a,#' ' call data mov a,#' ' call data mov a,#'I' call data mov a,#'S' call data mov a,#88h call command mov a,#' ' call data mov a,#' ' call data mov a,#'B' call data mov a,#'U' call data mov a,#'S' call data mov a,#'Y' call data mov a,#aah call command mov a,#'P' call data mov a,#'L' call data mov a,#'E' call data mov a,#'A' call data mov a,#'S' call data mov a,#'E' call data mov a,#' ' call data mov a,#'W' call data mov a,#'A' call data mov a,#'I' call data

Page 69: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 69

mov a,#'T' call data mov a,#' ' call data pop r3 pop r4 ret

MICRO CONTROLLER BASED VEHICLE PARKING

SYSTEM

Page 70: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 70

APPENDIX D

PIN CONFIGURATION

APPENDIX D.1 AT89C51 IC

APPENDIX D.2 555 TIMER

APPENDIX D.3 74157 QUAD 2-1 MUX

APPENDIX D.4 8255 PPI

Page 71: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 71

APPENDIX D.5 LIGHT DEPENDENT RESISTOR (LDR)

Page 72: project

MICROCONTROLLER BASED VEHICLE PARKING SYSTEM (MICROBVPS) 2009

George N Kibia E26-0668/03 Page 71

APPENDIX E: PROJECT CIRCUIT DIAGRAM

PC(10..13)

PB

(18.

.25)

D(0..7)A(8

..15)

D7 D

0

D1

D2

D3

D4D

5

D6

A15 A

11

A8A

9

A10

A12

A13A

14

PC

10

PC

13

PC

12

PC

11

PB

0

PB

1

PB

2

PB

3

PB

4

PB

5

PB

6

PB

7

XTA

L218

XTA

L119

ALE

30E

A31

PS

EN

29

RS

T9

P0.

0/A

D0

39P

0.1/

AD

138

P0.

2/A

D2

37P

0.3/

AD

336

P0.

4/A

D4

35P

0.5/

AD

534

P0.

6/A

D6

33P

0.7/

AD

732

P1.

01

P1.

12

P1.

23

P1.

34

P1.

45

P1.

56

P1.

67

P1.

78

P3.

0/R

XD

10P

3.1/

TXD

11P

3.2/

INT0

12P

3.3/

INT1

13P

3.4/

T014

P3.

7/R

D17

P3.

6/W

R16

P3.

5/T1

15

P2.

7/A

1528

P2.

0/A

821

P2.

1/A

922

P2.

2/A

1023

P2.

3/A

1124

P2.

4/A

1225

P2.

5/A

1326

P2.

6/A

1427

U1AT89C51

GND=-5V

VCC=+5V

D0

34D

133

D2

32D

331

D4

30D

529

D6

28D

727

RD

5W

R36

A0

9A

18

RE

SE

T35

CS

6

PA

04

PA

13

PA

22

PA

31

PA

440

PA

539

PA

638

PA

737

PB

018

PB

119

PB

220

PB

321

PB

422

PB

523

PB

624

PB

725

PC

014

PC

115

PC

216

PC

317

PC

413

PC

512

PC

611

PC

710

U28255A

GND=-5V

VCC=+5V

D0

34D

133

D2

32D

331

D4

30D

529

D6

28D

727

RD

5W

R36

A0

9A

18

RE

SE

T35

CS

6

PA

04

PA

13

PA

22

PA

31

PA

440

PA

539

PA

638

PA

737

PB

018

PB

119

PB

220

PB

321

PB

422

PB

523

PB

624

PB

725

PC

014

PC

115

PC

216

PC

317

PC

413

PC

512

PC

611

PC

710

U38255A

GND=-5V

VCC=+5V

+88.8

X2CRYSTAL

D7

14

D6

13

D5

12

D4

11

D3

10

D2

9

D1

8

D0

7

E6

RW5

RS

4

VS

S1

VD

D2

VE

E3

LCD1LM016L

A1

E7

B13

C10

D8

+V2

3

F2

G11

+V1

14

DP

16

U4HP-5082-7610

A1

E7

B13

C10

D8

+V2

3

F2

G11

+V1

14

DP

16

U5HP-5082-7610

1A2

1Y4

1B3

2A5

2Y7

2B6

3A11

3Y9

3B10

4A14

4Y12

4B13

A/B

1

E15

U674157

GND=-5V

VCC=+5V

+5v

D1

LED-GREEN

D2

LED-GREEN

D3

LED-GREEN

D4

LED-RED

+5v