Top Banner
TRAFFIC CLEARANCE FOR VIP’S VEHICLES WITH DTMF The main aim of this project is to control the traffic whenever the VIP vehicle will come in that way. The purpose of this project is to overcome the draw backs in the normal traffic controlling system and to design traffic controlling system to enter the password which overcomes the problem of heavy traffic in the cities for VIPs. The main objective of this project is to control the traffic, whenever any time any VIP is coming in that way just they enter the password according to that , in that particular way green light will be ON for clearing the traffic and remaining ways stopped by indicating red light. Whenever enter the password that should be displayed in the LCD. Whenever VIPs entering in that particular way then entered the password for exiting in that way then also they can enter the password. The same procedure will be followed by four sides of the road. The signaling from the four sides will be taken into consideration. BLOCKDIAGRAM:
83
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 2.Traffic Clearance for VIPs Vehicles With DTMF

TRAFFIC CLEARANCE FOR VIP’S

VEHICLES WITH DTMF The main aim of this project is to control the traffic whenever the VIP vehicle will

come in that way. The purpose of this project is to overcome the draw backs in the

normal traffic controlling system and to design traffic controlling system to enter the

password which overcomes the problem of heavy traffic in the cities for VIPs.

The main objective of this project is to control the traffic, whenever any time any VIP is

coming in that way just they enter the password according to that , in that particular way

green light will be ON for clearing the traffic and remaining ways stopped by indicating

red light. Whenever enter the password that should be displayed in the LCD. Whenever

VIPs entering in that particular way then entered the password for exiting in that way

then also they can enter the password. The same procedure will be followed by four sides

of the road. The signaling from the four sides will be taken into consideration.

BLOCKDIAGRAM:

SIGNALLING SYSTEM

LCD

DTMFDECODER

MOBILEPHONE

POWER SUPPLY MICROCONTROLLER

Page 2: 2.Traffic Clearance for VIPs Vehicles With DTMF

DESCRIPTION:

HARDWARE USED:

MICRO CONTROLLER 89C51

INTRODUCTION

A Micro controller consists of a powerful CPU tightly coupled with memory, various I/O interfaces such as serial port, parallel port timer or counter, interrupt controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog converter, integrated on to a single silicon chip.

If a system is developed with a microprocessor, the designer has to go for external memory such as RAM, ROM, EPROM and peripherals. But controller is provided all these facilities on a single chip. Development of a Micro controller reduces PCB size and cost of design.

One of the major differences between a Microprocessor and a Micro controller is that a controller often deals with bits not bytes as in the real world application.

Intel has introduced a family of Micro controllers called the MCS-51.

The Major Features:

Compatible with MCS-51 products

4k Bytes of in-system Reprogrammable flash memory

Fully static operation: 0HZ to 24MHZ

Three level programmable clock

128 * 8 –bit timer/counters

Six interrupt sources

Programmable serial channel

Low power idle power-down modes

Page 3: 2.Traffic Clearance for VIPs Vehicles With DTMF

AT89C51 is 8-bit micro controller, which has 4 KB on chip flash memory, which is just sufficient for our application. The on-chip Flash ROM allows the program memory to be reprogrammed in system or by conventional non-volatile memory Programmer. Moreover ATMEL is the leader in flash technology in today’s market place and hence using AT 89C51 is the optimal solution.

AT89C51 MICROCONTROLLER ARCHITECTURE

The 89C51 architecture consists of these specific features:

Eight –bit CPU with registers A (the accumulator) and B

Sixteen-bit program counter (PC) and data pointer (DPTR)

Eight- bit stack pointer (PSW)

Eight-bit stack pointer (Sp)

Internal ROM or EPROM (8751) of 0(8031) to 4K (89C51)

Internal RAM of 128 bytes:

Thirty –two input/output pins arranged as four 8-bit ports:p0-p3

Two 16-bit timer/counters: T0 and T1

Full duplex serial data receiver/transmitter: SBUF

Control registers: TCON, TMOD, SCON, PCON, IP, and IE

Two external and three internal interrupts sources.

Oscillator and clock circuits.

Page 4: 2.Traffic Clearance for VIPs Vehicles With DTMF

Fig 3: Functional block diagram of micro controller

Types of memory:

The 89C51 have three general types of memory. They are on-chip memory,

external Code memory and external Ram. On-Chip memory refers to physically existing

memory on the micro controller itself. External code memory is the code memory that

resides off chip. This is often in the form of an external EPROM. External RAM is the

Ram that resides off chip. This often is in the form of standard static RAM or flash

RAM.

a) Code memory

Code memory is the memory that holds the actual 89C51 programs that is to be

run. This memory is limited to 64K. Code memory may be found on-chip or off-chip. It

is possible to have 4K of code memory on-chip and 60K off chip memory

simultaneously. If only off-chip memory is available then there can be 64K of off chip

ROM. This is controlled by pin provided as EA.

b) Internal RAM

Page 5: 2.Traffic Clearance for VIPs Vehicles With DTMF

The 89C51 have a bank of 128 of internal RAM. The internal RAM is found on-

chip. So it is the fastest Ram available. And also it is most flexible in terms of reading

and writing. Internal Ram is volatile, so when 89C51 is reset, this memory is cleared. 128

bytes of internal memory are subdivided. The first 32 bytes are divided into 4 register

banks. Each bank contains 8 registers. Internal RAM also contains 128 bits, which are

addressed from 20h to 2Fh. These bits are bit addressed i.e. each individual bit of a byte

can be addressed by the user. They are numbered 00h to 7Fh. The user may make use of

these variables with commands such as SETB and CLR.

Flash memory is a nonvolatile memory using NOR technology, which allows the

user to electrically program and erase information. Flash memory is used in digital

cellular phones, digital cameras, LAN switches, PC Cards for notebook computers,

digital set-up boxes, embedded controllers, and other devices.

Fig 5: - Pin diagram of AT89C51

Pin Description:

Page 6: 2.Traffic Clearance for VIPs Vehicles With DTMF

VCC: Supply voltage.

GND: Ground.

Port 0:

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

can sink eight TTL inputs. When 1sare written to port 0 pins, the pins can be used as high

impedance inputs. Port 0 may also be configured to be the multiplexed low order

address/data bus during accesses to external program and data memory. In this mode P0

has internal pull-ups. Port 0 also receives the code bytes during Flash programming, and

outputs the code bytes during program verification. External pull-ups are required during

program verification.

Port 1:

Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output

buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are

pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that

are externally being pulled low will source current (IIL) because of the internal pull-ups.

Port 1 also receives the low-order address bytes during Flash programming and

verification.

Port 2:

Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output

buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are

pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that

are externally being pulled low will source current (IIL) because of the internal pull-ups.

Port 3:

Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output

buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are

pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that

are externally being pulled low will source current (IIL) because of the pull-ups.

Port 3 also serves the functions of various special features of the AT89C51 as listed

below:

Page 7: 2.Traffic Clearance for VIPs Vehicles With DTMF

Tab 6.2.1 Port pins and their alternate functions

RST:

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

running resets the device.

ALE/PROG:

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

accesses to external memory. This pin is also the program pulse input (PROG) during

Flash programming. In normal operation ALE is emitted at a constant rate of 1/6the

oscillator frequency, and may be used for external timing or clocking purposes. Note,

however, that one ALE pulse is skipped during each access to external Data Memory.

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

bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is

weakly pulled high. Setting the ALE-disable bit has no effect if the micro controller is in

external execution mode.

PSEN:

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

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

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

external data memory.

EA/VPP:

Page 8: 2.Traffic Clearance for VIPs Vehicles With DTMF

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

device to fetch code from external program memory locations starting at 0000H up to

FFFFH.

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

reset. EA should be strapped to VCC for internal program executions. This pin also

receives the 12-volt programming enable voltage (VPP) during Flash programming, for

parts that require 12-volt VPP.

XTAL1:

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

circuit.

XTAL2:

Output from the inverting oscillator amplifier.

Oscillator Characteristics:

