You are on page 1of 76

8

ABSTRACT

The aim of this project is to atomize the car park for allowing the cars into the park. LCD is
provided to display the information about the total number of cars that can be parked and the place
free for parking. Two IR TX RX pairs are used in this project to identify the entry or exit of the
cars into/out of park. These two IR TX RX pairs are arranged either side of the gate. The TX and
RX are arranged face to face across the road so that the RX should get IR signal continuously.

















9
CHAPTER 1
INTRODUCTION TO EMBEDDED SYSTEMS
An embedded system is a special-purpose computer system designed to perform one or a few
dedicated functions, often with real-time computing constraints. It is usually embedded as part of a
complete device including hardware and mechanical parts. In contrast, a general-purpose computer,
such as a personal computer, can do many different tasks depending on programming. Embedded
systems control many of the common devices in use today .Since the embedded system is dedicated
to specific tasks, design engineers can optimize it, reducing the size and cost of the product, or
increasing the reliability and performance. Some embedded systems are mass-produced, benefiting
from economies of scale.
Physically, embedded systems range from portable devices such as digital watches and MP3
players, to large stationary installations like traffic lights, factory controllers, or the systems
controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to
very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure.
In general, "embedded system" is not an exactly defined term, as many systems have some
element of programmability. For example, Handheld computers share some elements with
embedded systems such as the operating systems and microprocessors which power them but
are not truly embedded systems, because they allow different applications to be loaded and
peripherals to be connected. Embedded systems span all aspects of modern life and there are many
examples of their use. Telecommunications systems employ numerous embedded systems from
telephone switches for the network to mobile phones at the end-user. Computer networking uses
dedicated routers and network bridges to route data.
Characteristics:
1. Embedded systems are designed to do some specific task, rather than be a general-purpose
computer for multiple tasks. Some also have real-time performance constraints that must be

10
met, for reasons such as safety and usability; others may have low or no performance
requirements, allowing the system hardware to be simplified to reduce costs.
2. Embedded systems are not always standalone devices. Many embedded systems consist of
small, computerized parts within a larger device that serves a more general purpose. For
example, the Gibson Robot Guitar features an embedded system for tuning the strings, but
the overall purpose of the Robot Guitar is, of course, to play music. Similarly, an embedded
system in an automobile provides a specific function as a subsystem of the car itself.
3. The software written for embedded systems is often called firmware, and is usually stored in
read-only memory or Flash memory chips rather than a disk drive. It often runs with limited
computer hardware resources: small or no keyboard, screen, and little memory.
CPU platforms:
Embedded processors can be broken into two broad categories: ordinary microprocessors
(P) and microcontrollers (C), which have many more peripherals on chip, reducing cost and size.
Contrasting to the personal computer and server markets, a fairly large number of basic CPU
architectures are used; there are Von Neumann as well as various degrees of Harvard architectures,
RISC as well as non-RISC and VLIW; word lengths vary from 4-bit to 64-bits and beyond (mainly
in DSP processors) although the most typical remain 8/16-bit. Most architectures come in a large
number of different variants and shapes, many of which are also manufactured by several different
companies.
ASIC and FPGA solutions:
A common configuration for very-high-volume embedded systems is the system on a chip
(SoC), an application-specific integrated circuit (ASIC), for which the CPU core was purchased and
added as part of the chip design. A related scheme is to use a field-programmable gate array
(FPGA), and program it with all the logic, including the CPU.
Peripherals:
Embedded Systems talk with the outside world via peripherals, such as

11
Serial Communication Interfaces (SCI): RS-232, RS-422, RS-485 etc
Synchronous Serial Communication Interface: I2C, JTAG, SPI, SSC and ESSI
Universal Serial Bus (USB)
Networks: Ethernet, Controller Area Network, LAN networks, etc
Timers: PLL(s), Capture/Compare and Time Processing Units
Discrete IO: aka General Purpose Input/output (GPIO)
Analog to Digital/Digital to Analog (ADC/DAC)
Tools: As for
other software, embedded system designers use compilers, assemblers, and debuggers to develop
embedded system software. However, they may also use some more specific tools:
In circuit debuggers or emulators
Utilities to add a checksum or CRC to a program, so the embedded system can check if the
program is valid.
For systems using digital signal processing, developers may use a math workbench such as
MATLAB, Simulink, MathCad, or Mathematica to simulate the mathematics. They might
also use libraries for both the host and target which eliminates developing DSP routines as
done in DSPnano RTOS and Unison Operating System.
Custom compilers and linkers may be used to improve optimization for the particular
hardware.
An embedded system may have its own special language or design tool, or add
enhancements to an existing language such as Forth or Basic.
Another alternative is to add a Real-time operating system or Embedded operating system,
which may have DSP capabilities like DSP nano RTOS.

Software tools can come from several sources:
Software companies that specialize in the embedded market
Ported from the GNU software development tools

12
Sometimes, development tools for a personal computer can be used if the embedded
processor is a close relative to a common PC processor
As the complexity of embedded systems grows, higher level tools and operating systems are
migrating into machinery where it makes sense. For example, cell phones, personal digital assistants
and other consumer computers often need significant software that is purchased or provided by a
person other than the manufacturer of the electronics. In these systems, an open programming
environment such as Linux, NetBSD, OSGi or Embedded Java is required so that the third-party
software provider can sell to a large market.














13
CHAPTER 2
OVERVIEW OF ADVANCED CAR PARKING SYSTEM

2.1 INTRODUCTION
Now days in many multiplex systems there is a severe problem for car parking systems.
There are many lanes for car parking, so to park a car one has to look for the all lanes. Moreover
there is a lot of men labor involved for this process for which there is lot of investment. So the need
is to develop a system which indicates directly which parking slot is vacant in any lane. The project
involves a system including infrared transmitter and receiver in every lane and a LED & LCD
display outside the car parking gate. So the person entering parking area can view the LED display
and can decide which lane to enter so as to park the car.
Conventionally, car parking systems does not have any intelligent monitoring system.
Parking lots are monitored by human beings. All vehicles enter into the parking and waste time for
searching for parking slot. Sometimes it creates blockage. Condition become worse when there are
multiple parking lanes and each lane have multiple parking slots. Use of automated system for car
parking monitoring will reduce the human efforts. Display unit is installed on entrance of parking lot
which will show LEDs for all Parking slot and for all parking lanes. Empty slot is indicated by the
respective glowing LED.

2.2 BLOCK DIAGRAM


14

2.3 DESCRIPTION

Whenever the mains are switched on, the LCD displays the message parking space for 2
vehicles. The number indicates the maximum capacity of park in this project. Whenever a car
comes in front of the gate, the IR signal gets disturbed and the microcontroller will open the gate by
rotating the stepper motor. The gate will be closed only after the car leaves the second IR pair since
the microcontroller should know whether the car left the gate or not. Now the microcontroller
decrements the value of the count and displays it on LCD. In this way, the microcontroller
decrements the count whenever the car leaves the park and displays it on LCD.
If the count reaches 0, i.e. if the park is completely filled, the microcontroller will display
NO SPACE FOR PARKING on LCD. And now if any vehicle tries to enter the park, the gate will
not be opened since there is no space. If any vehicle leaves the park, the controller will increment
the count and allows the other vehicles for parking.

2.4 APPLICATIONS

1. Shopping malls
2. Railway / Bus stations

AT89S52
Micro
Controller
Power
Supply
0
20
40
60
80
100
1st Qtr 2nd Qtr 3rd Qtr 4th Qtr
East
West
North

