You are on page 1of 53

PROJECT REPORT

ON
TRAFFIC LIGHT CONTROL
SYSTEM

SUBMITTED TO:- SUBMITTED BY:-


ER.RAVINDER SINGH NAVNEET KAUR (883701)
SAWHNEY SIMRANBIR KAUR (883703)
RAJINDER KAUR (883709)
AJAY TAAK (883242)
AJEET KUMAR SINGH(883233)

GURU NANAK DEV UNIVERSITY,AMRITSAR


Acknowledgement

Success is a sweet fruit, which everyone strives to taste. To achieve this goal,
one has to put in a lot of physical and mental efforts. Each time We write this
report, We gain a stronger appreciation for the following fact. We could not do
it without the help of many talented and dedicated people. So We wish to
express our appreciation to those whose help has been most valuable.

Firstly, we would like to express our gratitude and appreciation to Mr. Arvind
Dixit (Director of the company) who explained us everything about the training
process at the company and made us familiar with the company staff. We are
equally grateful to Mr.Anoop Sharma (Instructor) who sorted out many of our
problems regarding the training and marshalled us in the Project.

Again thanking Mr. Pradeep Kumar (Production Manager) for sharing the nitty-
gritty of hardware section and piloting us throughout the project.

Finally, at last but not the least we would like to say thanks to all the employees
of the company for their kind co-operation in our Six weeks training program.
COMPANY PROFILE

Advance Technology

Today Advance Technology is well established and is rated among the top companies in north
India as a fast growing specialize technology segment. We also provide sourcing services to the
defense client, R & D organization to all world-class development tools (software/hardware).
Having designing development capabilities, developed many indigenous technologies project to
all customers.

Today Advance Technology is one stop offering multiple products in respective technology
areas and a well-diversified multi division group.

PLATFORM AND INFRA-STRUCTURE:-


Advance Technology: a leading company in embedded system, established in 1999 with
the motivation to bridge the gap.

Advance Technology has a three thousand sq.-ft. facility occupied with state-of-
the-art hardware development, test and measurement, manufacturing, QA facilities
required for building advanced image processing and DSP systems. The software
Development Platforms include the popular MS-Windows 8/2000/NT) based systems. The
Software development at Advanced Technology is carried out using development Tools such as
MS-VC++, MFC, MS-VB, WATCOM and DSP (AD&TI) tools. The Team of 18 highly
qualified technical staff employs a time tested and robust development process the time-bound
results.
Advance Technology is a powerful vendor in the northern region and has its corporate

offices in Chandigarh (H.O), Delhi, and Mumbai and Hyderabad.


Advance Technology founded in 1999, is an company, specializing in Embedded System ,Test &
Measuring service utility operations and maintenance support services. Their project support
includes both domestic and international projects. The Advance Technology team comprises
leading edge technologists and business experts with extensive experience in R&D, Product &
Software development, Implementation and Systems Integration. Their schedules for
educational programs are

EDUCATION PROGRAMS
 Industrial Training Programs
1. Six weeks
2. Six months
 Embedded System Design
 Digital Signal Processing
 Micro Controller Design

MICRO CONTROLLER BASED DESIGN


 Introduction
 Architecture
 Assembly Language and Instruction Set
 Microcontroller Based Designs
 Inter-Facing with Devices
 Tools
KEIL, FLASH MAGIC
Microcontroller Evaluation Board
DIGITAL SIGNAL PROCESSING
 Introduction
 Fourier Transform Algorithms
Discrete Fourier Transform
Fast Fourier Transform
 Digital Filtering
IIR Filtering Technique
 Architecture And Implementation
FIR
 Various Windows (LAISER, HAMMING, HANNING, BARTLETT)
Multi Rate Filtering Techniques
 Implementation On Hardware DSP Boards
TEXAS Instrument TMS320C6711
Analog Devices ADSP2181

EMBEDDED SYSTEM DESIGN


 Introduction
 Architecture
 Theory Of Embedded System Design
 Implementation Strategies
Microprocessor Based
PC Based
Microcontroller Based
DSP Controller Based
INTRODUCTION TO EMBEDDED SYSTEM

An Embedded System employs a combination of hardware & software (a “computational


engine”) to perform a specific function; is part of a larger system that may not be a “computer
works in a reactive and time-constrained environment. Software is used for providing features
and flexibility Hardware = {Processors, ASICs, Memory...} is used for performance (&
sometimes security).
An embedded system is a special purpose system in which the computer is completely
encapsulated by the device it controls. Unlike a general purpose computer, such as a PC, an
embedded system performs predefined task’s usually with very specific tasks design engineers
can optimize it reducing the size and cost of the product. Embedded systems are often mass
produced, so the cost savings may be multiplied by million of items.
The core of any embedded system is formed by one or several microprocessor or micro
controller programmed to perform a small number of tasks. In contrast to a general purpose
computer, which can run any software application, the user chooses, the software on an
embedded system is semi-permanent, so it is often called firmware.

EXAMPLES OF EMBEDDED SYSTEM:-

o Automated tiller machines (ATMS).


o Avionic, such as inertial guidance systems, flight control hardware / software and letter
integrated system in aircraft and missile.
o Cellular telephones and telephonic switches.
o Computer network equipment, including routers timeservers and firewalls
o Computer printers, Copiers.
o Disk drives (floppy disk drive and hard disk drive)
o Engine controllers and antilock brake controllers for automobiles.
o Home automation products like thermostat, air conditioners sprinkles and security
monitoring system.
MICROPROCESSOR (MPU)
A microprocessor is a general-purpose digital computer central processing unit (CPU). Although
popularly known as a “computer on a chip” is in no sense a complete digital computer. The
block diagram of a microprocessor CPU is shown, which contains an arithmetic and logical
unit (ALU), a program counter (PC), a stack pointer (SP),some working registers, a clock timing
circuit, and interrupt circuits.

Data Bus
CPU
General-Purpose Micro-processor
Serial COM Port
RAM ROM I/O Port Timer

FIG:BLOCK DIAGRAM OF A MICROPROCESSOR

MICROCONTROLLERS (MCU)

Figure shows the block diagram of a typical microcontroller, which is a true computer on a chip.
The design incorporates all of the features found in micro-processor CPU, ALU, PC, SP, and
registers. It also added the other features needed to make a complete computer: ROM, RAM,
parallel I/O,serial I/O, counters, and clock circuit.
CPU RAM ROM
A single chip
Serial COM Port
I/O Port Timer

FIG:BLOCK DIAGRAM OF A MICROCONTROLLER

COMPARISON BETWEEN MICROPROCESSORS &


MICROCONTROLLERS:-