XTAL1 and XTAL2 are the input and output, respectively, of an inverting

amplifier, which can be configured for use as an on-chip oscillator, as shown in Figs 6.1

Either a quartz crystal or ceramic resonator may be used. To drive the device from an

external clock source, XTAL2 should be left unconnected while XTAL1 is driven as

shown in Figure 6.2. There are no requirements on the duty cycle of the external clock

signal, since the input to the internal clocking circuitry is through a divide-by-two flip-

flop, but minimum and maximum voltage high and low time specifications must be

observed.

Fig 6.1 Oscillator Connections Fig 6.2 External Clock Drive Configuration

REGISTERS:

Page 9: 2.Traffic Clearance for VIPs Vehicles With DTMF

In the CPU, registers are used to store information temporarily. That information

could be a byte of data to be processed, or an address pointing to the data to be fetched.

The vast majority of 8051 registers are 8–bit registers.

D7 D6 D5 D4 D3 D2 D1 D0

The most widely used registers of the 8051 are A(accumulator), B, R0, R1, R2,

R3, R4, R5, R6, R7, DPTR(data pointer), and PC(program counter). All of the above

registers are 8-bits, except DPTR and the program counter. The accumulator, register A,

is used for all arithmetic and logic instructions.

SFRs (Special Function Registers)

In the 8051, registers A, B, PSW and DPTR are part of the group of registers

commonly referred to as SFR (special function registers). The SFR can be accessed by

the names (which is much easier) or by their addresses. For example, register A has

address E0h, and register B has been ignited the address F0H, as shown in table.

The following two points should note about the SFR addresses.

1. The Special function registers have addresses between 80H and FFH. These

addresses are above 80H, since the addresses 00 to 7FH are addresses of RAM

memory inside the 8051.

2. Not all the address space of 80H to FFH is used by the SFR. The unused

locations 80H to FFH are reserved and must not be used by the 8051

programmer.

Symbol Name Address

ACC Accumulator 0E0H

B B register 0F0H

PSW Program status word 0D0H

SP Stack pointer 81H

DPTR Data pointer 2 bytes

DPL Low byte 82H

DPH High byte 83H

Page 10: 2.Traffic Clearance for VIPs Vehicles With DTMF

P0 Port0 80H

P1 Port1 90H

P2 Port2 0A0H

P3 Port3 0B0H

IP Interrupt priority control 0B8H

IE Interrupt enable control 0A8H

TMOD Timer/counter mode control 89H

TCON Timer/counter control 88H

T2CON Timer/counter 2 control 0C8H

T2MOD Timer/counter mode2 control 0C9H

TH0 Timer/counter 0high byte 8CH

TL0 Timer/counter 0 low byte 8AH

TH1 Timer/counter 1 high byte 8DH

TL1 Timer/counter 1 low byte 8BH

TH2 Timer/counter 2 high byte 0CDH

TL2 Timer/counter 2 low byte 0CCH

RCAP2H T/C 2 capture register high byte 0CBH

RCAP2L T/C 2 capture register low byte 0CAH

SCON Serial control 98H

SBUF Serial data buffer 99H

PCON Power control 87H

Table: 8051 Special function register Address

A Register (Accumulator):

This is a general-purpose register, which serves for storing intermediate results during

operating. A number (an operand) should be added to the accumulator prior to execute an

instruction upon it. Once an arithmetical operation is preformed by the ALU, the result is

placed into the accumulator

Page 11: 2.Traffic Clearance for VIPs Vehicles With DTMF

B Register

B register is used during multiply and divide operations which can be performed only

upon numbers stored in the A and B registers. All other instructions in the program can

use this register as a spare accumulator (A).

Registers (R0-R7)

Fig7: Memory organization of RAM

This is a common name for the total 8 general purpose registers (R0, R1, R2 ...R7). Even

they are not true SFRs, they deserve to be discussed here because of their purpose. The

bank is active when the R registers it includes are in use. Similar to the accumulator, they

are used for temporary storing variables and intermediate results. Which of the banks will

be active depends on two bits included in the PSW Register. These registers are stored in

four banks in the scope of RAM.

8051 Register Banks and Stack

RAM memory space allocation in the 8051

There are 128 bytes of RAM in the 8051. The 128 bytes of RAM inside the 8051

are assigned addresses 00 to7FH. These 128 bytes are divided into three different groups

as follows:

Page 12: 2.Traffic Clearance for VIPs Vehicles With DTMF

1. A total of 32 bytes from locations 00 to 1FH hex are set aside for register

banks and the stack.

2. A total of 16 bytes from locations 20 to 2FH hex are set aside for bit-

addressable read/write memory.

3. A total of 80 bytes from locations 30H to 7FH are used for read and write

storage, or what is normally called Scratch pad. These 80 locations of RAM

are widely used for the purpose of storing data and parameters nu 8051

programmers.

Default register bank

Register bank 0; that is, RAM locations 0, 1,2,3,4,5,6, and 7 are accessed with the

names R0, R1, R2, R3, R4, R5, R6, and R7 when programming the 8051.

FIG 8: RAM Allocation in the 8051

PSW Register (Program Status Word)

This is one of the most important SFRs. The Program Status Word (PSW) contains

several status bits that reflect the current state of the CPU. This register contains: Carry

bit, Auxiliary Carry, two register bank select bits, Overflow flag, parity bit, and user-

definable status flag. The ALU automatically changes some of register’s bits, which is

usually used in regulation of the program performing.

Page 13: 2.Traffic Clearance for VIPs Vehicles With DTMF

P - Parity bit. If a number in accumulator is even then this bit will be automatically set

(1), otherwise it will be cleared (0). It is mainly used during data transmission and

receiving via serial communication.

OV Overflow occurs when the result of arithmetical operation is greater than 255

(decimal), so that it cannot be stored in one register. In that case, this bit will be set (1). If

there is no overflow, this bit will be cleared (0).

RS0, RS1 - Register bank select bits. These two bits are used to select one of the four

register banks in RAM. By writing zeroes and ones to these bits, a group of registers R0-

R7 is stored in one of four banks in RAM.

RS1 RS2 Space in RAM

0 0 Bank0 00h-07h

0 1 Bank1 08h-0Fh

1 0 Bank2 10h-17h

1 1 Bank3 18h-1Fh

F0 - Flag 0. This is a general-purpose bit available to the user.

AC - Auxiliary Carry Flag is used for BCD operations only.

CY - Carry Flag is the (ninth) auxiliary bit used for all arithmetical operations and shift

instructions.

DPTR Register (Data Pointer)

These registers are not true ones because they do not physically exist. They consist of two

separate registers: DPH (Data Pointer High) and (Data Pointer Low). Their 16 bits are

used for external memory addressing. They may be handled as a 16-bit register or as two

independent 8-bit registers. Besides, the DPTR Register is usually used for storing data

and intermediate results, which have nothing to do with memory locations.

Page 14: 2.Traffic Clearance for VIPs Vehicles With DTMF

SP Register (Stack Pointer)

The stack is a section of RAM used by the CPU to store information temporily.

This information could be data or an address. The CPU needs this storage area since

there are only a limited number of registers.

How stacks are accessed in the 8051

If the stack is a section of RAM, there must be registers inside the CPU to point to

it. The register used to access the stack is called the SP (Stack point) Register. The stack

pointer in the 8051 is only 8 bits wide; which means that it can take values of 00 to FFH.

When the 8051 is powered up, the SP register contains value 07. This means that RAM

location 08 is the first location used for the stack by the 8051. The storing of a CPU

register in the stack is called a PUSH, and pulling the contents off the stack back into a

CPU register is called a POP. In other words, a register is pushed onto the stack to save it

and popped off the stack to retrieve it. The job of the SP is very critical when push and

pop actions are performed.

Program counter:

Page 15: 2.Traffic Clearance for VIPs Vehicles With DTMF

The important register in the 8051 is the PC (Program counter). The program

counter points to the address of the next instruction to be executed. As the CPU fetches