LCD
IR Tx-1

DC
motor

Driver
circuit
IR Tx-2

IR Tx-n

Led
indicators

15
2.5 ADVANTAGES
3. Avoid manual work
4. accurate
5. low cost
6. time saving










16






CHAPTER 3
AT89S52 MICROCONTROLLER

3.1 AT89S52 MICROCONTROLLER:
The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer with 4 Kbytes
of Flash Programmable and Erasable Read Only Memory (PEROM). The device is manufactured
using Atmels high-density non-volatile 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 non-volatile memory programmer. By combining a
versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89S52 is a powerful
microcomputer, which provides a highly flexible and cost effective solution to many embedded
control applications.

3.1.1 FEATURES OF MICROCONTROLLER:

Compatible with MCS-51TM Products
8 Kbytes of In-System Reprogram able Flash Memory- Endurance: 1,00Write/Erase Cycles
Fully Static Operation: 0 Hz to 24 MHz
Three-Level Program Memory Lock

17
256 x 8-Bit Internal RAM
32 Programmable I/O Lines
Three 16-Bit Timer/Counters
Eight Interrupt Sources
Programmable Serial Channel
Low Power Idle and Power Down Modes


3.2 PIN CONFIGURATION :


18




Figure 3.1 pin configuration of AT89S52 microcontroller

3.2.1 LOGIC SYMBOL:

19

Figure 3.2 logic symbol of AT89S52
3.3 MEMORY ORGANIZATION:
The 89C52 micro controller has separate address for program memory and data memory.
The logical separation of program and data memory allows the data memory to be accessed by 8-bit
address, which can be quickly stored and manipulated by an 8-bit CPU. Nevertheless, 16-bit data
memory address can also be generated through the DPTR register. Program memory (ROM,
EPROM) can only be read, not written to. There can be up to 64k bytes if program memory the
lowest 4k bytes of program are on chip. In the ROM less versions, all program memory is external.
The read strobe for external program is the PSEN (program store enable). Data memory (RAM)
occupies a separate address space from program memory the lowest 128 bytes of data memory are
on chip. Up to 64 bytes of external RAM can be addressed in the external data memory space. In the
ROM less version, the lowest 128bytes of data memory are on chip. The CPU generates read and
write signals, RD and WR, as needed during external data memory access.
External program memory may be combined if desired by applying the RD and PSEN
signals to the inputs of an AND gate and using the output of the gate as the read strobe to the
external program/data memory.

20
3.3.1 DATA MEMORY:

FF FFFF


80 AND
7F
B B0000
SFRS DIRECT
ADDRESSING ONLY
DIRECT ADDRESSING
ONLY
64K BYTES
EXTERNAL

21
3.3.2 PROGRAM MEMORY:
FFFF FFFF



1000

FFF



0000 0000
The 128 byte of RAM are divided into 3 segments
a). Register banks 0 3 (00 1FH)
b). Bit addressable area (20H 2FH)
c). Scratch pad area (30H 7FH)
If the SP is initialized to this area enough bytes should be left aside to prevent
SP data destruction.
3.4 SPECIAL FUNCTION REGISTERS:
3.4.1 A & B REGISTERS:
They are used during math and logically operations. The register A is also
used for all data transfers between the micro controller and memory. The B register is
used during multiplication and divided operations. For other instructions it can be
treated as another scratch pad register.
60k Bytes
External
4k Bytes
Internal
64k

Bytes

External

22
3.4.2 PSW (PROGRAM STATUS WORD):
It contains math flags; user flags F0 and register select bits RS1 and
RS0 to determine the working register bank.
3.4.3 STACK AND STACK POINTER:
Stack is used to hold and retrieve data quickly. The 8 bit SP is incremented
before data is stored during PUSH and CALL executions. While the stack may reside
any where in on-chip RAM, the SP is initialized to 07H after the stack to begin at
manipulated as a 16 bit register or as two independent 8 bit registers.
3.4.4 PC (PROGRAM COUNTER):
It addresses the memory locations that program instructions are to be fetched.
It is the only register that does not have any internal address.
3.4.4 FLAGS:
They are 1bit register provided to store the results of certain program
instructions. Other instructions can test the conditions of the flags and make the
decisions accordingly. To conveniently address, they are grouped inside the PSW and
PCON.
The micro controller has 4 main flags: carry(c), auxiliary carry (AC), over
flow (OV), parity (P) and 3 general-purpose flagsF0, GF0 and GF1.


3.4.5 PORTS
All ports are bi-directional; each consists of a latch, an output driver and an
input buffer. P0, P1, P2 and P3 are the SFR latches ports 0, 1, 2 and 3 respectively.
The main functions of each port are mentioned below.
Port0: input/output bus port, address output port and data input/output port.
Port1: Quasi-bi-directional input/output port.
Port2: Quasi-bi-directional input/output port and address output port.

23
Port3: Quasi-bi-directional input/output port and control input/output pin.
3.4.6 SBUF (SERIAL BUFFER):
The microcontroller has serial transmission circuit that uses SBUF register to
hold data. It is actually two separate registers, a transmit buffer and a receive buffer
register. When data is moved to SBUF, it goes to transmit buffer, where it is held for
serial transmission and when it is moved from SBUF, it comes from the receive
buffer.
3.5 TIMER REGISTER:
Register pairs (TH0, TL1), (TH1, TL1) are the 16-bit counter registers for
timer/counters 0 and 1.
3.5.1 CONTROL REGISTERS:
SFRs, IP, TMOD, SCON, and PCON contain control and status bits for the
interrupt system, Timers/counters and the serial port.
3.5.2 OSCILLATOR AND CLOCK CIRCUIT:
This circuit generates the clock pulses by which all internal operations are
synchronized. For the microcontroller to yield standard baud rates, the crystal
frequency is chosen as 11.059MHz.
3.5.3 RESET:
The reset switch is the RST pin of the microcontroller, which is the input to a
Schmitt trigger. It is accomplished by holding the RST pin HIGH for at least two
machine cycles while the oscillator frequency is running the CPU responds by
generating an internal reset.
3.5.4 TIMERS/COUNTERS:
A micro controller has two 16- bit Timer/Counter register T0 and T1
configured to operate either as timers or event counters. There are no restrictions on
the duty cycle of the external input signal, but it should be for at least one full
machine to ensure that a given level is sampled at least once before it changes. Timers
0 and 1 have four operating modes: 13-bit mode, 16 bit mode, 8 bit auto-reload
mode. Control bits C/t in TMOD SFR select the timer or counter function.
MODE 0: Both
timers in MODE0 are counters with a divide by 32 pre-scalar. The timer register
is configured as a 13 bit register with all 8 bits of TH1 and the lower 5-bit of

24
TL1.The upper 3 bits of TL1 are in determinate and should be ignored. Setting the
run flags (TR1) doesnt clear the register or the registers.
MODE 1:
Mode 1 is same as mode 0, except that the timer register is run with all 16
bits. The clock is applied to the combined high and low timer registers. An overflow
occurs on the overflow flag. The timer continues to count.
MODE 2:
This mode configures the timer register as an 8 bit counter (TL1/0) with
automatic reload. Overflow from TL1/0 not only sets TF1/0, but also reloads TL1/0
with the contents of TH1/0, which is preset by software. The reload leaves
unchanged.
MODE 3:
Mode 3 is used for application that requires an extra 8 bit timer or counter.
Timer 1 in mode 3 simply holds its count. The effect is same as setting TR0. Timer 0
its mode 3 establishes TL0 and TL1 as two separate counters. TL0 uses the timer0
control bits C/T, GATE, TR0, INT0 and TF0. TH0 is locked into a timer function and
over the use of TR1 and TR2 from timer 1. Thus TH0 controls the timer 1 interrupts.