The microprocessor must have many additional parts to be operational as a computer whereas
microcontroller requires no additional external digital parts.

 The prime use of microprocessor is to read data, perform extensive calculations on that
data and store them in the mass storage device or display it. The prime functions of
microcontroller is to read data, perform limited calculations on it, control its environment
based on these data. Thus the microprocessor is said to be general-purpose digital
computers whereas the microcontroller are intend to be special purpose digital controller.
 Microprocessor need many opcodes for moving data from the external memory to the
CPU, microcontroller may require just one or two, also microprocessor may have one or
two types of bit handling instructions whereas microcontrollers have many.
 Thus microprocessor is concerned with the rapid movement of the code and data from the
external addresses to the chip, microcontroller is concerned with the rapid movement of
the bits within the chip.
Lastly, the microprocessor design accomplishes the goal of flexibility in the hardware
configuration by enabling large amounts of memory and I/O that could be connected to the
address and data pins on the IC package. The microcontroller design uses much more limited set
of single and double byte instructions to move code and data from internal memory to ALU.
THE CENTRAL PROCESSING UNIT

 The central processing unit (CPU) does all the computing: it fetches, decodes and
executes program instructions and directs the flow of data to and from memory. The CPU
performs the calculations required by program instructions and places the results of these
calculations, if required, into memory space. Most CPUs are synchronous. This means
that they depend on the cycles of a processor clock. A clock generates a high-frequency
square wave usually driven by a crystal, a RC (resistor capacitor) or an external source.
The clock is sometimes referred to as an oscillator. The clock speed, or oscillation rate, is
measured in megahertz (MHz), which represents one million cycles/second. For example,
if the clock speed is 3 MHz then there are 3,000,000-clock cycles/second. Clock configurations
are micro controller dependant.
The following are some sample clock configurations:
“# The Motorola MC68HC705C8 has two pins, OSC1 and OSC2, which provide connections for
an on-chip oscillator. A crystal, ceramic resonator, or external signal can be attached to the pins.
The oscillator frequency is two times the internal bus rate and the processor clock cycle is two
times the oscillator frequency.

“# The Microchip PIC16C54 has clocked input pin OSC1/CLKIN and clock output pin
OSC2/CLKOUT. Four to generate four clocks internally divides OSC1/CLKIN. There are four
possible modes: low power crystal, crystal/resonator, high-speed crystal, and resistor/capacitor.
The clock controls the sequence of instructions. Most micro controllers divide their basic clock
frequency to arrive at a bus-rate clock. Each instruction takes a specific number of bus-rate clock
cycles in order to execute.

One part of the CPU is responsible for performing calculations and executing instructions. This
part is called the arithmetic logic unit, or ALU. There are a variety of subsidiary components,
which support the ALU. These components include the decoder, the sequencer and a variety of
registers. The decoder converts instructions stored in program memory into codes, which the
ALU can understand. The sequencer manages the flow of data along the micro controller’s data
bus. The CPU to temporarily store vital data, which are volatile, uses registers: they can
change during program execution. Most micro controller registers are memory-mapped,
associated with a memory location, and can be used like any other memory location. Registers
store the state of the CPU. If the contents of micro controller memory and the contents of these
registers are saved it is possible to suspend program operation for an indefinite period of time
and restart exactly in the state when the program was suspended. The number and names of
registers varies drastically among micro controllers. However there are certain registers, which
are common to most micro controllers, although the names may vary.

FIG: BLOCK DIAGRAM OF CPU

These include:
“# THE STACK POINTER
The stack pointer contains the address of the next location on the stack. The address in the stack
pointer is decremented when data is pushed on the stack and incremented when data is popped
from the stack.

“# THE INDEX REGISTERS


The index register is used to specify an address when certain addressing modes are used. It is
also known as the pointer register. The Microchip devices use the name FSR (file select register).
“# THE PROGRAM COUNTER
Perhaps the single most important CPU register is the program counter (PC). The PC holds the
address of the next instruction in program memory space. It contains the address of the next
instruction the CPU will process. As each instruction is fetched and processed by the ALU, the
CPU increments the PC and thereby steps through the program stored in the program memory
space.

“# THE ACCUMULATOR
The accumulator is a register that can hold operands or results of operations as necessary. The
Microchip devices use the name W (working) register. Other registers may reflect results from
the instruction just executed, control the options available on the device, and enable access to
certain areas of memory.

PROGRAMMING MODEL OF 8051:

In programming model of 8051 we have different types of registers are available and te4hse
registers are used to store temporarily data is then the information could be a byte of data to be
processed or an address pointing to the data to be fetched the majority of registers is 8051 are 8-
bikt registers.

ACCUMULATOR (REGISTER A):


Accumulator is a mathematical register where all the arithmetic and logical operations are done
is this register and after execution of instructions the outpour data is stored in the register is bit
addressable near. We can access any of the single bit of this register.

B REGISTER:
B register is same as that of accumulator of. It is also an 8 bit register and every bit of this is
accessible. This is also a mathematical register B which is used mostly for multiplication and
division.

PSW (PROGRAM STATUS WORD) Register:


Program status word register is an 8 bit register. It is also referred to as the flag register.
Although the PSW register is 8 bits wide, only 6 bits of it are used by the 8051. The unused bits
are user-definable flags. Four of the flags are called conditional flags, meaning that they indicate
some conditions that result after an instruction is executed. These four are CY (carry), AC
(auxiliary carry), P (parity) and OV (overflow).

CY PSW.7 Carry Flag


AC PSW.6 Auxiliary Carry Flag
F0 PSW.5 Available to the user for General Purpose
RS1 PSW.4 Register Bank Selector Bit 1
RS0 PSW.3 Register Bank Selector Bit 0
OV PSW.2 Overflow Flag
-- PSW.1 User Definable Bit
P PSW.0 Parity Flag.

SPECIAL FUNCTION REGISTER (SFR) MEMORY:-


Special Function Registers (SFRs) are areas of memory that control specific functionality of the
8051 processor. For example, four SFRs permit access to the 8051s 32 input/output lines.
Another SFR allows a program to read or write to the 8051s serial port. Other SFRs allow the
user to set the serial baud rate, control and access timers, and configure the 8051s interrupt
system. When programming, SFRs have the illusion of being Internal Memory. For example, if
you want to write the value "1" to Internal RAM location 50 hex you would execute the
instruction:

SFR Types

As mentioned in the chart itself, the SFRs that have a blue background are SFRs related to the
I/O ports. The 8051 has four I/O ports of 8 bits, for a total of 32 I/O lines. Whether a given I/O
line is high or low and the values read from the line are controlled by the SFRs in green. The
SFRs with yellow backgrounds are SFRs, which in some way control the operation or the
configuration of some aspect of the 8051. For example, TCON controls the timers, SCON
controls the serial port.