the opcode from the program ROM, the program counter is incremented to point to the

next instruction. The program counter in the 8051 is 16bits wide. This means that the

8051 can access program addresses 0000 to FFFFH, a total of 64k bytes of code.

However, not all members of the 8051 have the entire 64K bytes of on-chip ROM

installed, as we will see soon.

TIMERS

On-chip timing/counting facility has proved the capabilities of the micro

controller for implementing the real time application. These includes pulse counting,

frequency measurement, pulse width measurement, baud rate generation, etc,. Having

sufficient number of timer/counters may be a need in a certain design application. The

8051 has two timers/counters. They can be used either as timers to generate a time delay

or as counters to count events happening outside the micro controller.

TIMER 0 REGISTERS

The 16-bit register of Timer 0 is accessed as low byte and high byte. the low byte

register is called TL0(Timer 0 low byte)and the high byte register is referred to as

TH0(Timer 0 high byte).These register can be accessed like any other register, such as

A,B,R0,R1,R2,etc.

TIMER 1 REGISTERS

Timer 1 is also 16-bit register is split into two bytes, referred to as TL1 (Timer

1 low byte) and TH1 (Timer 1 high byte). These registers are accessible n the same way

as the register of Timer 0.

Page 16: 2.Traffic Clearance for VIPs Vehicles With DTMF

TMOD (timer mode) REGISTER

Both timers 0 and 1 use the same register, called TMOD, to set the various timer

operation modes. TMOD is an 8-bit register in which the lower 4 bits are set aside for

Timer 0 and the upper 4 bits for Timer 1.in each case; the lower 2 bits are used to set the

timer mode and the upper 2 bits to specify the operation.

GATE Gate control when set. The timer/counter is enabled only

while the INTx pin is high and the TRx control pin is

set. When cleared, the timer is enabled.

C/T Timer or counter selected cleared for timer operation

(Input from internal system clock).set for counter

operation (input TX input pin).

M1 M0 MODE Operating Mode

0 0 0 13-bit timer mode

8-bit timer/counter THx with TLx as

5-bit prescaler.

0 1 1 16-bit timer mode

16-bit timer/counters THx with TLx are

cascaded; there is no prescaler

1 0 2 8-bit auto reload

8-bit auto reload timer/counter;THx

Holds a value that is to be reloaded into

TLx each time it overflows.

1 1 3 Split timer mode.

C/T (clock/timer):

This bit in the TMOD register is used to decide whether the timer is used as a delay

generator or an event counter. If C/T=0, it is used as a timer for time delay generation.

The clock source for the time delay is the crystal frequency of the 8051.this section is

Page 17: 2.Traffic Clearance for VIPs Vehicles With DTMF

concerned with this choice. The timer’s use as an event counter is discussed in the next

section.

Serial Communication:

Serial data communication uses two methods, asynchronous and synchronous.

The synchronous method transfers a block of data at a time, while the asynchronous

method transfers a single byte at a time.

In data transmission if the data can be transmitted and received, it is a duplex

transmission. This is in contrast to simplex transmissions such as with printers, in which

the computer only sends data. Duplex transmissions can be half or full duplex,

depending on whether or not the data transfer can be simultaneous. If data is transmitted

one way at a time, it is referred to as half duplex. If the data can go both ways at the

same time, it is full duplex. Of course, full duplex requires two wire conductors for the

data lines, one for transmission and one for reception, in order to transfer and receive data

simultaneously.

Asynchronous serial communication and data framing

The data coming in at the receiving end of the data line in a serial data transfer is

all 0s and 1s; it is difficult to make sense of the data unless the sender and receiver agree

on a set of rules, a protocol, on how the data is packed, how many bits constitute a

character, and when the data begins and ends.

Start and stop bits

Asynchronous serial data communication is widely used for character-oriented

transmissions, while block-oriented data transfers use the synchronous method. In the

asynchronous method, each character is placed between start and stop bits. This is called

framing. In the data framing for asynchronous communications, the data, such as ASCII

characters, are packed between a start bit and a stop bit. The start bit is always one bit,

but the stop bit can be one or two bits. The start bit is always a 0 (low) and the stop bit

(s) is 1 (high).

Data transfer rate

Page 18: 2.Traffic Clearance for VIPs Vehicles With DTMF

The rate of data transfer in serial data communication is stated in bps (bits per

second). Another widely used terminology for bps is baud rate. However, the baud and

bps rates are not necessarily equal. This is due to the fact that baud rate is the modem

terminology and is defined as the number of signal changes per second. In modems a

single change of signal, sometimes transfers several bits of data. As far as the conductor

wire is concerned, the baud rate and bps are the same, and for this reason we use the bps

and baud interchangeably.

RS232 Standards

To allow compatibility among data communication equipment made by various

manufacturers, an interfacing standard called RS232 was set by the Electronics Industries

Association (EIA) in 1960. In 1963 it was modified and called RS232A. RS232B AND

RS232C were issued in 1965 and 1969, respectively. Today, RS232 is the most widely

used serial I/O interfacing standard. This standard is used in PCs and numerous types of

equipment. However, since the standard was set long before the advert of the TTL logic

family, its input and output voltage levels are not TTL compatible. In RS232, a 1 is

represented by -3 to -25V, while a 0 bit is +3 to +25V, making -3 to +3 undefined. For

this reason, to connect any RS232 to a micro controller system we must use voltage

converters such as MAX232 to convert the TTL logic levels to the RS232 voltage levels,

and vice versa. MAX232 IC chips are commonly referred to as line drivers.

RS232 pins

RS232 cable, commonly referred to as the DB-25 connector. In labeling, DB-25P refers to the plug connector (male) and DB-25S is for the socket connector (female). Since not all the pins are used in PC cables, IBM introduced the DB-9 Version of the serial I/O standard, which uses 9 pins only, as shown in table.

DB-9 pin connector

1 2 3 4 5

Page 19: 2.Traffic Clearance for VIPs Vehicles With DTMF

6 7 8 9

Fig 10: DB-9 pin connector

(Out of computer and exposed end of cable)

Pin Functions:

Pin Description

1 Data carrier detect (DCD)

2 Received data (RXD)

3 Transmitted data (TXD)

4 Data terminal ready(DTR)

5 Signal ground (GND)

6 Data set ready (DSR)

7 Request to send (RTS)

8 Clear to send (CTS)

9 Ring indicator (RI)

Note: DCD, DSR, RTS and CTS are active low pins.

The method used by RS-232 for communication allows for a simple connection of three

lines: Tx, Rx, and Ground. The three essential signals for 2-way RS-232

Communications are these:

TXD: carries data from DTE to the DCE.

RXD: carries data from DCE to the DTE

SG: signal ground

8051 connection to RS232

The RS232 standard is not TTL compatible; therefore, it requires a line driver

such as the MAX232 chip to convert RS232 voltage levels to TTL levels, and vice versa.

The interfacing of 8051 with RS232 connectors via the MAX232 chip is the main topic.

The 8051 has two pins that are used specifically for transferring and receiving

data serially. These two pins are called TXD and RXD and a part of the port 3 group

Page 20: 2.Traffic Clearance for VIPs Vehicles With DTMF

(P3.0 and P3.1). pin 11 of the 8051 is assigned to TXD and pin 10 is designated as RXD.

These pins are TTL compatible; therefore, they require a line driver to make them RS232

compatible. One such line driver is the MAX232 chip.

Since the RS232 is not compatible with today’s microprocessors and

microcontrollers, we need a line driver (voltage converter) to convert the RS232’s signals

to TTL voltage levels that will be acceptable to the 8051’s TXD and RXD pins. One

example of such a converter is MAX232 from Maxim Corp. The MAX232 converts

from RS232 voltage levels to TTL voltage levels, and vice versa.

Fig 11: Interfacing of MAX-232 to controller

INTERRUPTS

A single micro controller can serve several devices. There are two ways to do that: INTERRUPTS or POLLING.

INTERRUPTS vs POLLING:

The advantage of interrupts is that the micro controller can serve many devices (not

all the same time, of course); each device can get the attention of the micro controller

based on the priority assigned to it. The polling method cannot assign priority since it

checks all devices in round-robin fashion. More importantly, in the interrupt method

the micro controller can also ignore (mask) a device request for service. This is again

not possible with the polling method. The most important reason that the interrupt

method is preferable is that the polling method wastes much of the micro controller’s

Page 21: 2.Traffic Clearance for VIPs Vehicles With DTMF

time by polling devices that do not need service. So, in order to avoid tying down the

micro controller, interrupts are used.

INTERRUPT SERVICE ROUTINE

For every interrupt, there must be an interrupt service routine (ISR), or interrupt handler.

When an interrupt is invoked, the micro controller runs the interrupts service routine. For

every interrupt, there is a fixed location in memory that holds the address of its ISR. The

group of memory location set aside to hold the addresses of ISRs is called the interrupt

vector table. Shown below:

Interrupt Vector Table for the 8051:

INTERRUPT ROM

LOCATION (HEX) PIN FLAG CLEARING

Reset 0000 9 Auto

External hardware

Interrupt 0 0003 P3.2 (12) Auto

Timers 0 interrupt (TF0) 000B Auto

External hardware 0013 P3.3 (13) Auto

Interrupt 1(INT1)

Timers 1 interrupt (TF1) 001B Auto

Serial COM (RI and TI) 0023 Programmer

Clears it

Six Interrupts in the 8051:

In reality, only five interrupts are available to the user in the 8051, but many

manufacturers’ data sheets state that there are six interrupts since they include reset .the

six interrupts in the 8051 are allocated as above.

1. Reset. When the reset pin is activated, the 8051 jumps to address location

0000.this is the power-up reset.

Page 22: 2.Traffic Clearance for VIPs Vehicles With DTMF

2. Two interrupts are set aside for the timers: one for Timer 0 and one for Timer

1.Memory location 000BH and 001BH in the interrupt vector table belong to

Timer 0 and Timer 1, respectively.

3. Two interrupts are set aside for hardware external harder interrupts. Pin number

12(P3.2) and 13(P3.3) in port 3 is for the external hardware interrupts INT0 and

INT1, respectively. These external interrupts are also referred to as EX1 and

EX2.Memory location 0003H and 0013H in the interrupt vector table are assigned

to INT0 and INT1, respectively.

4. Serial communication has a single interrupt that belongs to both receive and

transmit. The interrupt vector table location 0023H belongs to this interrupt.

Interrupt Enable Register

D7 D6 D5 D4 D3 D2 D1 D0

EA IE.7 disables all interrupts. If EA=0, no interrupts is acknowledged.

If EA=1, each interrupt source is individually enabled disabled

By setting or clearing its enable bit.

-- IE.6 Not implemented, reserved for future use.*

ET2 IE.5 Enables or disables Timer 2 overflow or capture interrupt (8052

only).

ES IE.4 Enables or disables the serial ports interrupt.

ET1 IE.3 Enables or disables Timers 1 overflow interrupt

EX1 IE.2 Enables or disables external interrupt 1.

ET0 IE.1 Enables or disables Timer 0 overflow interrupt.

EX0 IE.0 Enables or disables external interrupt 0.

EA -- ET2 ES ET1 EX1 ET0 EX0

Page 23: 2.Traffic Clearance for VIPs Vehicles With DTMF

DTMF-8870

The following session gives the total description about the DTMF M8870 – 01 and it’s

interfacing to the controller.

1. General description:

DTMF stands for Dual Tone Multiple Frequency. . It is numbers 0-9 and the *

and the # you press on your push-button telephone. This allows us to use mobile phones

and house push-button phones to act as “remote controls” The idea of turning your air-

conditioner on at home, whilst on the way home from work is only possible with DTMF

phone.

Every push-button phone and mobile telephone in the world has a DTMF

keypad. These telephone DTMF keypads are also fitted to many radios which allow these

radios to dial each other up, or into the phone network as they have a DTMF keypad. An

interesting fact for scanner users is that a DTMF decoder is available.

Page 24: 2.Traffic Clearance for VIPs Vehicles With DTMF

One Frequency from each the ‘high’ and ‘low’ group is assigned to each of the

12 push buttons on your telephone. The four buttons “A, B, C & D” are not used in

telephones, and are found mostly in radios and other devices with DTMF keypads (fig 1).

FIG :31 DTMF keypad

The DTMF Matrix, ignoring the last column (A, B, C, and D) bits is a telephone

keypad. Every time you press a button on any kind of phone these ‘dual tones’

(1=697Hz+1209Hz) are both heard by you and sent down the line. A DTMF decoder, of

sorts, is in fact part of every telephones circuitry-it needs it, like a decoder, to recognize

the tones.

The M-8870 is a full DTMF Receiver that integrates both band split filter and decoder

functions into a single 18-pin DIP or SOIC package. Manufactured using CMOS process

technology, the M-8870 offers low power consumption (35 mW max) and precise data

handling. Its filter section uses switched capacitor technology for both the high and low

group filters and for dial tone rejection. Its decoder uses digital counting techniques to

detect and decode all 16 DTMF tone pairs into a 4-bit code. Minimal external

components required include a low-cost 3.579545 MHz color burst crystal, a timing

resistor, and a timing capacitor.

3. Functional description:

Page 25: 2.Traffic Clearance for VIPs Vehicles With DTMF

M-8870 operating functions include a band split filter that separates the high and

low tones of the received pair, and a digital decoder that verifies both the frequency and

duration of the received tones before passing the resulting 4-bit code to the output bus.

3.1. Filter:

The low and high group tones are separated by applying the dual-tone

signal to the inputs of two 6th order switched capacitor band pass filters with bandwidths

that correspond to the bands enclosing the low and high group tones. The filter also

incorporates notches at 350 and 440 Hz, providing excellent dial tone rejection. Each

filter output is followed by a single-order switched capacitor section that smoothes the

signals prior to limiting. Signal limiting is performed by high gain comparators provided

with hysteresis to prevent detection of unwanted low-level signals and noise. The

comparator outputs provide full-rail logic swings at the frequencies of the incoming

tones.

3.2. Decoder:

The M-8870 decoder uses a digital counting technique to determine the

frequencies of the limited tones and to verify that they correspond to standard DTMF

frequencies. A complex averaging algorithm is used to protect against tone simulation by

extraneous signals (such as voice) while tolerating small frequency variations. The

algorithm ensures an optimum combination of immunity to talk off and tolerance to

interfering signals (third tones) and noise. When the detector recognizes the simultaneous

presence of two valid tones (known as signal condition), it raises the Early Steering flag

(ESt). Any subsequent loss of signal condition will cause ESt to fall.

3.3. Steering Circuit:

Before a decoded tone pair is registered, the receiver checks for valid signal

duration (referred to as character-recognition-condition). This check is performed by an

external RC time constant driven by ESt. A logic high on ESt causes VC to rise as the

capacitor discharges. Provided that signal condition is maintained (ESt remains high) for

the validation period (tGTF), VC reaches the threshold (VTSt) of the steering logic to

Page 26: 2.Traffic Clearance for VIPs Vehicles With DTMF

register the tone pair, thus latching its corresponding 4-bit code into the output latch (Q1,

Q2, Q3, and Q4). At this point, the GT output is activated and drives VC to VDD. GT

continues to drive high as long as ESt remains high. Finally, after a short delay to allow

the output latch to settle, the delayed steering output flag (StD) goes high, signaling that a

received tone pair has been registered. The contents of the output latch are made

available on the 4-bit output bus by raising the three state control input (OE) to logic high

VDD

FIG 32: Basic steering circuit.

The steering circuit works in reverse to validate the inter digit pause between signals.

Thus, as well as rejecting signals too short to be considered valid, the receiver will tolerate signal

interruptions (dropouts) too short to be considered a valid pause. This capability, together with the

ability to select the steering time constants externally, allows the designer to tailor performance to