3.6 INTERRUPTS:
The micro controller provides 6 interrupt sources, 2
external interrupts, 2 timer interrupts and a serial port interrupt and a reset. The
external interrupts (INT0 & INT1) can each be either level activated or transition
activated depending on bits IT0 and IT1 in register TCON. The flags that actually
generate these interrupts are IE0 & IE1 bits in TCON.
TF0 and TF1 generate the timer 0 & 1 interrupts, which are set by a roll over
in their respective timer/counter registers. When a timer interrupt is generated the on-
chip hardware clears the flag that generated it when the service routine is vectored to.
The serial
port interrupt is generated by logical OR of R1 & T1. Neither of these flags is cleared
by hardware when service routine is vectored to. In fact, the service routine itself

25
determines whether R1 & T1 generated the interrupt, and the bit is cleared in the
software.
Upon reset, all interrupts are disabled, meaning that none will be responded to
by the micro controller if they are activated. The interrupts must be enabled by
software in order for the micro controller to respond to them.
3.7 SERIAL INTERFACE:
The serial port is full duplex, i.e. it can transmit and receive simultaneously. It
is also receive buffered which implies it can begin receiving a second byte before a
previously byte has been read from the receive register. The serial port receives and
transmits register and reading SBUF accesses a physically separate receive register.
This serial interface had four modes of operation:
MODE 0:
In this mode of operation the serial data enters and exists through RXD.TXD
outputs the shift clock. Eight data bits are transmitted/ received, with the LSB first,
the baud rate is fixed at 1/12 of the oscillator frequency. Reception is initialized by
the condition RI-0 and REN=1.
3.8 BAUDRATE CALCULATIONS:
Baud rate in mode 0 is fixed.
Mode 0 baud rate=oscillator frequency/12
(1 machine cycle=12 clock. cycles)
The baud rate in mode 2 depends on the value of SMOD bit in PCON
Register.
SMOD=0, baud rate= (1/64) x oscillator frequency.
SMOD=1baud rate= (1/32) oscillator frequency.
I.e. mode 2 baud rate= [2(POW) SMOD/64)] x oscillator frequency.
In the modes 1 and 3, timer 1 over flow rate and the value of SMOD
determines the baud rate. Baud rate of mode 1 and 3 = [(2(POW) SMOD/32)]
x timer 1 over flow rate.
The timer 1 interrupt should be disabled in this application.
3.9 PROGRAM MEMORY LOCK BITS:
On the chip are three lock bits, which can be left un-programmed (u)
or can be programmed (p) to obtain the additional features listed in the table below.

26
When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched
during reset.

If the device is powered up with out a reset, the latch initializes to a random
value, and holds that value until reset is activated. It is necessary sthat the latched
value of EA be in agreement with the current logic level at that pin in order for the
device to function properly.














27
CHAPTER 4
IMPLEMENTATION OF HARDWARE

4.1 LCD (Liquid Cristal Display)
Introduction:
A liquid crystal display (LCD) is a thin, flat display device made up of any
number of color or monochrome pixels arrayed in front of a light source or reflector.
Each pixel consists of a column of liquid crystal molecules suspended between two
transparent electrodes, and two polarizing filters, the axes of polarity of which are
perpendicular to each other. Without the liquid crystals between them, light passing
through one would be blocked by the other. The liquid crystal twists the polarization
of light entering one filter to allow it to pass through the other.

A program must interact with the outside world using input and output
devices that communicate directly with a human being. One of the most common
devices attached to an controller is an LCD display. Some of the most common LCDs
connected to the contollers are 16X1, 16x2 and 20x2 displays. This means 16
characters per line by 1 line 16 characters per line by 2 lines and 20 characters per line
by 2 lines, respectively.

Many microcontroller devices use 'smart LCD' displays to output visual
information. LCD displays designed around LCD NT-C1611 module, are
inexpensive, easy to use, and it is even possible to produce a readout using the 5X7
dots plus cursor of the display. They have a standard ASCII set of characters and
mathematical symbols. For an 8-bit data bus, the display requires a +5V supply plus
10 I/O lines (RS RW D7 D6 D5 D4 D3 D2 D1 D0). For a 4-bit data bus it only
requires the supply lines plus 6 extra lines(RS RW D7 D6 D5 D4). When the LCD
display is not enabled, data lines are tri-state and they do not interfere with the
operation of the microcontroller.
Shapes and S
available. Line lengths of
8, 16,
20, 24,
32 and
40
charact
ers are
all
standar
d, in
one,
two

28

Features:

(1) Interface with either 4-bit or 8-bit microprocessor.
(2) Display data RAM

(4) Character generator ROM
-matrix character patterns.
(6). Character generator RAM
dot-matrix patterns.
(8).Display data RAM and character generator RAM may be
Accessed by the microprocessor.
(9) Numerous instructions
(10) .Clear Display, Cursor Home, Display ON/OFF, Cursor
ON/OFF,
Blink Character, Cursor Shift, Display Shift.
(11). Built-in reset circuit is triggered at power ON.
(12). Built-in oscillator.


Data can be placed at any location on the LCD. For 161 LCD, the address
locations are:


29


Fig : Address locations for a 1x16 line LCD










Shapes and sizes:

30


Even limited to character based modules,there is still a wide variety of shapes and
sizes available. Line lenghs of 8,16,20,24,32 and 40 charecters are all standard, in
one, two and four line versions.
Several different LC technologies exists. supertwist types, for example, offer
Improved contrast and viewing angle over the older twisted nematic types. Some
modules are available with back lighting, so so that they can be viewed in dimly-lit
conditions. The back lighting may be either electro-luminescent, requiring a high
voltage inverter circuit, or simple LED illumination.
Electrical blockdiagram:


31
Power supply for lcd driving:


PIN DESCRIPTION:
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins
(two pins are extra in both for back-light LED connections).



Fig: pin diagram of 1x16 lines lcd






32




CONTROL LINES:
EN:
Line is called "Enable." This control line is used to tell the LCD that you are
sending it data. To send data to the LCD, your program should make sure this line is
low (0) and then set the other two control lines and/or put data on the data bus. When
the other lines are completely ready, bring EN high (1) and wait for the minimum
amount of time required by the LCD datasheet (this varies from LCD to LCD), and
end by bringing it low (0) again.
RS:
Line is the "Register Select" line. When RS is low (0), the data is to be treated
as a command or special instruction (such as clear screen, position cursor, etc.). When
RS is high (1), the data being sent is text data which sould be displayed on the screen.
For example, to display the letter "T" on the screen you would set RS high.
RW:

33
Line is the "Read/Write" control line. When RW is low (0), the information on
the data bus is being written to the LCD. When RW is high (1), the program is
effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is
a read command. All others are write commands, so RW will almost always be low.
Finally, the data bus consists of 4 or 8 lines (depending on the mode of
operation selected by the user). In the case of an 8-bit data bus, the lines are referred
to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7.
Logic status on control lines:
E - 0 Access to LCD disabled
- 1 Access to LCD enabled
R/W - 0 Writing data to LCD
- 1 Reading data from LCD
RS - 0 Instructions
- 1 Character