The remaining SFRs, with green backgrounds, are "other SFRs." These SFRs can be thought of
as auxiliary SFRs in the sense that they don't directly configure the 8051 but obviously the 8051
cannot operate without them. For example, once the serial port has been configured using
SCON, the program may read or write to the serial port using the SBUF register.

P0 (PORT 0; ADDRESS 80H, BIT-ADDRESSABLE):


This is input/output port 0. Each bit of this SFR corresponds to one of the pins on the
microcontroller. For example, bit 0 of port 0 is pin P0.0, bit 7 is pin P0.7. Writing a value of 1 to
a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to a low level.

SP (STACK POINTER, ADDRESS 81H):


This is the stack pointer of the microcontroller. This SFR indicates where the next value to be
taken from the stack will be read from in Internal RAM. If you push a value onto the stack, the
value will be written to the address of SP + 1. That is to say, if SP holds the value 07h, a PUSH
instruction will push the value onto the stack at address 08h. This SFR is modified by all
instructions, which modify
The stack, such as PUSH, POP, LCALL, RET, RETI, and whenever interrupts are provoked by
the microcontroller.

DPL/DPH (DATA POINTER LOW/HIGH, ADDRESSES 82H/83H):


The SFRs DPL and DPH work together to represent a 16-bit value called the Data Pointer. The
data pointer is used in operations regarding external RAM and some instructions involving code
memory. Since it is an unsigned two-byte integer value, it can represent values from 0000h to
FFFFh (0 through 65,535 decimal).
PCON (POWER CONTROL, ADDRESSES 87H):
The Power Control SFR is used to control the 8051's power control modes. Certain operation
modes of the 8051 allow the 8051 to go into a type of "sleep" mode that requires much less
power. These modes of operation are controlled through PCON. Additionally, one of the bits in
PCON is used to double the effective baud rate of the 8051's serial port.

TCON (TIMER CONTROL, ADDRESSES 88H, BIT-ADDRESSABLE):

The Timer Control SFR is used to configure and modify the way in which the 8051's two timers
operate. This SFR controls whether each of the two timers is running or stopped and contains a
flag to indicate that each timer has overflowed. Additionally, some non-timer related bits are
located in the TCON SFR. These bits are used to configure the way in which the external
interrupts are activated and also contain the external interrupt flags, which are set when an
external interrupt has occurred.

TMOD (TIMER MODE, ADDRESSES 89H):

The Timer Mode SFR is used to configure the mode of operation of each of the two timers.
Using this SFR your program may configure each timer to be a 16-bit timer, an 8-bit auto reload
timer, a 13-bit timer, or two separate timers. Additionally, you may configure the timers to only
count when an external pin is activated or to count "events" that are indicated on an external pin.

TL0/TH0 (TIMER 0 LOW/HIGH, ADDRESSES 8AH/8CH):

These two SFRs, taken together, represent timer 0. Their exact behavior depends on how the
timer is configured in the TMOD SFR; however, these timers always count up. What is
configurable is how and when they increment in value.

TL1/TH1 (TIMER 1 LOW/HIGH, ADDRESSES 8BH/8DH):

These two SFRs, taken together, represent timer 1. Their exact behavior depends on how the
timer is configured in the TMOD SFR; however, these timers always count up. What is
configurable is how and when they increment in value.
P1 (PORT 1, ADDRESS 90H, BIT-ADDRESSABLE):

This is input/output port 1. Each bit of this SFR corresponds to one of the pins on the
microcontroller. For example, bit 0 of port 1 is pin P1.0, bit 7 is pin P1.7. Writing a value of 1 to
a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to a low level.

SCON (SERIAL CONTROL, ADDRESSES 98H, BIT-ADDRESSABLE):


The Serial Control SFR is used to configure the behavior of the 8051's on-board serial port. This
SFR controls the baud rate of the serial port, whether the serial port is activated to receive data,
and also contains flags that are set when a byte is successfully sent or received.

SBUF (SERIAL CONTROL, ADDRESSES 99H):


The Serial Buffer SFR is used to send and receive data via the on-board serial port. Any value
written to SBUF will be sent out the serial port's TXD pin. Likewise, any value that the 8051
receive via the serial port’s RXD pin will be delivered to the user program via SBUF. In other
words, SBUF serves as the output port when written to and as an input port when read from.

P2 (PORT 2, ADDRESS A0H, and BIT-ADDRESSABLE):

This is input/output port 2. Each bit of this SFR corresponds to one of the pins on the
microcontroller. For example, bit 0 of port 2 is pin P2.0, bit 7 is pin P2.7. Writing a value of 1 to
a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to a low level.

IE (INTERRUPT ENABLE, ADDRESSES A8H):


The Interrupt Enable SFR is used to enable and disable specific interrupts. The low 7 bits of the
SFR are used to enable/disable the specific interrupts, where as the highest bit is used to enable
or disable ALL interrupts. Thus, if the high bit of IE is 0 all interrupts are disabled regardless of
whether an individual interrupt is enabled by setting a lower bit.
P3 (PORT 3, ADDRESS B0H, and BIT-ADDRESSABLE):

This is input/output port 3. Each bit of this SFR corresponds to one of the pins on the
microcontroller. For example, bit 0 of port 3 is pin P3.0, bit 7 is pin P3.7. Writing a value of 1 to
a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to a low level.

IP (INTERRUPT PRIORITY, ADDRESSES B8H, BIT-ADDRESSABLE):

The Interrupt Priority SFR is used to specify the relative priority of each interrupt. On the 8051,
an interrupt may either be of low (0) priority or high (1) priority. An interrupt may only interrupt
interrupts of lower priority. For example, if we configure the 8051 so that all interrupts are of
low priority except the serial interrupt, the serial interrupt will always be able to interrupt the
system, even if another interrupt is currently executing. However, if a serial interrupt is
executing no other interrupt will be able to interrupt the serial interrupt routine since the serial
interrupt routine has the highest priority.

PSW (PROGRAM STATUS WORD, ADDRESSES D0H, BIT-ADDRESSABLE):

The Program Status Word is used to store a number of important bits that are set and cleared by
8051 instructions. The PSW SFR contains the carry flag, the auxiliary carry flag, the overflow
flag, and the parity flag. Additionally, the PSW register contains the register bank select flags,
which are used to select, which of the "R" register banks are currently selected.

ACC (ACCUMULATOR, ADDRESSES E0H, BIT-ADDRESSABLE):