meet a wide variety of system requirements.

4. Design considerations:

The design of a DTMF receiving system can generally be broken down into three functional

blocks. The first consideration is the interface to the transmission medium. This may be as simple

as a few passive components to adequately configure the MT8870’s input stage or as complex as

Page 27: 2.Traffic Clearance for VIPs Vehicles With DTMF

some form of demodulation, multiplexing or analog switching system. The second functional

block is the DTMF receiver itself. This is where the receiving system’s parameters can be

optimized for the specific signal conditions delivered from the "front end" interface. The third,

and perhaps most widely varying function, is the output control logic. This may be as simple as a

4 to 16 line decoder or a microcontroller, controlling a specific function for each DTMF code, or

as complex as a full blown computer handling system protocols and adaptively varying the tone

receiver’s parameters to adjust for changing signal conditions. Several currently applied and

conceptually designed applications are described subsequently but first let’s consider the design of

a ty8051al input stage

FIG 33: Application diagram

The input to the DTMF is given to the pin 2 (IN-) from any telephone line as shown in the

application diagram figure 4. The DTMF receiver receives the dual tone coming from the

telephone line and decodes the signal. The decoded 4 bit word is given to the outputs Q1, Q2, Q3,

and Q4 as shown in the fig 4. The StD pin goes high indicating that the value on the out put pins is

updated. The control logic checks continuously for the high pulse on StD pin or develops an

Page 28: 2.Traffic Clearance for VIPs Vehicles With DTMF

interrupt process when there is logic high on the StD pin. The figure 5 shows output logics for the

dual frequencies for the corresponding keys.

FIG 34: M8870 output truth table.

The proven reliability of DTMF signaling has created a vast spectrum of possible applications.

The mother board is provided to develop all these possible applications with DTMF receiver.

FIG 35: Home DTMF remote control system

Page 29: 2.Traffic Clearance for VIPs Vehicles With DTMF

. One of these applications is the House hold DTMF remote control system. The block

diagram for this system is as shown in the figure 6. Remote ON/OFF control may be

given to electric appliances such as a slow cooker, exterior lighting and garage heater

8870 CMOS Integrated DTMF Receiver

Product Description

The CAMD CM8870/70C provides full DTMF receiver

capability by integrating both the band split filter and digital decoder functions into a

single 18-pin DIP, SOIC, or 20-pin PLCC package. The CM8870/70C is manufactured

using state-of-the-art CMOS process technology for low power consumption (35mW,

max.) and precise data handling.

The filter section uses a switched capacitor technique for both

high and low group filters and dial tone rejection. TheCM8870/70C decoder uses digital

counting techniques for the detection and decoding of all 16 DTMF tone pairs into a4-bit

code. This DTMF receiver minimizes external component count by providing an on-chip

differential input amplifier, clock generator, and a latched three-state interface bus. The

on-chip clock generator requires only a low cost TV crystal or ceramic resonator as an

external component.

Features Full DTMF receiver

Less than 35mW power consumption

Industrial temperature range

Uses quartz crystal or ceramic resonators

Adjustable acquisition and release times

18-pin DIP, 18-pin DIP EIAJ, 18-pin SOIC, 20-pin

PLCC

Page 30: 2.Traffic Clearance for VIPs Vehicles With DTMF

CM8870C

Power down mode

Inhibit mode

Buffered OSC3 output (PLCC package only)

CM8870C is fully compatible with CM8870 for 18-pin

Devices by grounding pins 5 and 6

Functional Description The CAMD CM8870/70C DTMF Integrated Receiver provides the

design engineer with not only low power consumption, but high performance in a small

18-pin DIP, SOIC, or 20-pin PLCC package configuration. The CM8870/70C’s internal

architecture consists of a band split filter section which separates the high and low tones

of the received pair, followed by a digital decode (counting) section which verifies both

the frequency and duration of the received tones before passing the resultant

4-bit code to the output bus.

Input Configuration

The input arrangement of the CM8870/70C provides a differential

input operational amplifier as well as a bias source(VREF) which is used to bias the

inputs at mid-rail. Provision is made for connection of a feedback resistor to the op-amp

output (GS) for adjustment of gain. In a single-ended configuration, the input pins are

connected as shown in Figure, with the op-amp connected for unity gain and VREF

biasing the input at ½ VDD. Figure 6 shows the differential configuration, which permits

the adjustment of gain with the feedback resistor R5.

Clock Circuit

The internal clock circuit is completed with the addition of a standard

television color burst crystal or ceramic resonator-having a resonant frequency of

3.579545 MHz. TheCM8870C in a PLCC package has a buffered oscillator output

(OSC3) that can be used to drive clock inputs of other devices such as a microprocessor

or other CM887X’s as shown in Figure. Multiple CM8870/70Cs can be connected as

shown in figure 8 such that only one crystal or resonator is required.

Page 31: 2.Traffic Clearance for VIPs Vehicles With DTMF

FIG 36: BLOCK DIAGRAM

FIG 37: TIMING DIAGRAM

Page 32: 2.Traffic Clearance for VIPs Vehicles With DTMF

FIG 38: PIN FUNCTION TABLE

Page 33: 2.Traffic Clearance for VIPs Vehicles With DTMF

FIG 39:PIN DIAGRAMOF 8870:

Applications PABX

Central office

Mobile radio

Remote control

Remote data entry

Call limiting

Telephone answering systems

Power supply

Page 34: 2.Traffic Clearance for VIPs Vehicles With DTMF

The power supply are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. A d.c power supply which maintains the output voltage constant irrespective of a.c mains fluctuations or load variations is known as “Regulated D.C Power Supply”

For example a 5V regulated power supply system as shown below:

Fig 22: Functional Block Diagram of Power supply

Transformer:

A transformer is an electrical device which is used to convert electrical power from one

electrical circuit to another without change in frequency.

Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. Step-up transformers increase in output voltage, step-down transformers decrease in output voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage to a safer low voltage. The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils; instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. Transformers waste very little power so the

Page 35: 2.Traffic Clearance for VIPs Vehicles With DTMF

power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up. The ratio of the number of turns on each coil, called the turn’s ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage.

Fig 23: An Electrical Transformer

Turns ratio = Vp/ VS = Np/NS

Power Out= Power In

VS X IS=VP X IP

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip  = primary (input) current    

RECTIFIER: A circuit, which is used to convert a.c to dc, is known as RECTIFIER. The process of conversion a.c to d.c is called “rectification”

TYPES OF RECTIFIERS: Half wave Rectifier Full wave rectifier

1. Center tap full wave rectifier.2. Bridge type full bridge rectifier.

Comparison of rectifier circuits:

Parameter Type of Rectifier

Half wave Full wave BridgeNumber of diodes

Page 36: 2.Traffic Clearance for VIPs Vehicles With DTMF

1 2 3PIV of diodes

Vm 2Vm

Vm

D.C output voltage Vm/

2Vm/

2Vm/

Vdc, at no-load

0.318Vm

0.636Vm 0.636Vm

Ripple factor 1.21

0.482

0.482

Ripple frequency

f

2f

2f

Rectification efficiency

0.406

0.812

0.812

Transformer Utilization Factor(TUF)

0.287 0.693 0.812

RMS voltage Vrms Vm/2 Vm/√2 Vm/√2

Full-wave Rectifier:

From the above comparisons we came to know that full wave bridge rectifier as more

advantages than the other two rectifiers. So, in our project we are using full wave bridge

rectifier circuit.

Bridge Rectifier: A bridge rectifier makes use of four diodes in a bridge arrangement to

achieve full-wave rectification. This is a widely used configuration, both with individual

diodes wired as shown and with single component bridges where the diode bridge is

wired internally.

A bridge rectifier makes use of four diodes in a bridge arrangement as shown in

fig(a) to achieve full-wave rectification. This is a widely used configuration, both with

individual diodes wired as shown and with single component bridges where the diode

bridge is wired internally.

Page 37: 2.Traffic Clearance for VIPs Vehicles With DTMF