Writing data to the LCD:
1) Set R/W bit to low
2) Set RS bit to logic 0 or 1 (instruction or character)
3) Set data to data lines (if it is writing)
4) Set E line to high
5) Set E line to low

Read data from data lines (if it is reading)on LCD:

1) Set R/W bit to high

34
2) Set RS bit to logic 0 or 1 (instruction or character)
3) Set data to data lines (if it is writing)
4) Set E line to high
5) Set E line to low

Entering Text:

First, a little tip: it is manually a lot easier to enter characters and commands in
hexadecimal rather than binary (although, of course, you will need to translate
commands from binary couple of sub-miniature hexadecimal rotary switches is a
simple matter, although a little bit into hex so that you know which bits you are
setting). Replacing the d.i.l. switch pack with a of re-wiring is necessary.
The switches must be the type where On = 0, so that when they are turned to
the zero position, all four outputs are shorted to the common pin, and in position F,
all four outputs are open circuit.
All the available characters that are built into the module are shown in Table 3.
Studying the table, you will see that codes associated with the characters are quoted in
binary and hexadecimal, most significant bits (left-hand four bits) across the top, and
least significant bits (right-hand four bits) down the left.
Most of the characters conform to the ASCII standard, although the Japanese
and Greek characters (and a few other things) are obvious exceptions. Since these
intelligent modules were designed in the Land of the Rising Sun, it seems only fair
that their Katakana phonetic symbols should also be incorporated. The more extensive
Kanji character set, which the Japanese share with the Chinese, consisting of several
thousand different characters, is not included!
Using the switches, of whatever type, and referring to Table 3, enter a few
characters onto the display, both letters and numbers. The RS switch (S10) must be
up (logic 1) when sending the characters, and switch E (S9) must be pressed for each
of them. Thus the operational order is: set RS high, enter character, trigger E, leave RS

35
high, enter another character, trigger E, and so on.
The first 16 codes in Table 3, 00000000 to 00001111, ($00 to $0F) refer to the
CGRAM. This is the Character Generator RAM (random access memory), which can
be used to hold user-defined graphics characters. This is where these modules really
start to show their potential, offering such capabilities as bar graphs, flashing symbols,
even animated characters. Before the user-defined characters are set up, these codes
will just bring up strange looking symbols.

Codes 00010000 to 00011111 ($10 to $1F) are not used and just display blank
characters. ASCII codes proper start at 00100000 ($20) and end with 01111111
($7F). Codes 10000000 to 10011111 ($80 to $9F) are not used, and 10100000 to
11011111 ($A0 to $DF) are the Japanese characters.
4.2 (IR) INFRARED TECHNOLOGY
Introduction:
Technically known as "infrared radiation", infrared light is part of the electromagnetic
spectrum located just below the red portion of normal visible light the opposite end to
ultraviolet. Although invisible, infrared follows the same principles as regular light and can be
reflected or pass through transparent objects, such as glass. Infrared remote controls use this
invisible light as a form of communications between themselves and home theater equipment,
all of which have infrared receivers positioned on the front. Essentially, each time you press a
button on a remote, a small infrared diode at the front of the remote beams out pulses of light
at high speed to all of your equipment. When the equipment recognizes the signal as its own,
it responds to the command.
But much like a flashlight, infrared light can be focused or diffused, weak or
strong. The type and number of emitters can affect the possible angles and range your
remote control can be used from. Better remotes can be used up to thirty feet away
and from almost any angle, while poorer remotes must be aimed carefully at the
device being controlled.
The light our eyes see is but a small part of a broad spectrum of electromagnetic
radiation. On the immediate high energy side of the visible spectrum lies the

36
ultraviolet, and on the low energy side is the infrared. The portion of the infrared
region most useful for analysis of organic compounds is not immediately adjacent to
the visible spectrum, but is that having a wavelength range from 2,500 to 16,000 nm,
with a corresponding frequency range from 1.9*10
13
to 1.2*10
14
Hz.( From
http://hyperphysics.phy-astr.gsu.edu/hbase/ems3.html : the frequency of infrared
ranges from 0.003 - 4 x 10
14
Hz or about 300 gigahertz to 400 terahertz.).

Infrared imaging is used extensively for both military and civilian purposes.
Military applications include target acquisition, surveillance, night vision, homing and
tracking. Non-military uses include thermal efficiency analysis, remote temperature
sensing, short-ranged wireless communication, spectroscopy, and weather forecasting.
Infrared astronomy uses sensor-equipped telescopes to penetrate dusty regions of
space, such as molecular clouds; detect cool objects such as planets, and to view
highly red-shifted objects from the early days of the universe
IR LED QED234:





37

FEATURES:
Wave length is 940 nm
Chip material =GaAs with AlGaAs window
Package type: T-1 3/4 (5mm lens diameter)
Matched Photo sensor: QSD122/123/124
Medium Emission Angle, 40
High Output Power
Package material and color: Clear, untainted, plastic
Ideal for remote control applications

Emitter/Detector Alignment:
Good alignment of the emitter and detector is important for good operation, especially if
the gap is large. This can be done with a piece of string stretched between and in line with
LED and phototransistor. A length of dowel or stiff wire could be used to set the alignment.
Another method that can be used for longer distances is a laser pointer shone through one of
the mounting holes.
For best results the height of the "beam" should be at coupler height and at an angle across
the tracks. The emitter could also be mounted above the track with the phototransistor placed
between the rails in locations such as hidden yards. Placing the emitter and detector at an
angle would again be helpful.


38

Emitter/Detector Alignment Methods

A sample infrared remote controle setup:





39
Infrared Receiver (Pickup)
This device picks up the infrared signal from your remote control just like a TV or VCR.
It encodes the infrared signal into a signal suitable for transmission. Receivers must be
located in the room you wish to use the remote control. The wire from the receiver to the
connecting block needs at least three available conductors and can be several hundred feet
long. Both quad wire and category 5wire work fine. See our IR receivers here.

Connecting Block
This is simply a place for all the parts to plug in or connect to. Connecting blocks are
usually classified based on the number of outputs (how many IR emitters can connect to the
block) Amplified connecting blocks can generally support more outputs. All connecting
blocks can support many IR receivers wired in parallel. Connecting blocks are usually located
near the equipment that is to be controlled, along with the power supply and emitters. See our
connecting blocks here.


Infrared Emitters
IR Emitters generally "stick" onto the front of the device you want to control.
Therefore you need one emitter for each device. "Dual" emitters have two emitters and one
plug, so they only take up one jack of the connecting block. "Blink" emitters blink visibly as
well as infrared, so they are easier to troubleshoot. All emitters come with long cords and
extra double-stick tape. "Blast" style emitters, where one emitter blinks into several devices,
are usually less reliable but can be used when the environment is tightly controlled and
Applications:
Infrared Filters
Night vision
Thermography
Other imaging
Tracking
Heating
Communications

40
Spectroscopy
Meteorology
Climatology
Astronomy
Art history
Biological systems
Photobiomodulation
Health hazard
4.3 L293,L293D(QUADRUPLE HALF H-DRIVERS)
Introduction:
The L293 and L293D are quadruple high-current half-H drivers. The L293 is
designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to
36 V. The L293D is designed to provide bidirectional drive currents of up to 600-mA
at voltages from 4.5 V to 36 V. Both devices are designed to drive inductive loads
such as relays, solenoids, dc and bipolar stepping motors, as well as other high-
current/high-voltage loads in positive-supply applications. All inputs are TTL
compatible. Each output is a complete totem-pole drive circuit, with a Darlington
transistor sink and a pseudo- Darlington source. Drivers are enabled in pairs, with
drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an
enable input is high, the associated drivers are enabled, and their outputs are active
and in phase with their inputs. When the enable input is low, those drivers are
disabled, and their outputs are off and in the high-impedance state. With the proper
data inputs, each pair of drivers forms a full-H (or bridge) reversible drive suitable for
solenoid or motor applications.