The Accumulator is one of the most-used SFRs on the 8051 since it is involved in so many
instructions. The Accumulator Resides as an SFR at E0h, which means the instruction MOV A,
#20h is really the same as MOV E0h, #20h. However, it is a good idea to use the first method
since it only requires two bytes whereas the second option requires three bytes.

BASIC REGISTERS
THE ACCUMULATOR
The Accumulator, as its name suggests, is used as a general register to accumulate the results of
a large number of instructions. It can hold an 8-bit (1-byte) value and is the most versatile
register the 8051 has due to the shear number of instructions that make use of the accumulator.
More than half of the 8051s 255 instructions manipulate or use the accumulator in some way.

For example, if you want to add the number 10 and 20, the resulting 30 will be stored in the
Accumulator. Once you have a value in the Accumulator you may continue processing the value
or you may store it in another register or in memory.

THE DATA POINTER (DPTR)


The Data Pointer (DPTR) is the 8051s only user-accessible 16-bit (2-byte) register. The
Accumulator, "R" registers, and "B" register are all 1-byte values.

DPTR, as the name suggests, is used to point to data. It is used by a number of commands, which
allow the 8051 to access external memory. When the 8051 accesses external memory, it will
access external memory at the address indicated by DPTR. While DPTR is most often used to
point to data in external memory, many programmers often take advantage of the fact that it’s the
only true 16-bit register available. It is often used to store 2-byte values, which have nothing to
do with memory locations.

THE PROGRAM COUNTER (PC)


The Program Counter (PC) is a 2-byte address, which tells the 8051 where the next instruction to
execute is found in memory. When the 8051 is initialized PC always starts at 0000h and is
incremented each time an instruction is executed. It is important to note that PC isn’t always
incremented by one. Since some instructions require 2 or 3 bytes the PC will be incremented by
2 or 3 in these cases.

The Program Counter is special in that there is no way to directly modify its value. That is to say,
you can’t do something like PC=2430h. On the other hand, if you execute LJMP 2430h you’ve
effectively accomplished the same thing.
It is also interesting to note that while you may change the value of PC (by executing a jump
instruction, etc.) there is no way to read the value of PC. That is to say, there is no way to ask the
8051 "What address are you about to execute?" As it turns out, this is not completely true: There
is one trick that may be used to determine the current value of PC. This trick will be covered in a
later chapter.

THE STACK POINTER (SP)


The Stack Pointer, like all registers except DPTR and PC, may hold an 8-bit (1-byte) value. The
Stack Pointer is used to indicate where the next value to be removed from the stack should be
taken from. When you push a value onto the stack, the 8051 first increments the value of SP and
then stores the value at the resulting memory location. When you pop a value off the stack, the
8051 returns the value from the memory location indicated by SP and then decrements the value
of SP.

This order of operation is important. When the 8051 is initialized SP will be initialized to 07h. If
you immediately push a value onto the stack, the value will be stored in Internal RAM address
08h. This makes sense taking into account what was mentioned two paragraphs above: First the
8051 will increment the value of SP (from 07h to 08h) and then will store the pushed value at
that memory address (08h).

SP is modified directly by the 8051 by six instructions: PUSH, POP, ACALL, LCALL, RET,
and RETI. It is also used intrinsically whenever an interrupt is triggered.

SERIAL COMMUNICATION WITH COMPUTER

DATA COMMUNICATION CONCEPT

Within a microcomputer data is transferred in parallel, because that is the fastest way to do it.
For transferring data over long distances, however, parallel data transmission requires too many
wires. Therefore, data to be sent long distances is usually converted from parallel form to serial
form so that it can be sent on a single wire or pair of wires. Serial data received from a distant
source is converted to parallel form so that it can be easily transferred on the microcomputer
buses.

SERIAL COMMUNICATION using RS-232 & DB 9

START & STOP BITS


Asynchronous serial data communication is widely used for character-oriented transmission,
while block-oriented data transfers use the synchronous method. In the
asynchronous method each character is placed between a start and stop bits. This is called
Framing.
In asynchronous serial communications, peripherals chips and modems can be programmed for
data that is 7 or bits wide. This is in addition to the number of stop bits, 1 or 2. While in older
systems ASCII characters were 7-bit, in recent years due to the extended ASCII characters, 8-bit
data has become common.
Therefore, for each bit character there are an extra 2 bits, which gives 25% overhead.

RS232 SERIAL CONNECTOR PIN ASSIGNMENT


The RS232 connector was originally developed to use 9 pins. In this DB9 connector pin
out provisions were made for a secondary serial RS232 communication channel. In practice, only
one serial communication channel with accompanying handshaking is present. Only very few
computers have been manufactured where both serial RS232 channels are implemented.
Examples of this are the Sun SPARCstation 10 and 20 models and the Dec Alpha Multia. Also
on a number of Telebit modem models the secondary channel is present. It can be used to query
the modem status while the modem is on-line and busy communicating. On personal computers,
the smaller DB9 version is more commonly used today. The diagrams show the signals common
to both connector types in black. The defined pins only present on the larger connector are
shown in red. Note, that the protective ground is assigned to a pin at the large connector where
the connector outside is used for that purpose with the DB9 connector version.

The pin out is also shown for the DEC modified modular jack. This type of connector has been
used on systems built by Digital Equipment Corporation; in the early day’s one of the leaders in
the mainframe world. Although this serial interface is differential (the receive and transmit have
their own floating ground level which is not the case with regular RS232) it is possible to
connect RS232 compatible devices with this interface because the voltage levels of the bit
streams are in the same range. Where the definition of RS232 focused on the connection of DTE,
data terminal equipment (computers, printers, etc.) with DCE, data communication equipment
(modems), MMJ was primarily defined for the connection of two DTE's directly.

RS 232 Pins (DB-9) :-


Summary:-

The 8051 microcontroller family remains one of the most popular processors in the world. Its
ease of use and relatively high performance make it ideal for many applications, including
portable and handheld products. The introduction of Dallas Semiconductor high-speed
microcontrollers allows a way for existing 8051 designs to improve their power efficiency
without a costly redesign.

The benefits of the high-speed microcontrollers that reduce power consumption can be
summarized as follows:

 A high performance CPU allows the processor clock to be slowed, resulting in the same
level of performance at less power. Alternatively, the performance of an existing system
can be increased without increasing power consumption.

 The high-speed microcontroller incorporates features such as watchdog timers, additional


UARTs, and precision reset circuits. External components consume more power.

 The introduction of two new low-power modes provides a low-power alternative to the