Fig(24.A):

Operation:

During positive half cycle of secondary, the diodes D2 and D3 are in forward biased

while D1 and D4 are in reverse biased as shown in the fig(b). The current flow direction

is shown in the fig (b) with dotted arrows.

Fig(24.B)

During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward

biased while D2 and D3 are in reverse biased as shown in the fig(c). The current flow

direction is shown in the fig (c) with dotted arrows.

Fig(24.C)

Page 38: 2.Traffic Clearance for VIPs Vehicles With DTMF

Filter: A Filter is a device, which removes the a.c component of rectifier output

but allows the d.c component to reach the load.

Capacitor Filter:

We have seen that the ripple content in the rectified output of half wave rectifier is

121% or that of full-wave or bridge rectifier or bridge rectifier is 48% such high

percentages of ripples is not acceptable for most of the applications. Ripples can be

removed by one of the following methods of filtering:

(a) A capacitor, in parallel to the load, provides an easier by –pass for the ripples voltage

though it due to low impedance. At ripple frequency and leave the d.c.to appears the load.

(b) An inductor, in series with the load, prevents the passage of the ripple current (due to

high impedance at ripple frequency) while allowing the d.c (due to low resistance to d.c)

(c) various combinations of capacitor and inductor, such as L-section filter section

filter, multiple section filter etc. which make use of both the properties mentioned in (a)

and (b) above. Two cases of capacitor filter, one applied on half wave rectifier and

another with full wave rectifier.

Filtering is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output. Filtering significantly increases the average DC voltage to almost the peak value (1.4 × RMS value).

To calculate the value of capacitor(C),

C = ¼*√3*f*r*Rl

Where,

f = supply frequency,

r = ripple factor,

Page 39: 2.Traffic Clearance for VIPs Vehicles With DTMF

Rl = load resistance

Note: In our circuit we are using 1000microfarads.

Regulator:

Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output

voltages. The maximum current they can pass also rates them. Negative voltage

regulators are available, mainly for use in dual supplies. Most regulators include some

automatic protection from excessive current ('overload protection') and overheating

('thermal protection'). Many of the fixed voltage regulator ICs have 3 leads and look like

power transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is

simple to use. You simply connect the positive lead of your unregulated DC power

supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to

the Common pin and then when you turn on the power, you get a 5 volt supply from the

output pin.

Fig 25: A Three Terminal Voltage Regulator

78XX:

The Bay Linear LM78XX is integrated linear positive regulator with three

terminals. The LM78XX offer several fixed output voltages making them useful in wide

range of applications. When used as a zener diode/resistor combination replacement, the

LM78XX usually results in an effective output impedance improvement of two orders of

magnitude, lower quiescent current. The LM78XX is available in the TO-252, TO-220 &

TO-263packages,

Page 40: 2.Traffic Clearance for VIPs Vehicles With DTMF

Features:

• Output Current of 1.5A

• Output Voltage Tolerance of 5%

• Internal thermal overload protection

• Internal Short-Circuit Limited

• No External Component

• Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V

• Offer in plastic TO-252, TO-220 & TO-263

• Direct Replacement for LM78XX

Liquid crystal display

Liquid crystal displays (LCDs) have materials, which combine the properties of both liquids and crystals. Rather than having a melting point, they have a temperature range within which the molecules are almost as mobile as they would be in a liquid, but are grouped together in an ordered form similar to a crystal.

An LCD consists of two glass panels, with the liquid crystal material sand

witched in between them. The inner surface of the glass plates are coated with transparent

electrodes which define the character, symbols or patterns to be displayed polymeric

layers are present in between the electrodes and the liquid crystal, which makes the liquid

crystal molecules to maintain a defined orientation angle.

One each polarisers are pasted outside the two glass panels. These polarisers

would rotate the light rays passing through them to a definite angle, in a particular

direction.

When the LCD is in the off state, light rays are rotated by the two polarisers and

the liquid crystal, such that the light rays come out of the LCD without any orientation,

and hence the LCD appears transparent.

When sufficient voltage is applied to the electrodes, the liquid crystal molecules

would be aligned in a specific direction. The light rays passing through the LCD would

Page 41: 2.Traffic Clearance for VIPs Vehicles With DTMF

be rotated by the polarisers, which would result in activating/ highlighting the desired

characters.

The LCD’s are lightweight with only a few millimeters thickness. Since the

LCD’s consume less power, they are compatible with low power electronic circuits, and

can be powered for long durations.

The LCD’s don’t generate light and so light is needed to read the display. By

using backlighting, reading is possible in the dark. The LCD’s have long life and a wide

operating temperature range.

Changing the display size or the layout size is relatively simple which makes the

LCD’s more customers friendly.

The LCDs used exclusively in watches, calculators and measuring instruments are

the simple seven-segment displays, having a limited amount of numeric data. The recent

advances in technology have resulted in better legibility, more information displaying

capability and a wider temperature range. These have resulted in the LCDs being

extensively used in telecommunications and entertainment electronics. The LCDs have

even started replacing the cathode ray tubes (CRTs) used for the display of text and

graphics, and also in small TV applications.

This section describes the operation modes of LCD’s then describe how to

program and interface an LCD to 8051 using Assembly and C.

LCD operationIn recent years the LCD is finding widespread use replacing LEDs(seven-segment

LEDs or other multisegment LEDs).This is due to the following reasons:

1. The declining prices of LCDs.

2. The ability to display numbers, characters and graphics. This is in

contract to LEDs, which are limited to numbers and a few characters.

3. Incorporation of a refreshing controller into the LCD, there by

relieving the CPU of the task of refreshing the LCD. In the contrast,

the LED must be refreshed by the CPU to keep displaying the data.

4. Ease of programming for characters and graphics.

Page 42: 2.Traffic Clearance for VIPs Vehicles With DTMF

LCD pin description The LCD discussed in this section has 14 pins. The function of each pins is given

in table.

TABLE 1:Pin description for LCD:

Pin symbol I/O Description

1 Vss -- Ground

2 Vcc -- +5V power supply

3 VEE -- Power supply to

control contrast

4 RS I RS=0 to select

command register

RS=1 to select

data register

5 R/W I R/W=0 for write

R/W=1 for read

6 E I/O Enable

7 DB0 I/O The 8-bit data bus

8 DB1 I/O The 8-bit data bus

9 DB2 I/O The 8-bit data bus

10 DB3 I/O The 8-bit data bus

11 DB4 I/O The 8-bit data bus

12 DB5 I/O The 8-bit data bus

13 DB6 I/O The 8-bit data bus

14 DB7 I/O The 8-bit data bus

TABLE 2: LCD Command Codes Code

(hex)

Command to LCD Instruction

Register

1 Clear display screen

Page 43: 2.Traffic Clearance for VIPs Vehicles With DTMF

2 Return home

4 Decrement cursor

6 Increment cursor

5 Shift display right

7 Shift display left

8 Display off, cursor off

A Display off, cursor on

C Display on, cursor off

E Display on, cursor on

F Display on, cursor blinking

10 Shift cursor position to left

14 Shift cursor position to right

18 Shift the entire display to the left

1C Shift the entire display to the right

80 Force cursor to beginning of 1st line

C0 Force cursor to beginning of 2nd line

38 2 lines and 5x7 matrix

Uses:

The LCDs used exclusively in watches, calculators and measuring

instruments are the simple seven-segment displays, having a limited amount of numeric

data. The recent advances in technology have resulted in better legibility, more

information displaying capability and a wider temperature range. These have resulted in

the LCDs being extensively used in telecommunications and entertainment electronics.

The LCDs have even started replacing the cathode ray tubes (CRTs) used for the display

of text and graphics, and also in small TV applications.

LCD INTERFACING

Page 44: 2.Traffic Clearance for VIPs Vehicles With DTMF

Sending commands and data to LCDs with a time delay:

Fig 21: Interfacing of LCD to a micro controller

To send any command from table 2 to the LCD, make pin RS=0.