Features:
Featuring Unitrode L293 and L293D
Products Now From Texas Instruments
Wide Supply-Voltage Range: 4.5 V to 36 V
Separate Input-Logic Supply

41
Internal ESD Protection
Thermal Shutdown
High-Noise-Immunity Inputs
Functionally Similar to SGS L293 and
SGS L293D
Output Current 1 A Per Channel
(600 mA for L293D)
Peak Output Current 2 A Per Channel
(1.2 A for L293D)
Output Clamp Diodes for Inductive
Transient Suppression (L293D)
Pin diagram:

Description:
On the L293, external high-speed output clamp diodes should be used for
inductive transient suppression. A VCC1 terminal, separate from VCC2, is provided
for the logic inputs to minimize device power dissipation. The L293and L293D are


42
block diagram:





Logic diagram:


43



Applications:

Audio
Automotive
Broadband
Digital control
Military
Optical networking
Security
Telephony
Video & Imaging
Wire less

4.4 DC MOTOR
Introduction:
A DC motor is designed to run on DC electric power. Two examples of pure DC
designs are Michael Faraday's homopolar motor (which is uncommon), and the ball bearin
motor, which is (so far) a novelty. By far the most common DC motor types are the brushed
and brushless types, which use internal and external commutation respectively to create an
oscillating AC current from the DC source -- so they are not purely DC machines in a strict
sense.

44

Types of dcmotors:
1. Brushed DC Motors
2. Brushless DC motors
3. Coreless DC motors
Brushed DC motors:
The classic DC motor design generates an oscillating current in a wound rotor
with a split ring commutator, and either a wound or permanent magnet stator. A rotor
consists of a coil wound around a rotor which is then powered by any type of battery.
Many of the limitations of the classic commutator DC motor are due to the
need for brushes to press against the commutator. This creates friction. At higher
speeds, brushes have increasing difficulty in maintaining contact. Brushes may
bounce off the irregularities in the commutator surface, creating sparks. This limits
the maximum speed of the machine. The current density per unit area of the brushes
limits the output of the motor. The imperfect electric contact also causes electrical
noise. Brushes eventually wear out and require replacement, and the commutator itself
is subject to wear and maintenance. The commutator assembly on a large machine is a
costly element, requiring precision assembly of many parts. there are three types of dc
motor 1. dc series motor 2. dc shunt motor 3. dc compound motor - these are also two
type a. cummulative compound b. deffercial compounnd

45
Brushless DC motors:
Some of the problems of the brushed DC motor are eliminated in the brushless
design. In this motor, the mechanical "rotating switch" or commutator/brushgear
assembly is replaced by an external electronic switch synchronised to the rotor's
position. Brushless motors are typically 85-90% efficient, whereas DC motors with
brushgear are typically 75-80% efficient.
Midway between ordinary DC motors and stepper motors lies the realm of the
brushless DC motor. Built in a fashion very similar to stepper motors, these often use
a permanent magnet external rotor, three phases of driving coils, one or more Hall
effect sensors to sense the position of the rotor, and the associated drive electronics.
The coils are activated, one phase after the other, by the drive electronics as cued by
the signals from the Hall effect sensors. In effect, they act as three-phase synchronous
motors containing their own variable-frequency drive electronics. A specialized class
of brushless DC motor controllers utilize EMF feedback through the main phase
connections instead of Hall effect sensors to determine position and velocity. These
motors are used extensively in electric radio-controlled vehicles. When configured
with the magnets on the outside, these are referred to by modelists as outrunner
motors.
Brushless DC motors are commonly used where precise speed control is necessary, as
in computer disk drives or in video cassette recorders, the spindles within CD, CD-
ROM (etc.) drives, and mechanisms within office products such as fans, laser printers
and photocopiers. They have several advantages over conventional motors:
Compared to AC fans using shaded-pole motors, they are very efficient, running
much cooler than the equivalent AC motors. This cool operation leads to much-
improved life of the fan's bearings.
Without a commutator to wear out, the life of a DC brushless motor can be
significantly longer compared to a DC motor using brushes and a commutator.
Commutation also tends to cause a great deal of electrical and RF noise; without a
commutator or brushes, a brushless motor may be used in electrically sensitive
devices like audio equipment or computers.

46
The same Hall effect sensors that provide the commutation can also provide a
convenient tachometer signal for closed-loop control (servo-controlled) applications.
In fans, the tachometer signal can be used to derive a "fan OK" signal.
The motor can be easily synchronized to an internal or external clock, leading to
precise speed control.
Brushless motors have no chance of sparking, unlike brushed motors, making them
better suited to environments with volatile chemicals and fuels. Also, sparking
generates ozone which can accumulate in poorly ventilated buildings risking harm to
occupants' health.
Brushless motors are usually used in small equipment such as computers and are
generally used to get rid of unwanted heat.
They are also very quiet motors which is an advantage if being used in equipment that
is affected by vibrations.
Modern DC brushless motors range in power from a fraction of a watt to many
kilowatts. Larger brushless motors up to about 100 kW rating are used in electric
vehicles. They also find significant use in high-performance electric model aircraft.
Coreless DC motors:
Nothing in the design of any of the motors described above requires that the
iron (steel) portions of the rotor actually rotate; torque is exerted only on the windings
of the electromagnets. Taking advantage of this fact is the coreless DC motor, a
specialized form of a brush or brushless DC motor. Optimized for rapid acceleration,
these motors have a rotor that is constructed without any iron core. The rotor can take
the form of a winding-filled cylinder inside the stator magnets, a basket surrounding
the stator magnets, or a flat pancake (possibly formed on a printed wiring board)
running between upper and lower stator magnets. The windings are typically
stabilized by being impregnated with Electrical epoxy potting systems. Filled epoxies
that have moderate mixed viscosity and a long gel time. These systems are
highlighted by low shrinkage and low exotherm. Typically UL 1446 recognized as a
potting compound for use up to 180C (Class H) UL File No. E 210549.
Because the rotor is much lighter in weight (mass) than a conventional rotor formed
from copper windings on steel laminations, the rotor can accelerate much more
rapidly, often achieving a mechanical time constant under 1 ms. This is especially true

47
if the windings use aluminum rather than the heavier copper. But because there is no
metal mass in the rotor to act as a heat sink, even small coreless motors must often be
cooled by forced air.
These motors were commonly used to drive the capstan(s) of magnetic tape drives and
are still widely used in high-performance servo-controlled systems, like radio-
controlled vehicles/aircraft, humanoid robotic systems, industrial automation, medical
devices, etc.




4.6 POWER SUPPLY
Power supply is a reference to a source of electrical power. A device or system
that supplies electrical or other types of energy to an output load or group of loads is
Ground next row
Read all columns
Key press
in
this row?
Find which key is pressed
Get scan code from table
return
1
no
yes

48
called a power supply unit or PSU. The term is most commonly applied to electrical
energy supplies, less often to mechanical ones, and rarely to others