idle mode. In addition to reducing current consumption, power management modes such
as those used in the DS87C520 allow the processor to perform tasks such as polling while
in a low state. Conventional 8051 architectures require the processor to operate at the
maximum clock rate, even if only minimal processing power is required.

The benefits of a programmable clock rate and high-performance core can be combined with the
Stop mode to greatly reduce power consumption. Examples have been presented that show how
energy consumption can be reduced by matching the clock rate of the device to the desired
performance level.
INTRODUCTION TO THE PROJECT

This Project Automatic Room Light Controller with Visitor Counter using Microcontroller is a
reliable circuit that takes over the task of controlling the room lights as well us counting number
of persons/ visitors in the room very accurately. When somebody enters into the room then the
counter is incremented by one and the light in the room will be switched ON and when any one
leaves the room then the counter is decremented by one. The light will be only switched OFF
until all the persons in the room go out. The total number of persons inside the room is also
displayed on the liquid crystal displays.

The microcontroller does the above job. It receives the signals from the sensors, and this signal is
operated under the control of software which is stored in ROM. Microcontroller PHILLIPS
P89V51RD2 continuously monitor the Infrared Receivers, When any object pass through the IR
Receiver's then the IR Rays falling on the receiver are obstructed , this obstruction is sensed by
the Microcontroller.

The transmitter used in our project is an IRled and receiver is a phototransistor. The complete
circuit build around comparator is used to give a signal to microcontroller 8051’s pins. The
controller is further connected to seven segment and relay. On sensing obstruction there is a
change in voltage at phototransistor which acts as a signal to controller and controller increments
the count on LCD. Also on entrance of 1st person the relay is switched on and is switched off
when the count is again zero on the LCD or all people have left the room.

COMPONENTS USED

Components Specification

 Microcontroller- PHILLIPS, P89V51RD2(40 pin)


 Microcontroller base 1(40pin)
 Crystal Oscillator 11.0592 MH
 Sip 4.7k
 Seven segment 2
 DB9 male connector 1
 Transistor BC5478

 LEDs 6
 Resistors 16[10k(7),1k(9)]
 Capacitor 8(5:-10microfarad,2:-33picofarad,1:-104)
 Switch 4 pin(tectile)
 Power Jack 1
 DC Adapter 5V
 Box Header 4(10 pin)
 Connecting Wires -

BLOCK DIAGRAM

TRANSMITTE RECEIVER MICRO DISPLAY


R CONTROLLER

RELAY

BLOCK DIAGRAM DESCRIPTION

The block diagram is broadly divided in 5 parts


TRANSMITTER
IR led is used to transmit infrared rays to receiver. This is also most commonly used in other
devices like remote controls. Its on obstruction of these rays that receiver senses person
entering.IR led is used because of good range and the frequency is also different from the
ordinary room light’s frequency. So there is no fear of intermixing of the two signals.

RECEIVER
Phototransistor is used as a receiver in our project. It receives the infrared light from the led
and produces voltage 0.9v and 3.17 volt resp. photo transistor was used because it responds
very well to the obstruction producing 2 voltages that are quiet differentiable and hence can
be easily sensed by controller. However to increase the range tesop can also be used but it
requires very sophisticated circuitry

MICROCONTROLLER
We have used microcontroller 8051 in our project. It is a 40 pin ic. It requires +5v to
function.The crystal provides a frequency of 11.0592 MHz.There are 4 ports that can be used as
input or output. 20th pin is ground.We have used 2 pins of port 1 to receive input from
phototransistor. 3rd pin of Port3 is connected to relay section.4 th pin of port 3 is connected to 7
segment, acts as a control.Port0 is connected to 7 segment and used to transmit data to 7 segment
for display. The controller plays the most prominent
Role in this project . It is the device that senses the obstruction and sends count to 7 segment as
well as switch on/off relay. This is done by programming 8051 in C.

DISPLAY
The display is used to show the number of times obstruction has been placed or the number of
people entered the room. We have used one LCD as a display. The maximum count possible is
99. Seven segment display can also be used but it will have the maximum count upto 9
only.However 2 seven segment displays can have maximum count upto 99.

RELAY
A relay is usually an electromechanical device that is actuated by an electrical current. The
current flowing in one circuit causes the opening or closing of another circuit. Relays are like
remote control switches and are used in many applications because of their relative simplicity,
long life, and proven high reliability. Relays are used in a wide variety of applications
throughout industry, such as in telephone exchanges, digital computers and automation systems.
The relay is used to switch on or off the room light. It can also be used to operate other devices
like fan, motor etc.
RELAY SECTION

+12V
+12v

IR LED
1

2
5
LED 4148 3 2 3PIN BASE
Q BC547 R 4
Vcc 3
1
2 3 1
1 6 4.7K 2
560 E R
MCT2E R ELAY SPD T
2 5
2

4.7K
1

3 4 1
Q BC547
input from P3.3 560E
3

0
TRANSMITTER(IR led)
The transmitter is an IR led. It is connected to Vcc through resistor of 330 E.this value is chosen
for good intensity of led and according to maximum current capability. When 5 v battery is
connected the led starts emmiting infrared light that is not visible to naked eye but can be seen
through the camera lense. There are 2 leds used . this are for the purpose of identifying weather
person is entering or leaving. It is done through programming .

Common infrared LED that emits infrared rays has the same appearance with visible light LED.
Its appropriate operating voltage is around 1.4v and the current is generally smaller than 20mA.
Current limiting resistances are usually connected in series in the infrared LED circuits to adjust
the voltages, helping the LED.

When using infrared rays to control correspondent unit, the controlling distance is in direct ratio
with the emitting power. In order to lengthen its controlling distance, infrared LED should be
operated under pulse state as the effective transmitting distance of the pulsed light (modulated
light) is in proportion with the wind-induced current of the pulses. Thus, by increasing the peak
value (Ip) of the pulses, the emitting distance of the infrared LED can also be lengthened. One
way to increase Ip is to diminish the duty ratio of the pulse; that is to reduce the width of the
pulse (T).

The duty ratios of the working pulses for some color TV’s infrared remote controllers are
around 1/3-1/4; and for some other electronic products, the duty ratios of the infrared remote
controllers can even be as small as 1/10. Through reducing the duty ratio of the pulses, the
emitting distance for small power infrared LED can also be increased in a large extent.

Ordinary infrared LEDs can be divided into the following three types:

 small power one (1mW-10mW),


 medium power LED (10mW-50mW)
 large power LED (50mW-100mW and above). The modulated light can be generated by
adding pulse voltage with specific frequency on the driving diode.