for data, make RS=1.Then send a high –to-low pulse to the E pin to enable the internal latch of the LCD.

IGNITION SWITCH

The term ignition switch is often used interchangeably to refer to two very different parts: the lock cylinder into which the key is inserted, and the electronic switch that sits just behind the lock cylinder. In some cars, these two parts are combined into one unit, but in other cars they remain separate. It is advisable to check your car's shop manual before attempting to purchase an ignition switch, to ensure that you buy the correct part.

In order to start a car, the engine must be turning. Therefore, in the days before ignition switches, car engines had to be turned with a crank on the front of the car in order to start them. The starter performs this same operation by turning the engine's flywheel, a large, flat disc with teeth on the outer edge. The starter has a gear that engages these teeth when it is powered, rapidly and briefly turning the flywheel, and thus the engine.

Page 45: 2.Traffic Clearance for VIPs Vehicles With DTMF

The ignition switch generally has four positions: off, accessories, on, and start. Some cars have two off positions, off and lock; one turns off the car, and the other allows the key to be removed from the ignition. When the key is turned to the accessories position, certain accessories, such as the radio, are powered; however, accessories that use too much battery power, such as window motors, remain off in order to prevent the car's battery from being drained. The accessories position uses the least amount of battery power when the engine is not running, which is why drive-in movie theaters recommend that the car be left in the accessories mode during the movie.

The on position turns on all of the car's systems, including systems such as the fuel pump, because this is the position the ignition switch remains in while the car's engine is running. The start position is spring loaded so that the ignition switch will not remain there when the key is released. When the key is inserted into the ignition switch lock cylinder and turned to the start position, the starter engages; when the key is released, it returns to the on position, cutting power to the starter. This is because the engine runs at speeds that the starter cannot match, meaning that the starter gear must be retracted once the engine is running on its own.

Either the ignition switch or the lock cylinder may fail in a car, but both circumstances have very different symptoms. When the ignition switch fails, generally the electrical wiring or the plastic housing develops problems. The car may not turn on and/or start when this happens. Also, the spring-loaded start position could malfunction, in which case the starter will not engage unless the key is manually turned back to the on position.

When the lock cylinder malfunctions, however, the operation of the key itself will become problematic. If the tumblers become stripped, the lock cylinder may be able to turn with any key, or you may be able to remove the key when the car is on. If the tumblers begin to shift, the lock cylinder may not turn. Sometimes the key can be wiggled until the lock cylinder turns, but it is important to remember that this is only a temporary fix

MAX-232:The MAX232 from Maxim was the first IC which in one package contains the necessary drivers (two) and receivers (also two), to adapt the RS-232 signal voltage levels to TTL logic. It became popular, because it just needs one voltage (+5V) and generates the necessary RS-232 voltage levels (approx. -10V and +10V) internally. This greatly simplified the design of circuitry. Circuitry designers no longer need to design and build a power supply with three voltages (e.g. -12V, +5V, and +12V), but could just provide one +5V power supply, e.g. with the help of a simple 78x05 voltage converter.

The MAX232 has a successor, the MAX232A. The ICs are almost identical, however, the MAX232A is much more often used (and easier to get) than the original MAX232, and the MAX232A only needs external capacitors 1/10th the capacity of what the original MAX232 needs.

Page 46: 2.Traffic Clearance for VIPs Vehicles With DTMF

It should be noted that the MAX 232(A) is just a driver/receiver. It does not generate the necessary RS-232 sequence of marks and spaces with the right timing, it does not decode the RS-232 signal, it does not provide a serial/parallel conversion. All it does is to convert signal voltage levels. Generating serial data with the right timing and decoding serial data has to be done by additional circuitry, e.g. by a 16550 UART or one of these small micro controllers (e.g. Atmel AVR, Microchip PIC) getting more and more popular.

The MAX232 and MAX232A were once rather expensive ICs, but today they are cheap. It has also helped that many companies now produce clones (ie. Sipex). These clones sometimes need different external circuitry, e.g. the capacities of the external capacitors vary. It is recommended to check the data sheet of the particular manufacturer of an IC instead of relying on Maxim's original data sheet.

The original manufacturer (and now some clone manufacturers, too) offers a large series of similar ICs, with different numbers of receivers and drivers, voltages, built-in or external capacitors, etc. E.g. The MAX232 and MAX232A need external capacitors for the internal voltage pump, while the MAX233 has these capacitors built-in. The MAX233 is also between three and ten times more expensive in electronic shops than the MAX232A because of its internal capacitors. It is also more difficult to get the MAX233 than the garden variety MAX232A.

A Typical Application

The MAX 232(A) has two receivers (converts from RS-232 to TTL voltage levels) and two drivers (converts from TTL logic to RS-232 voltage levels). This means only two of the RS-232 signals can be converted in each direction. The old MC1488/1498 combo provided four drivers and receivers.

Typically a pair of a driver/receiver of the MAX232 is used for

TX and RX

And the second one for

CTS and RTS.

There are not enough drivers/receivers in the MAX232 to also connect the DTR, DSR, and DCD signals. Usually these signals can be omitted when e.g. communicating with a PC's serial interface. If the DTE really requires these signals either a second MAX232 is needed, or some other IC from the MAX232 family can be used (if it can be found in consumer electronic shops at all). An alternative for DTR/DSR is also given below.

Maxim's data sheet explains the MAX232 family in great detail, including the pin configuration and how to connect such an IC to external circuitry. This information can be used as-is in own design to get a working RS-232 interface. Maxim's data just misses one critical piece of information: How exactly to connect the RS-232 signals to the IC. So here is one possible example:

Page 47: 2.Traffic Clearance for VIPs Vehicles With DTMF

MAX232 to RS232 DB9 Connection as a DCE

MAX232 Pin Nbr. MAX232 Pin Name Signal Voltage DB9 Pin

7 T2out CTS RS-232 7

8 R2in RTS RS-232 8

9 R2out RTS TTL n/a

10 T2in CTS TTL n/a

11 T1in TX TTL n/a

12 R1out RX TTL n/a

13 R1in TX RS-232 3

14 T1out RX RS-232 2

15 GND GND 0 5

In addition one can directly wire DTR (DB9 pin 4) to DSR (DB9 pin 6) without going through any circuitry. This gives automatic (brain dead) DSR acknowledgment of an incoming DTR signal.

Sometimes pin 6 of the MAX232 is hard wired to DCD (DB9 pin 1). This is not recommended. Pin 6 is the raw output of the voltage pump and inverter for the -10V voltage. Drawing currents from the pin leads to a rapid breakdown of the voltage, and as a consequence to a breakdown of the output voltage of the two RS-232 drivers. It is better to use software which doesn't care about DCD, but does hardware-handshaking via CTS/RTS only.

The circuitry is completed by connecting five capacitors to the IC as it follows. The MAX232 needs 1.0µF capacitors, the MAX232A needs 0.1µF capacitors. MAX232 clones show similar differences. It is recommended to consult the corresponding data sheet. At least 16V capacitor types should be used. If electrolytic or tantalic capacitors are used, the polarity has to be observed. The first pin as listed in the following table is always where the plus pole of the capacitor should be connected to.

MAX232(A) external Capacitors

Capacitor + Pin - Pin Remark

C1 1 3

C2 4 5

C3 2 16

Page 48: 2.Traffic Clearance for VIPs Vehicles With DTMF

C4 GND 6This looks non-intuitive, but because pin 6 ison -10V, GND gets the + connector, and not the -

C5 16 GND

The 5V power supply is connected to

+5V: Pin 16 GND: Pin 15

Features

Meet or Exceed TIA/EIA-232-F and ITURecommendation V.28 Operate With Single 5-V Power Supply Operate Up to 120 kbit/s Two Drivers and Two Receivers 30-V Input Levels Low Supply Current . . . 8 mA Typical Designed to be Interchangeable WithMaxim MAX232 ESD Protection Exceeds JESD 22

2000-V Human-Body Model (A114-A)

ApplicationsTIA/EIA-232-FBattery-Powered SystemsTerminalsModemsComputers