This power supply section is required to convert AC signal to DC signal and
also to reduce the amplitude of the signal. The available voltage signal from the mains
is 230V/50Hz which is an AC voltage, but the required is DC voltage(no frequency)
with the amplitude of +5V and +12V for various applications.
In this section we have Transformer, Bridge rectifier, are connected serially
and voltage regulators for +5V and +12V (7805 and 7812) via a capacitor (1000F) in
parallel are connected parallel as shown in the circuit diagram below. Each voltage
regulator output is again is connected to the capacitors of values (100F, 10F, 1 F,
0.1 F) are connected parallel through which the corresponding output(+5V or +12V)
are taken into consideration.




Circuit Explanation


49
1) Transformer
A transformer is a device that transfers electrical energy from one circuit to
another through inductively coupled electrical conductors. A changing current in the
first circuit (the primary) creates a changing magnetic field; in turn, this magnetic
field induces a changing voltage in the second circuit (the secondary). By adding a
load to the secondary circuit, one can make current flow in the transformer, thus
transferring energy from one circuit to the other.
The secondary induced voltage V
S
, of an ideal transformer, is scaled from the
primary V
P
by a factor equal to the ratio of the number of turns of wire in their
respective windings:

Basic principle
The transformer is based on two principles: firstly, that an electric current can
produce a magnetic field (electromagnetism) and secondly that a changing magnetic
field within a coil of wire induces a voltage across the ends of the coil
(electromagnetic induction). By changing the current in the primary coil, it changes
the strength of its magnetic field; since the changing magnetic field extends into the
secondary coil, a voltage is induced across the secondary.
A simplified transformer design is shown below. A current passing through
the primary coil creates a magnetic field. The primary and secondary coils are
wrapped around a core of very high magnetic permeability, such as iron; this ensures
that most of the magnetic field lines produced by the primary current are within the
iron and pass through the secondary coil as well as the primary coil.

50

An ideal step-down transformer showing magnetic flux in the core
Induction law
The voltage induced across the secondary coil may be calculated from
Faraday's law of induction, which states that:

Where V
S
is the instantaneous voltage, N
S
is the number of turns in the
secondary coil and equals the magnetic flux through one turn of the coil. If the
turns of the coil are oriented perpendicular to the magnetic field lines, the flux is the
product of the magnetic field strength B and the area A through which it cuts. The
area is constant, being equal to the cross-sectional area of the transformer core,
whereas the magnetic field varies with time according to the excitation of the primary.
Since the same magnetic flux passes through both the primary and secondary coils in
an ideal transformer, the instantaneous voltage across the primary winding equals


51
Taking the ratio of the two equations for V
S
and V
P
gives the basic equation

for
stepping up or stepping down the voltage


Ideal power equation
If the secondary coil is attached to a load that allows current to flow, electrical
power is transmitted from the primary circuit to the secondary circuit. Ideally, the
transformer is perfectly efficient; all the incoming energy is transformed from the
primary circuit to the magnetic field and into the secondary circuit. If this condition is
met, the incoming electric power must equal the outgoing power.
P
incoming
= I
P
V
P
= P
outgoing
= I
S
V
S
giving the ideal transformer equation


P
in-coming
= I
P
V
P
= P
out-going
= I
S
V
S

giving the ideal transformer equation

52

If the voltage is increased (stepped up) (V
S
> V
P
), then the current is decreased
(stepped down) (I
S
< I
P
) by the same factor. Transformers are efficient so this formula
is a reasonable approximation.
If the voltage is increased (stepped up) (V
S
> V
P
), then the current is decreased
(stepped down) (I
S
< I
P
) by the same factor. Transformers are efficient so this formula
is a reasonable approximation.
The impedance in one circuit is transformed by the square of the turns ratio.
For example, if an impedance Z
S
is attached across the terminals of the secondary coil,
it appears to the primary circuit to have an impedance of

This relationship is reciprocal, so that the impedance Z
P
of the primary circuit
appears to the secondary to be

Detailed operation
The simplified description above neglects several practical factors, in
particular the primary current required to establish a magnetic field in the core, and
the contribution to the field due to current in the secondary circuit.
Models of an ideal transformer typically assume a core of negligible
reluctance with two windings of zero resistance. When a voltage is applied to the
primary winding, a small current flows, driving flux around the magnetic circuit of the
core. The current required to create the flux is termed the magnetizing current; since
the ideal core has been assumed to have near-zero reluctance, the magnetizing current
is negligible, although still required to create the magnetic field.

53
The changing magnetic field induces an electromotive force (EMF) across
each winding. Since the ideal windings have no impedance, they have no associated
voltage drop, and so the voltages V
P
and V
S
measured at the terminals of the
transformer, are equal to the corresponding EMFs. The primary EMF, acting as it
does in opposition to the primary voltage, is sometimes termed the "back EMF". This
is due to Lenz's law which states that the induction of EMF would always be such that
it will oppose development of any such change in magnetic field.
2) Bridge Rectifier
A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge
configuration that provides the same polarity of output voltage for any polarity of
input voltage. When used in its most common application, for conversion of
alternating current (AC) input into direct current (DC) output, it is known as a bridge
rectifier. A bridge rectifier provides full-wave rectification from a two-wire AC input,
resulting in lower cost and weight as compared to a center-tapped transformer design,
but has two diode drops rather than one, thus exhibiting reduced efficiency over a
center-tapped design for the same out put vol t age.
Basic Operation
When the input connected at the left corner of the diamond is positive with
respect to the one connected at the right hand corner, current flows to the right along
the upper colored path to the output, and returns to the input supply via the lower one.


54
When the right hand corner is positive relative to the left hand corner, current
flows along the upper colored path and returns to the supply via the lower colored
path.

In each case, the upper right output remains positive with respect to the lower
right one. Since this is true whether the input is AC or DC, this circuit not only
produces DC power when supplied with AC power: it also can provide what is
sometimes called "reverse polarity protection". That is, it permits normal functioning
when batteries are installed backwards or DC input-power supply wiring "has its
wires crossed" (and protects the circuitry it powers against damage that might occur
without this circuit in place).
Prior to availability of integrated electronics, such a bridge rectifier was
always constructed from discrete components. Since about 1950, a single four-
terminal component containing the four diodes connected in the bridge configuration
became a standard commercial component and is now available with various voltage
and current ratings.

55


Output smoothing (Using Capacitor)
For many applications, especially with single phase AC where the full-wave
bridge serves to convert an AC input into a DC output, the addition of a capacitor may
be important because the bridge alone supplies an output voltage of fixed polarity but
pulsating magnitude (see diagram above).



56
The function of this capacitor, known as a reservoir capacitor (aka smoothing
capacitor) is to lessen the variation in (or 'smooth') the rectified AC output voltage
waveform from the bridge. One explanation of 'smoothing' is that the capacitor
provides a low impedance path to the AC component of the output, reducing the AC
voltage across, and AC current through, the resistive load. In less technical terms, any
drop in the output voltage and current of the bridge tends to be cancelled by loss of
charge in the capacitor.
This charge flows out as additional current through the load. Thus the change
of load current and voltage is reduced relative to what would occur without the
capacitor. Increases of voltage correspondingly store excess charge in the capacitor,
thus moderating the change in output voltage / current. Also see rectifier output
smoothing.
The simplified circuit shown has a well deserved reputation for being
dangerous, because, in some applications, the capacitor can retain a lethal charge after
the AC power source is removed. If supplying a dangerous voltage, a practical circuit
should include a reliable way to safely discharge the capacitor. If the normal load can
not be guaranteed to perform this function, perhaps because it can be disconnected,
the circuit should include a bleeder resistor connected as close as practical across the
capacitor. This resistor should consume a current large enough to discharge the
capacitor in a reasonable time, but small enough to avoid unnecessary power waste.
Because a bleeder sets a minimum current drain, the regulation of the circuit,
defined as percentage voltage change from minimum to maximum load, is improved.
However in many cases the improvement is of insignificant magnitude.
The capacitor and the load resistance have a typical time constant = RC
where C and R are the capacitance and load resistance respectively. As long as the
load resistor is large enough so that this time constant is much longer than the time of
one ripple cycle, the above configuration will produce a smoothed DC voltage across
the load.
In some designs, a series resistor at the load side of the capacitor is added. The
smoothing can then be improved by adding additional stages of capacitorresistor