The controller with infrared LED can emit infrared rays to take control of correspondent unit,
and at the controlled unit end, there is also a receiving device to turn the infrared light into
electricity, such as infrared light receiving diode, photoelectric triode and so on. Emitting and
receiving matched infrared diode has also been applied in practical use.

There are a couple key differences in the electrical characteristics of infrared LEDs versus visible
light LEDs. Infrared LEDs have a lower forward voltage, and a higher rated current compared to
visible LEDs. This is due to differences in the material properties of the junction. A typical drive
current for an infrared LED can be as high as 50 milliamps, so dropping in a visible LED as a
replacement for an infrared LED could be a problem with some circuit designs.

IR LEDs aren’t rated in millicandelas, since their output isn’t visible (and candelas measure light
in a way weighted to the peak of the visible spectrum). They are usually rated in milliwatts, and
conversions to canelas aren’t especially meaningful.

RECEIVER (PHOTO TRANSISTOR)

Receiver used is a phototransistor L14G3. Photo transistor was used because it responds very
well to the obstruction producing 2 voltages that are quiet differentiable and hence can be easily
sensed by controller.There are 2 phototransistors to differentiate person entering or exiting.
When IR signal of the first led is obstructed means the person is entering but when the light from
second led is cut first then person is leaving and counter should decrement.

Phototransistors also consist of a photodiode with internal gain. A phototransistor is in essence


nothing more than a bipolar transistor that is encased in a transparent case so that light can reach
the base-collector junction. The electrons that are generated by photons in the base-collector
junction are injected into the base, and this photodiode current is amplified by the transistor's
current gain β (or hfe). Note that while phototransistors have a higher responsivity for light they
are not able to detect low levels of light any better than photodiodes.Phototransistors also have
slower response times.

Like diodes, all transistors are light-sensitive. Phototransistors are designed specifically to take
advantage of this fact. The most-common variant is an NPN bipolar transistor with an exposed
base region. Here, light striking the base replaces what would ordinarily be voltage applied to the
base -- so, a phototransistor amplifies variations in the light striking it. Note that phototransistors
may or may not have a base lead (if they do, the base lead allows you to bias the phototransistor's
light responseNote that photodiodes also can provide a similar function, although with much
lower gain (i.e., photodiodes allow much less current to flow than do phototransistors). You can
use this diagram to help you see the difference (both circuits are equivalent):

MICROCONTROLLER
MICROCONTROLLER 8051 used in the project is a 40 pin IC. It requires +5v to function.The
crystal provides a frequency of 11.0592 MHz.There are 4 ports that can be used as input or
output. 20th pin is ground.We have used 2 pins of port 1 to receive input from phototransistor.
3rd pin of Port3 is connected to relay section.4 th pin of port 3 is connected to LCD, acts as a
control.

PIN DESCRIPTION OF THE P89V51RD2

VCC:
Pin 40 provides supply voltage to the chip. The voltage source is +5 Volts.

GND:
Pin 20 is the ground.

XTAL1 and XTAL2:


The 8051 has an on chip oscillator but requires an external clock to run it. Most often a quartz
crystal oscillator is connected to inputs XTAL1 (pin 19) and XTAL2 (pin 18). The quartz crystal
oscillator connected to XTAL1 and XTAL2 also needs two capacitors of 30 pf value. One side of
each capacitor is connected to the ground. Speed refers to the maximum oscillator frequency
connected to XTAL .When the 8051 is connected to a crystal oscillator is powered up we can
observe the frequency on the XTAL2 pin using the oscilloscope.

RST:
Pin 9 is the RESET pin. It is an input and is active high. Upon applying a high pulse to this pin
the microcontroller well reset and terminate all activities. This is often referred to as a power on
reset .Activating a power on reset will cause all values the registers to be lost. It will set program
counter to all 0s.
In order for the RESET input to be effective it must have a minimum duration of two machine
cycles. In other words the high pulse must be high for a minimum of two machine cycles before
it is allowed to go low.

EA:
The 8051 family members such as the 8751/52, 89C51/52 or DS89C4*0 all come with on chip
ROM to store programs. In such cases the EA pin is connected to Vcc. For family members such
as the 8031 and 8032 in which there is no on chip ROM, code is stored on an external ROM and
is fetched by 8031/32. Therefore for the 8031 the EA pin must be connected to GND to indicate
that the code is stored externally. EA which stands for “external access” is pin number 31 in the
DIP packages. It is an input pin and must be connected to either Vcc or GND. In other words it
can not be unconnected.

PSEN:
This is an output pin. PSEN stands for “program store enable”. In an 8031 based system in which
an external ROM holds the program code, this pin is connected to the OE pin of the ROM.

ALE:
ALE stands for “address latch enable. It is an output pin and is active high. When connecting an
8031 to external memory, port 0 provides both address and data. In other words the 8031
multiplexes address and data through port 0 to save pins. The ALE pin is used for de-
multiplexing the address and data by connecting to G pin of the 74LS373 chip.

PORTS 0,1,2,3:
All the ports upon RESET are configured as input, since P0-P3 have value FFH on them. The
following is a summary of features of P0-P3.

PORT 0:
Port 0 is also designated as AD0-AD7 allowing it to be used for both address and data. When
connecting an 8051/31 to an external memory, port 0 provides both address and data. The 8051
multiplexes address and data through port 0 to save pins. ALE indicates if p0 has address A0-
A7.in the 8051 based systems where there is no external memory connection the pins of P0 must
be connected externally to 10k-ohm pull-up resistor. This is due to the fact that P0 is an open
drain, unlike P1, P2 and P3. Open drain is a term used for MOS chips in the same way that open
collector is used for TTL chips. In many systems using the 8751, 89c51 or DS89c4*0 chips we
normally connect P0 to pull up resistors.

PORT 1, PORT 2:
In 8051 based systems with no external memory connection both P1 and P2 are used as simple
I/O. however in 8031/51 based systems with external memory connections P2 must be used
along with P0 to provide the 16-bit address for the external memory. P2 is also designated as
A8-A15 indicating its dual function. Since an 8031/51 is capable of accessing 64k bytes of
external memory it needs a path for the 16 bits of address. While P0 provides the lower 8 bits via
A0-a7 it is the job P2 to provide bits A8-A15 of the address. In other words when the 8031/51 is
connected to external memory P2 is used for the upper 8 bits of the 16 bit address and it cannot
be used for I/O.

PORT 3:
Port 3 occupies a total of 8 pins 10 through 17. It can be used as input or output. P3 does not
need any pull-up resistors the same as P1 and P2 did not. Although port 3 is configured as input
port upon reset this is not the way it is most commonly used. Port 3 has the additional function of
providing some extremely important signals such as interrupts.

Port 3 Alternate functions:


P3 Bit Function Pin
P3.0 RxD 10
P3.1 TxD 11
P3.2 INT0 12
P3.3 INT1 13
P3.4 T0 14
P3.5 T1 15
P3.6 WR 16
P3.7 RD 17

The controller plays the most prominent role in this project . It is the device that senses the
obstruction and sends count to LCD as well as switch on/off relay. This is done by programming
8051 in C. The 2 voltage levels at the output pin of comparator are used as a signal to controller.
The controller differentiates the 2 voltages and according to the program performs the function.
Its programmed to switch on the relay on obstruction of ir first time and show count on 7
segment by sending the code for ‘1’.
Pull up resistor of 10k is used on port0 so as to pull up the voltage level. Otherwise port0
remains in the intermediate state and cannot differentiate between 2 levels. Other ports have
internal pull up resistors.

 8-bit data bus - It can access 8 bits of data in one operation (hence it is an 8-bit
microcontroller)
 16-bit address bus - It can access 216 memory locations - 64 kB each of RAM and ROM
 On-chip RAM - 128 bytes ("Data Memory")
 On-chip ROM - 4 kB ("Program Memory")
 Four byte bi-directional input/output port
 UART (serial port)
 Two 16-bit Counter/timers
 Two-level interrupt priority
 Power saving mode
 It provides many functions (CPU, RAM, ROM, I/O, interrupt logic, timer, etc.) in a
single package
 8-bit data bus - It can access 8 bits of data in one operation (hence it is an 8-bit
microcontroller)
 16-bit address bus - It can access 216 memory locations - 64 kB each of RAM and ROM
 On-chip RAM - 128 bytes ("Data Memory")
 On-chip ROM - 4 kB ("Program Memory")
 Four byte bi-directional input/output port
 UART (serial port)
 Two 16-bit Counter/timers
 Two-level interrupt priority
 Power saving mode

RELAY SECTION

A relay is usually an electromechanical device that is actuated by an electrical current. The


current flowing in one circuit causes the opening or closing of another circuit. Relays are like
remote control switches and are used in many applications because of their relative simplicity,
long life, and proven high reliability. Relays are used in a wide variety of applications
throughout industry, such as in telephone exchanges, digital computers and automation systems.
Highly sophisticated relays are utilized to protect electric power systems against trouble and
power blackouts as well as to regulate and control the generation and distribution of power. In
the home, relays are used in refrigerators, washing machines and dishwashers, and heating and
air-conditioning controls. Although Relays are generally associated with electrical circuitry,
there are many other types, such as pneumatic and hydraulic. Input may be electrical and output
directly mechanical, or vice versa.

How do relays work?


All relays contain a sensing unit, the electric coil, which is powered by AC or DC current. When
the applied current or voltage exceeds a threshold value, the coil activates the armature, which
operates either to close the open contacts or to open the closed contacts. When a power is
supplied to the coil, it generates a magnetic force that actuates the switch mechanism. The
magnetic force is, in effect, relaying the action from one circuit to another. The first circuit is
called the control circuit; the second is called the load circuit.
There are three basic functions of a relay: On/Off Control, Limit Control and Logic Operation.
On/Off Control: Example: Air conditioning control, used to limit and control a “high power”
load, such as a compressor
Limit Control:
Example: Motor Speed Control, used to disconnect a motor if it runs slower or faster than the
desired speed
Logic Operation:
Example: Test Equipment, used to connect the instrument to a number of testing points on the
device under test.
Types of Relays:
There are two basic classifications of relays:
Electromechanical and Solid State.
Electromechanical relays have moving parts, whereas solid state relays have no moving parts.
Advantages of Electromechanical relays include lower cost, no heat sink is required, multiple
poles are available, and they can switch AC or DC with equal ease.
A.) Electromechanical Relays
General Purpose Relay:
The general-purpose relay is rated by the amount of current its switch contacts can handle. Most
versions of the general-purpose relay have one to eight poles and can be single or double throw.
These are found in computers, copy machines, and other consumer electronic equipment and
appliances.