Description/ordering information

The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to supply EIA-232 voltage levels from a single 5-V supply. Each receiver converts EIA-232 inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V and a typical hysteresis of 0.5 V, and can accept 30-V inputs. Each driver converts TTL/CMOS input levels into EIA-232 levels. The driver, receiver, and voltage-generator functions are available as cells in the Texas Instruments Lin ASIClibrary.

Page 49: 2.Traffic Clearance for VIPs Vehicles With DTMF
Page 50: 2.Traffic Clearance for VIPs Vehicles With DTMF
Page 51: 2.Traffic Clearance for VIPs Vehicles With DTMF
Page 52: 2.Traffic Clearance for VIPs Vehicles With DTMF
Page 53: 2.Traffic Clearance for VIPs Vehicles With DTMF
Page 54: 2.Traffic Clearance for VIPs Vehicles With DTMF

LIGHT EMITING DIODES

It is a semiconductor diode having radioactive recombination. It requires a definite

amount of energy to generate an electron-hole pair.

The same energy is released when an electron recombines with a hole. This released

energy may result in the emission of photon and such a recombination. Hear the amount

of energy released when the electro reverts from the conduction band to the valence band

appears in the form of radiation. Alternatively the released energy may result in a series

of phonons causing lattice vibration. Finally the released energy may be transferred to

Page 55: 2.Traffic Clearance for VIPs Vehicles With DTMF

another electron. The recombination radiation may be lie in the infra-red and visible light

spectrum. In forward is peaked around the band gap energy and the phenomenon is called

injection luminescence. I n a junction biased in the avalanche break down region , there

results a spectrum of photons carrying much higher energies . Almost White light then

gets emitted from micro-plasma breakdown region in silicon junction. Diodes having

radioactive recombination are termed as Light Emitting Diode, abbreviated as LEDs.

In gallium arsenide diode, recombination is predominantly a radiation

recombination and the probability of this radio active recombination far exceeds that in

either germanium or silicon . Hence Ga As LED has much higher efficiency in terms of

Photons emitted per carrier. The internal efficiency of Ga As LED may be very close to

100% but because of high index of refraction, only a small fraction of the internal

radiation can usually come out of the device surface. In spite of this low efficiency of

actually radiated light , these LEDs are efficiency used as light emitters in visual display

units and in optically coupled circuits, The efficiency of light generation increases with

the increase of injected current and with decreases in temperature. The light so

generated is concentrated near the junction since most of the charge carriers are obtained

within one diffusion length of the diode junction.

The following are the merits of LEDs over conventional incandescent and other types

of lamps

1. Low working voltages and currents

2. Less power consumption

3. Very fast action

4. Emission of monochromatic light

5. small size and weight

6. No effect of mechanical vibrations

7. Extremely long life

Typical LED uses a forward voltage of about 2V and current of 5 to 10mA.

Page 56: 2.Traffic Clearance for VIPs Vehicles With DTMF

GaAs LED produces infra-red light while red, green and orange lights are produced

by gallium arsenide phosphide (GaAs) and gallium phosphide(Gap) .

Light Emitting Diodes (LEDs)

Example:        Circuit symbol:   

Function

LEDs emit light when an electric current passes through them.

Connecting and soldering

LEDs must be connected the correct way round, the diagram may be labelled a or

+ for anode and k or - for cathode (yes, it really is k, not c, for cathode!). The cathode is

the short lead and there may be a slight flat on the body of round LEDs. If you can see

inside the LED the cathode is the larger electrode (but this is not an

official identification method).

LEDs can be damaged by heat when soldering, but the risk is small unless you are

very slow. No special precautions are needed for soldering most LEDs.

Testing an LED

Never connect an LED directly to a battery or power supply!

It will be destroyed almost instantly because too much current will pass through and burn

it out. LEDs must have a resistor in series to limit the current to a safe value, for quick

testing purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or

less. Remember to connect the LED the correct way round!

Colors of LEDs

Page 57: 2.Traffic Clearance for VIPs Vehicles With DTMF

LEDs are available in red, orange, amber, yellow, green, blue and white. Blue and white

LEDs are much more expensive than the other colours.

The colour of an LED is determined by

the semiconductor material, not by the

colouring of the 'package' (the plastic

body). LEDs of all colours are available

in uncoloured packages which may be

diffused (milky) or clear (often described

as 'water clear'). The coloured packages are also available as diffused (the

standard(type)ortransparent.

The most popular type of tri-colour LED has a red and a green LED combined in

one package with three leads. They are called tri-colour because mixed red and green

light appears to be yellow and this is produced when both the red and green LEDs are

on.

The diagram shows the construction of a tri-colour LED. Note the different

lengths of the three leads. The centre lead (k) is the common cathode for both LEDs, the

outer leads (a1 and a2) are the anodes to the LEDs allowing each one to be lit

separately, or both together to give the third colour.

Bi-color LEDs

Page 58: 2.Traffic Clearance for VIPs Vehicles With DTMF

A bi- colour LED has two LEDs wired in 'inverse parallel' (one forwards, one backwards)

combined in one package with two leads. Only one of the LEDs can be lit at one time and

they are less useful than the tri-colour LEDs described above.

Sizes, Shapes and Viewing angles of LEDs

LEDs are available in a wide variety of sizes and shapes. The 'standard' LED has

a round cross-section of 5mm diameter and this is probably the best type for general use,

but 3mm round LEDs are also popular.

Round cross-section LEDs are frequently used and they are very easy to install on

boxes by drilling a hole of the LED diameter, adding a spot of glue will help to hold the

LED if necessary. LED clips are also available to secure LEDs in holes. Other cross-

section shapes include square, rectangular and triangular.

As well as a variety of colors, sizes and shapes, LEDs also vary in their viewing

angle. This tells you how much the beam of light spreads out. Standard LEDs have a

viewing angle of 60° but others have a narrow beam of 30° or less. Rapid Electronics

stock a wide selection of LEDs and their catalogue is a good guide to the range available.

Calculating an LED resistor value

An LED must have a resistor connected in series to limit the current through the

LED, otherwise it will burn out almost instantly.

Page 59: 2.Traffic Clearance for VIPs Vehicles With DTMF

The resistor value, R is given by

R = (VS - VL) / I

VS = supply voltage

VL = LED voltage (usually 2V, but 4V for blue and white LEDs)

I = LED current (e.g. 20mA), this must be less than the maximum permitted

If the calculated value is not available choose the nearest standard resistor value

which is greater, so that the current will be a little less than you chose. In fact you may

wish to choose a greater resistor value to reduce the current (to increase battery life for

example) but this will make the LED less bright.

Working out the LED resistor formula using Ohm's law

Ohm's law says that the resistance of the resistor, R = V/I,

where:

  V = voltage across the resistor (= VS - VL in this case)

  I = the current through the resistor

So   R = (VS - VL) / I

Connecting LEDs in series

Page 60: 2.Traffic Clearance for VIPs Vehicles With DTMF

If you wish to have several LEDs on at the same time it may be possible to

connect them in series. This prolongs battery life by lighting several LEDs with the same

current as just one LED.

All the LEDs connected in series pass the same current so it is best if they are all

the same type. The power supply must have sufficient voltage to provide about 2V for

each LED (4V for blue and white) plus at least another 2V for the resistor. To work out a

value for the resistor you must add up all the LED voltages and use this for VL.

Avoid connecting LEDs in parallel

Connecting several LEDs in parallel with just one resistor shared between them is

generally not a good idea.

If the LEDs require slightly different voltages only the lowest voltage LED will

light and it may be destroyed by the larger current flowing through it. Although identical

LEDs can be successfully connected in parallel with one resistor this rarely offers any

useful benefit because resistors are very cheap and the current used is the same as

connecting the LEDs individually.

Page 61: 2.Traffic Clearance for VIPs Vehicles With DTMF

RESULT:

By implementing this project we can overcome the problem of heavy traffic in the cities when the VIPs are arriving at the signals.