57
pairs, often done only for sub-supplies to critical high-gain circuits that tend to be
sensitive to supply voltage noise.
The idealized waveforms shown above are seen for both voltage and current
when the load on the bridge is resistive. When the load includes a smoothing
capacitor, both the voltage and the current waveforms will be greatly changed. While
the voltage is smoothed, as described above, current will flow through the bridge only
during the time when the input voltage is greater than the capacitor voltage. For
example, if the load draws an average current of n Amps, and the diodes conduct for
10% of the time, the average diode current during conduction must be 10n Amps.
This non-sinusoidal current leads to harmonic distortion and a poor power factor in
the AC supply.
In a practical circuit, when a capacitor is directly connected to the output of a
bridge, the bridge diodes must be sized to withstand the current surge that occurs
when the power is turned on at the peak of the AC voltage and the capacitor is fully
discharged. Sometimes a small series resistor is included before the capacitor to limit
this current, though in most applications the power supply transformer's resistance is
already sufficient.
Output can also be smoothed using a choke and second capacitor. The choke
tends to keep the current (rather than the voltage) more constant. Due to the relatively
high cost of an effective choke compared to a resistor and capacitor this is not
employed in modern equipment.
Some early console radios created the speaker's constant field with the current
from the high voltage ("B +") power supply, which was then routed to the consuming
circuits, (permanent magnets were considered too weak for good performance) to
create the speaker's constant magnetic field. The speaker field coil thus performed 2
jobs in one: it acted as a choke, filtering the power supply, and it produced the
magnetic field to operate the speaker.
3) Voltage Regulator

58
A voltage regulator is an electrical regulator designed to automatically
maintain a constant voltage level.
The 78xx (also sometimes known as LM78xx) series of devices is a family of
self-contained fixed linear voltage regulator integrated circuits. The 78xx family is a
very popular choice for many electronic circuits which require a regulated power
supply, due to their ease of use and relative cheapness. When specifying individual
ICs within this family, the xx is replaced with a two-digit number, which indicates the
output voltage the particular device is designed to provide (for example, the 7805 has
a 5 volt output, while the 7812 produces 12 volts). The 78xx line is positive voltage
regulators, meaning that they are designed to produce a voltage that is positive
relative to a common ground. There is a related line of 79xx devices which are
complementary negative voltage regulators. 78xx and 79xx ICs can be used in
combination to provide both positive and negative supply voltages in the same circuit,
if necessary.
78xx ICs have three terminals and are most commonly found in the TO220
form factor, although smaller surface-mount and larger TrO3 packages are also
available from some manufacturers. These devices typically support an input voltage
which can be anywhere from a couple of volts over the intended output voltage, up to
a maximum of 35 or 40 volts, and can typically provide up to around 1 or 1.5 amps of
current (though smaller or larger packages may have a lower or higher current rating).










59























60
CHAPTER 5
IMPLEMENTATION OF SOFTWARE

5.1 KEIL SOFTWARE

Installing the Keil software on a Windows PC

Insert the CD-ROM in your computers CD drive
On most computers, the CD will auto run, and you will see the Keil
installation menu. If the menu does not appear, manually double click on the
Setup icon, in the root directory: you will then see the Keil menu.
On the Keil menu, please select Install Evaluation Software. (You will not
require a license number to install this software).
Follow the installation instructions as they appear.



Loading the Projects

The example projects for this book are NOT loaded automatically when you install
the Keil compiler.
These files are stored on the CD in a directory /Pont. The files are arranged by
chapter: for example, the project discussed in Chapter 3 is in the directory
/Pont/Ch03_00-Hello.
Rather than using the projects on the CD (where changes cannot be saved), please
copy the files from CD onto an appropriate directory on your hard disk.

61
Note: you will need to change the file properties after copying: file transferred from
the CD will be read only.








Configuring the Simulator

Open the Keil Vision2





Go to Project Open Project and browse for Hello in Ch03_00 in Pont and open it.

62



Go to Project Select Device for Target Target1



63



Select 8052(all variants) and click OK



Now we need to check the oscillator frequency:
Go to project Options for Target Target1

64



Make sure that the oscillator frequency is 12MHz.



65

Building the Target

Build the target as illustrated in the figure below


Running the Simulation
Having successfully built the target, we are now ready to start the debug session and
run the simulator.
First start a debug session

66


The flashing LED we will view will be connected to Port 1. We therefore want to
observe the activity on this port


67


To ensure that the port activity is visible, we need to start the periodic window
update flag



68



Go to Debug - Go


While the simulation is running, view the performance analyzer to check the delay
durations.

69







70
Go to Debug Performance Analyzer and click on it






Double click on DELAY_LOOP_Wait in Function Symbols: and click Define button


71


5.2 SOURCE CODE
;***********SOURCE CODE****************************************
;*************** CAR PARKING SYSTEM *****************
;********************************************************
; P3.6 AND P3.7 RECEIVERS OF ENTRY AND EXIT SENSORS RESP.
; P1.0,P1.1,P1.2 AND P1.3 STEPPER MOTOR A,B,C AND D COILS
; P2 LCD DATA PINS
; P3.0,P3.1 AND P3.2 ARE RS,R/W AND EN PINS OF LCD RESP.


ORG 00H
SETB P3.6 ; MAKING P3.6 AS I/P PIN
SETB P3.7 ; MAKING P3.7 AS I/P PIN
MOV R6,#10 ; VEHICLE CAPACITY OF PARK

;******* LCD INITIALISATION ****************************

MOV DPTR,#COMM
BACK1 : CLR A
MOVC A,@A+DPTR
JZ NEXT
ACALL COMN

72
ACALL DELAY
INC DPTR
SJMP BACK1

;****** LCD INITIAL MESSAGE DISPLAY ********************

NEXT : MOV DPTR,#MESG4
ACALL BACK2
ACALL DELAY1

MOV A,#0C0H
ACALL COMN
ACALL DELAY
MOV DPTR,#MESG5
ACALL BACK2
ACALL FORDELAY
ACALL FORDELAY

MOV A,#01H
ACALL COMN
ACALL DELAY
MOV A,#82H
ACALL COMN
ACALL DELAY
MOV DPTR,#MESG6
ACALL BACK2
MOV A,#0C5H
ACALL COMN
ACALL DELAY
MOV DPTR,#MESG7
ACALL BACK2
ACALL FORDELAY
ACALL FORDELAY

MOV A,#01H
ACALL COMN
ACALL DELAY
MOV A,#81H
ACALL COMN
ACALL DELAY
MOV DPTR,#MESG
ACALL BACK2

MOV A,#0C0H

73
ACALL COMN
ACALL DELAY