Power Relay:
The power relay is capable of handling larger power loads – 10-50 amperes or more. They are
usually single-pole or double-pole units.

Contactor:
A special type of high power relay, it’s used mainly to control high voltages and currents in
industrial electrical applications. Because of these high power requirements, contactors always
have double-make contacts.

Time-Delay Relay:
The contacts might not open or close until some time interval after the coil has been energized.
This is called delay-on-operate. Delay-on-release means that the contacts will remain in their
actuated position until some interval after the power has been removed from the coil. A third
delay is called interval timing. Contacts revert to their alternate position at a specific interval of
time after the coil has been energized. The timing of these actions may be a fixed parameter of
the relay, or adjusted by a knob on the relay itself, or remotely adjusted through an external
circuit.
B.) Solid State Relays

These active semiconductor devices use light instead of magnetism to actuate a switch. The light
comes from an LED, or light emitting diode. When control power is applied to the device’s
output, the light Solid State Relays is turned on and shines across an open space. On the load side
of this space, a part of the device senses the presence of the light, and triggers a solid state switch
that either opens or closes the circuit under control. Often, solid state relays are used where the
circuit under control must be protected from the introduction of electrical noises. Advantages of
Solid State Relays include low EMI/RFI, long life, no moving parts, no contact bounce, and fast
response. The drawback to using a solid state relay is that it can only accomplish single pole
switching.

In our project earlier relay operates on +5v but when microcontroller gives signal it acts as
switch and switches to +12v or 220 v state(as given). So initially on 3 pin base 1st and 2nd pins are
short but later 2nd and 3rd are short.

OPTOCOUPLER MCT2E

Features

2500 or 1500 V Isolation.


High DC Current Transfer Ratio.
Low Cost Dual-In-Line Package.
Description

The MCT2E, MCT2 are optically coupled isolators consisting of a Gallium Arsenide infrared
emitting diode and an NPN silicon phototransistor mounted in a standard 6-pin dual-in-line
package. Surface Mount Option Available.

It is used to prevent back emf from reaching microcontroller. Since there is no physical
connectivity between pin 1 and pin2 there is a led and between 5 and 4 there is a transistor
BC547.
when input to optocoupler is 0 output at pin 5 and 4 is 5v, when input is 5v output is 1.1v instead
of 0v but 560 ohm causes drop across it and hence 0v at base of 2 nd transistor as a result its open
base and path from collector to emitter to ground. So it is used to provide perfect ground.
There is a 4.7 k resistor used for biasing the transistor in MCT2E.
Diode 4148 is a current limiter used in reverse bias. LED is just for indication.
The devices like motor,bulb,fan can be connected to pin 1 and 2.