MOV DPTR,#MESG1
ACALL BACK2

MOV A,#0C4H
ACALL COMN
ACALL DELAY
MOV A,#'1'
ACALL DATAWRT
ACALL DELAY
MOV A,#'0'
ACALL DATAWRT
ACALL DELAY

;*********** CHECKING FOR VEHICLE ENTRY OR EXIT ********

BACK : JNB P3.6,ENTRY
JNB P3.7,EXIT
SJMP BACK

;*********** OPENING THE GATE FOR VEHICLE ENTRY ********

ENTRY : MOV R7,#10
MOV A,#66
ACALL RUNACW
DEC R6
MOV A,#0C4H
ACALL COMN
ACALL DELAY
MOV A,R6 ; DISPLAYING CURRENT
CAPACITY
ANL A,#0F0H
ORL A,#30H
ACALL DATAWRT
ACALL DELAY
MOV A,#0C5H
ACALL COMN
ACALL DELAY
MOV A,R6
ANL A,#0FH
ORL A,#30H
ACALL DATAWRT

74
ACALL DELAY1

STAY : JNB P3.6,STAY
ACALL DELAY1
ACALL DELAY1
STAY1 : JB P3.7,STAY1 ; FOR EXIT GATE HIGH TO LOW
STAY2 : JNB P3.7,STAY2
ACALL FORDELAY
MOV R7,#10
MOV A,#66
ACALL RUNCW
CJNE R6,#00,BACK

MOV A,#01
ACALL COMN
ACALL DELAY
MOV A,#82H
ACALL COMN
ACALL DELAY
MOV DPTR,#MESG2
ACALL BACK2

MOV A,#0C4H
ACALL COMN
ACALL DELAY
MOV DPTR,#MESG3
ACALL BACK2
STAY4EXIT : JB P3.7,STAY4EXIT ; WAITING FOR EXIT OF VEHICLE
MOV A,#01
ACALL COMN
ACALL DELAY

MOV A,#81H
ACALL COMN
ACALL DELAY
MOV DPTR,#MESG
ACALL BACK2
MOV A,#0C0H
ACALL COMN
ACALL DELAY
MOV DPTR,#MESG1
ACALL BACK2
ACALL DELAY


75

EXIT : MOV R7,#10
MOV A,#66
ACALL RUNACW
INC R6
MOV A,#0C4H
ACALL COMN
ACALL DELAY
MOV A,R6
MOV B,#10
DIV AB
ORL A,#30H
ACALL DATAWRT
ACALL DELAY
MOV A,#0C5H
ACALL COMN
ACALL DELAY

MOV A,B
ORL A,#30H
ACALL DATAWRT
STAY3 : JNB P3.7,STAY3
ACALL DELAY1
STAY4 : JB P3.6,STAY4
STAY5 : JNB P3.6,STAY5

ACALL FORDELAY
MOV R7,#10
MOV A,#66
ACALL RUNCW
LJMP BACK


FORDELAY:ACALL DELAY2
ACALL DELAY2
ACALL DELAY2
ACALL DELAY2
ACALL DELAY2
ACALL DELAY2
ACALL DELAY2
ACALL DELAY2
ACALL DELAY2
ACALL DELAY2
ACALL DELAY2

76
RET

RUNACW: CLR P1.0
SETB P1.1
SETB P1.2
CLR P1.3
ACALL DELAY1

CLR P3.0
SETB P3.1
SETB P3.2
CLR P3.3
ACALL DELAY1

SETB P1.0
SETB P1.1
CLR P1.2
CLR P1.3
ACALL DELAY1

SETB P3.0
SETB P3.1
CLR P3.2
CLR P3.3
ACALL DELAY1


SETB P1.0
CLR P1.1
CLR P1.2
SETB P1.3
ACALL DELAY1

SETB P3.0
CLR P3.1
CLR P3.2
SETB P3.3
ACALL DELAY1

CLR P1.0
CLR P1.1
SETB P1.2
SETB P1.3
ACALL DELAY1

77

CLR P3.0
CLR P3.1
SETB P3.2
SETB P3.3
ACALL DELAY1

DJNZ R7,RUNACW
RET

RUNCW: CLR P1.0
SETB P1.1
SETB P1.2
CLR P1.3
ACALL DELAY1

CLR P3.0
SETB P3.1
SETB P3.2
CLR P3.3
ACALL DELAY1

CLR P1.0
CLR P1.1
SETB P1.2
SETB P1.3
ACALL DELAY1

CLR P3.0
CLR P3.1
SETB P3.2
SETB P3.3
ACALL DELAY1

SETB P1.0
CLR P1.1
CLR P1.2
SETB P1.3
ACALL DELAY1

SETB P3.0
CLR P3.1
CLR P3.2
SETB P3.3

78
ACALL DELAY1

SETB P1.0
SETB P1.1
CLR P1.2
CLR P1.3
ACALL DELAY1

SETB P3.0
SETB P3.1
CLR P3.2
CLR P3.3
ACALL DELAY1

; MOV P1,A
; RR A
; ACALL DELAY1
DJNZ R7,RUNCW
RET
COMN : MOV P2,A
CLR P1.7
CLR P1.6
SETB P1.5
ACALL DELAY
CLR P1.5
RET

DATAWRT:MOV P2,A
SETB P1.7
CLR P1.6
SETB P1.5
ACALL DELAY
CLR P1.5
RET

BACK2 : CLR A
MOVC A,@A+DPTR
JZ NEXT1
ACALL DATAWRT
ACALL DELAY
INC DPTR
SJMP BACK2
NEXT1 : RET


79
DELAY : MOV R2,#20
HERE1 : MOV R3,#255
HERE2 : DJNZ R3,HERE2
DJNZ R2,HERE1
RET

DELAY1: MOV R2,#40
HERE3 : MOV R3,#255
HERE4 : DJNZ R3,HERE4
DJNZ R2,HERE3
RET

DELAY2: MOV R2,#255
HERE5 : MOV R3,#255
HERE6 : DJNZ R3,HERE6
DJNZ R2,HERE5
RET

COMM : DB 38H,0CH,01,06,84H,00
MESG4 : DB "WIN KIT",0
MESG5 : DB "LEARNING IS FUN",0
MESG6 : DB "CAR PARKING",0
MESG7 : DB "SYSTEM",0
MESG : DB "PARKING SPACE",0
MESG1 : DB "FOR VEHICLES",0
MESG2 : DB "NO SPACE FOR",0
MESG3 : DB "PARKING",0

END









80


CHAPTER 6
RESULT ANALYSYS

Kit photo

























81




CHAPTER 7
CONCLUSION & FUTURE IMPLEMENTATION
The system ADVANCED CAR PARKING SYSTEM is successfully
designed and tested as per the requirement of atomize car parking to avoid manual
work and manual mistakes.
In this project we have add webcam Purpose of providing survilance and
more security at the parking areas. Which is very useful to find the unauthorized
vehicles and thefted vehicles.





















82




Bibliography:


The 8051 Micro controller and Embedded Systems

Muhammad Ali Mazidi
Janice Gillispie Mazidi

The 8051 Micro controller Architecture, Programming & Applications

Kenneth J.Ayala

Fundamentals of Micro processors and Micro computers

B.Ram

Micro processor Architecture, Programming & Applications

Ramesh S.Gaonkar

Electronic Components

D.V.Prasad



References on the Web:
www.national.com
www.atmel.com
www.microsoftsearch.com
www.geocities.com





83

You might also like