LIQUID CRYSTAL DISPLAYS


LCDs with a small number of segments, such as those used in digital watches and pocket
calculators, have individual electrical contacts for each segment. An external dedicated circuit
supplies an electric charge to control each segment. This display structure is unwieldy for more
than a few display elements.

Small monochrome displays such as those found in personal organizers, electronic weighing
scales, older laptop screens, and the original Gameboy have a passive-matrix structure
employing super-twisted nematic (STN) or double-layer STN (DSTN) technology—the latter of
which addresses a colour-shifting problem with the former—and colour-STN (CSTN)—wherein
colour is added by using an internal filter. Each row or column of the display has a single
electrical circuit. The pixels are addressed one at a time by row and column addresses. This type
of display is called passive-matrix addressed because the pixel must retain its state between
refreshes without the benefit of a steady electrical charge. As the number of pixels (and,
correspondingly, columns and rows) increases, this type of display becomes less feasible. Very
slow response times and poor contrast are typical of passive-matrix addressed LCDs. Colour
passive-matrix displays exist, although they are limited to 16 colours.

Monochrome passive-matrix LCDs were standard in most early laptops (although a few used
plasma displays). The commercially unsuccessful Macintosh Portable (released in 1989) was one
of the first to use an active-matrix display (though still monochrome), but passive-matrix was the
norm until the mid-1990s, when colour active-matrix became standard on all laptops.

High-resolution colour displays such as modern LCD computer monitors and televisions use an
active matrix structure. A matrix of thin-film transistors (TFTs) is added to the polarizing and
colour filters. Each pixel has its own dedicated transistor, allowing each column line to access

one pixel. When a row line is activated, all of the column lines are connected to a row of pixels
and the correct voltage is driven onto all of the column lines. The row line is then deactivated
and the next row line is activated. All of the row lines are activated in sequence during a refresh
operation. Active-matrix addressed displays look "brighter" and "sharper" than passive-matrix
addressed displays of the same size, and generally have quicker response times, producing much
better images.

STEPS TO WRITE A PROGRAM IN COMPILER


Compiler: KEIL

1. Double Click on the icon present on the desktop.

2. The following window will be popped-up


3. Go to the project & click on new project

4. Make a folder on desktop & give file name.


5. When we click on the save button ,following window opens
6. Select Philips & P89V51RD2
7. Then select NO on the pop-up given below.

8. Then make a New File.


9. Write or copy your gsm code there & save it with extension .c or .asm
depending on our coding.

10.Go to target & then source group, right click on there & click on the option
add files to the project.
11.Select your asm or c file which you want to add.
12.Go to the option for target, click on output &tick on create hex file option
13.Now build target.
(Click on the pointed option)..

14.It will show you 0 errors & 0 warning on Output Window.

↑↑

Special Notes: -

 Make all the DIP switches in off position before burning the program in the controller.
 Connect the Programming Cable on your Kit (prog. Conn.)And other side of cable with
the COM Port of the Computer.

 Burn the Program in the microcontroller with help of ECE FLASH .

PROGRAM CODE

#include<reg51.h>
sbit rs=P1^0;
sbit en=P1^1;
sbit ir1=P3^2;
sbit ir2=P3^3;
sbit relay=P2^3;
unsigned int count,j;
void cmd( )
{
rs=0;
en=1;
en=0;
}
void data1( )
{
rs=1;
en=1;
en=0;
}
void delay( )
{
int i;
for(i=0;i<30000;i++);
}
unsigned int a,b,c,d,e;
char str[17]={“welcm to project”};
char str1[13]={“By GNDU gang”};
char str2[16]={“Persons inside=”};
char str3[11]={“Hall Empty”};
char str4[10]={“Hall Full”};
void start( )
{
P0=0x38;
cmd( );
delay( );
P0=0x06;
cmd( );
delay( );
P0=0x01;
cmd( );
delay( );
P0=0x0e;
cmd( );
delay( );
}
void main( )
{
P3=0xff;
relay=0;
start( );
a=0;b=0;
P0=0x80;
cmd( );
delay( );
for(j=0;j<17;j++)
{
P0=str[j];
data1( );
delay( );
}
P0=0xc0;
cmd( );
delay( );
for(j=0;j<13;j++)
{
P0=str1[j];
data1( );
delay( );
}
delay( );
while(1)
{
e: if(ir1==0)
{
P0=0x01;
cmd( );

delay( );
while( ir2==1);
count++;
relay=1;
if(count==100)
{
goto d;
}
goto s;
}
if(ir2==0)
{
P0=0x01;
cmd( );
delay( );
while(ir1==1);
count--;
if(count==0)
{
goto t;
}
goto s;
}
}
s: P0=0x80;
cmd( );
delay( );
for(j=0;j<16;j++)
{
P0=str2[j];
data1( );
delay( );
}
P0=0xc6;
cmd( );
delay( );
P0=(count/10)+0x30;
data1( );
delay( );
P0=(count%10)+0x30;
data1( );
delay( );
goto e;
t: relay=0;
P0=0x01;
cmd( );
delay( );
P0=0x80;
cmd( );
delay( );
for(j=0;j<11;j++)
{
P0=str3[j];
data1( );
delay( );
}
goto e;
d: P0=0x01;
cmd( );
delay( );
P0=0x80;
cmd( );
delay( );
for(j=0;j<10;j++)
{
P0=str4[j];
data1( );
delay( );
}
goto e;
}

FUTURE SCOPE AND APPLICATIONS

In today’s world ,there is a continuous need for automatic aapliances with increase in
standard of living,there is sense of urgency for developing circuits that would ease the
complexity of life. Automatic Room Light Contol With Visitor Counter is one of such automatic
appliance which would ease the complexity of life. Its future scope and applications are as
follows:-

 SPACE MANAGEMENT
It can be used to count the average number of people entering the store/showroom or where
ever its installed and then manage the area according to that. It can also be used for
managing parking space according to the number of vehicles entering .

 AUTOMATIC DOOR OPENER


This project can be used as automatic door opener after little modifications. If one of the
receivers is installed before the gate and on sensing obstruction the door opens by the lever
that is attached to relay controlled by microcontroller. It can be used in showrooms
/hotels/airport/garages etc.

 CINEMA HALLS/AUDITORIUM
Cinemas and auditorium are another application areas of this project. When people equal to
half the number of seats (depending on how its programmed) enter, the lights go off.

 VISITOR COUNTER
A part of this, visitor counter can be used to count number of people entering some public
places , exibitions to know its popularity among people.

REFERENCES
 8051 microcontroller and embedded systems by Ali Mazidi

You might also like