document of trafic light control priority for emergency vehicles

60
 TRAFIC CONTROL PRIORITY FOR AMBULANCE INTRODUCTION An embedded system is a combination of software and hardware to perform a dedicated task. Some of the main devices used in embedded products are Microprocessors and Microcontrollers. Microprocessors are commonly referred to as general purpose processors as they simply accept the inputs, process it and give the output. In contrast, a microcontroller not only accepts the data as inputs but also manipulates it, interfaces the data with various devices, controls the data and thus finally gives the result AIM: The aim of this project is to con trol the traffic signal with help of solar energy. DESCRIPTION: This project has been developed as a model of traffic light controller. The signals can be controlled through software programs and can be varied depending upon the location. For example some places needs green signals to glow for long time. And some directions need red signals to glow for long time. This can be achieved simply by varying the d elay in the software. Solar power is used to used to  provide the power to the solar lights. So this project is very usef ul to the government to save the power.

Upload: saikrishnajulakanti

Post on 02-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 1/60

  TRAFIC CONTROL PRIORITY FOR AMBULANCE

INTRODUCTION

An embedded system is a combination of software and hardware to perform a dedicated

task.

Some of the main devices used in embedded products are Microprocessors and

Microcontrollers.

Microprocessors are commonly referred to as general purpose processors as they simply

accept the inputs, process it and give the output.

In contrast, a microcontroller not only accepts the data as inputs but also manipulates it,

interfaces the data with various devices, controls the data and thus finally gives the result

AIM: The aim of this project is to control the traffic signal with help of solar energy.

DESCRIPTION:This project has been developed as a model of traffic light

controller. The signals can be controlled through software programs and can be varied

depending upon the location. For example some places needs green signals to glow for

long time. And some directions need red signals to glow for long time. This can be

achieved simply by varying the delay in the software. Solar power is used to used to

 provide the power to the solar lights. So this project is very useful to the government to

save the power.

Page 2: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 2/60

 

Page 3: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 3/60

 

MICRO CONTROLLER :

The 8051 provides the following standard features of MICROCONTROLLERS:

Microprocessors and microcontrollers are widely used in embedded systems

 products. Microcontroller is a programmable device. A microcontroller has a CPU in

addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single

chip. The fixed amount of on-chip ROM, RAM and number of I/O ports in

microcontrollers makes them ideal for many applications in which cost and space are

critical.

The Intel 8051 is a Harvard architecture, single chip microcontroller (µC) which was

developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and

early 1990s, but today it has largely been superseded by a vast range of enhanced devices

with 8051-compatible processor cores that are manufactured by more than 20

independent manufacturers including Atmel, Infineon Technologies and Maxim

Integrated Products.

8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data

at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the

CPU.

The microcontroller used in this project is 8051. Atmel Corporation introduced this

89S52 microcontroller.

The present project is implemented on Keil Uvision. In order to program the device,

Proload tool has been used to burn the program onto the microcontroller.

The features, pin description of the microcontroller and the software tools used are

discussed in the following sections.

Page 4: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 4/60

 

FEATURES OF 8051

It is a 8-bit microcontroller.

40 pins

Internal ROM-4k bytes

Internal RAM-128 bytes

four 8-bit I/O ports.

Two 16-bit timers.

serial interface communication.

64K external code.

Operating frequency is 24Mhz –  33Mhz

5V power supply.

Four 8-bit I/O ports.

32 I/O lines(pins).

21 SFR

4 parallel ports and 1 serial port.

Full duplex UART.

6 Interrupts(int0,int1,T0,T1,RST,Serial communication)

Page 5: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 5/60

 

8051 Architecture:-

Page 6: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 6/60

 

The above diagram explains the architecture of an 8051 microcontroller.

In this 8051 consists of CPU , ROM, RAM, Bus control, Inturrupt control, I/O ports,

serial port, Interrupt control and oscillator. description of each block is given below.

ROM (Read Only Memory):-

Internal ROM memory is 4K bytes.

It is a type of ―built in‖ memory that is capable of holding data and having that data

read from the chip but not written too.

Page 7: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 7/60

It is non-volatile. i.e, that can get back stored information even when not powered.

RAM(Random Access Memory);-

Internal RAM memory is 128k bytes.

RAM allows us to store even large amount of data.

Provides large quantities of temporary storage in a computer system.

RAM MEMORY ALLOCATION IN 8051 ARCHITECTURE:-

RAM Allocation in 8051

 There are 128 bytes of RAM in the 8051.Assigned addresses 00 to 7FH

 The 128 bytes are divided into three different groups as follows:

A total of 32 bytes from locations 00 to1F hex are set aside for register banks and the

stack.

A total of 16 bytes from locations 20H to 2FH are set aside for bit-addressable read/write

memory.

A total of 80 bytes from locations 30H to 7FH are used for read and write storage, called

scratch pad.

These 32 bytes are divided into 4 banks of registers in which each bank has 8 registers,

R0-R7.

Page 8: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 8/60

 

RAM able to store many words one per address. read the word that was saved at a

 particular address. And it can change the word saved at a particular address.

RAM memory space allocation in the 8051

8051 Register Banks and their RAM Addresses

Page 9: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 9/60

 

PIN DIAGRAM FOR 8051:-

Page 10: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 10/60

Total pins - 40

Address pins - 18

data pins - 8

Interrupt pins - 2

I/O pins 32

The 8051 has 40 pins device, but out of these 40 pins,32 are used for I/O.

24 of these are dual purpose .i.e, they can operate as I/o or a control line as part of

address or data bus.

PORT0(p0.0 to p0.7):- pins 32 to 39

8-bit read write general purpose.

Acts as a multiplexed low byte address and data bus for external memory design,

allocating it to be used for both address and data.

When ALE is 0 then it provides address(A0 toA7) When ALE is 1then it provides

data(D0 toD7)

PORT1(p1.0 to p1.7):- pins 1 to 8:-

8-bit read write general purpose. it has only one functionality.

Page 11: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 11/60

 

PORT2(p2.7 to p2.0):- pins 21 to 28:-

8-bit read write general purpose.

high byte of the address bus for external memory design.

 port 2 must be used along with Po to provide the 16-bit address for the external

memory.

PORT3(p3.0 to p3.7):- pins 10 to 17:-

8-bit read write general purpose.

In this port each pin has separate functionality.

 pin10(RXD) is used to receive the data from microcontroller.

 pin11(TXD) is used to send the data to microcontroller.

2 pins for interrupt enable and disable.

2 pins for timers.

2 pins are used to read/write data from/to controller.

In pin diagram pin 20 is connected to ground and pin 40 is connected to power supply.

Fig: Pin diagram

Pin Description:-

Page 12: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 12/60

VCC

Pin 40 provides the supply voltage to the chip. The voltage is +5V.

GND Ground.

XTAL1 and XTAL2

The 8052 has an on-chip oscillator but requires an external clock to run it. Usually, a

quartz crystal oscillator is connected to inputs XTAL1 (pin19) and XTAL2 (pin18).

There are various speeds of 8052 family. Speed refers to the maximum oscillator

frequency connected to XTAL. When the 8052 is connected to a crystal oscillator and is

 powered up, the frequency can be observed on the XTAL2 pin using the oscilloscope.

XTAL1 is the input to the inverting oscillator amplifier and input to the internal clock

operating circuit and XTAL2 is the output from the inverting oscillator amplifier.

ALE/PROG

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

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

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

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

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

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

 pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external

execution mode.

PSEN (Program Store Enable)

Page 13: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 13/60

It is the read strobe to external program memory. When the 8051 is executing code from

external program memory, PSEN is acti-vated twice each machine cycle, except that two

PSEN activations are skipped during each access to external data memory.

EA/VPP (External Access Enable)

EA must be strapped to GND in order to enable the device to fetch code from external

 program memory locations starting at 0000H up to FFFFH. Note, however, that if lock

 bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to

VCC for internal program executions. This pin also receives the 12-volt programming

enable voltage (VPP) during Flash programming when 12-volt programming is selected

Page 14: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 14/60

Ports 0, 1, 2 and 3

The four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit ports. All the ports upon

RESET are configured as input, since P0-P3 have value FFH on them.

Port 0(P0)

Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data. ALE

indicates if P0 has address or data. When ALE=0, it provides data D0-D7, but when ALE=1, it

has address A0-A7. Therefore, ALE is used for demultiplexing address and data with the help of

an internal latch.

When there is no external memory connection, the pins of P0 must be connected to a 10K-ohm

 pull-up resistor. This is due to the fact that P0 is an open drain. With external pull-up resistors

connected to P0, it can be used as a simple I/O, just like P1 and P2. But the ports P1, P2 and P3

do not need any pull-up resistors since they already have pull-up resistors internally. Upon reset,

 ports P1, P2 and P3 are configured as input ports.

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 because of the internal pull-ups.

Some Port 1 pins provide additional functions. P1.0 and P1.1 can be configured to be the

timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX),

respectively. Furthermore, P1.4, P1.5, P1.6, and P1.7 can be configured as the SPI slave port

select, data input/output and shift clock input/output pins. Port 1 also receives the low-order

address bytes during Flash programming and verification.

Programmable Clock Out:

Page 15: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 15/60

A 50% duty cycle clock can be programmed to come out on P1.0. This pin, besides being a

regular I/0 pin, has two alternate functions. It can be programmed to input the external clock for

Timer/Counter 2 or to output a 50% duty cycle clock ranging from 61 Hz to 4 MHz (for a 16-

MHz operating frequency).

Port 2

With no external memory connection, P2 are used as simple I/O. With external memory

connections, port 2 must be used along with P0 to provide the 16-bit address for the external

memory. Port 2 is designated as A8-A15 indicating its dual function. While P0 provides the

lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of the address.

Port 2 also receives the high-order address bits and some control signals during Flash

 programming and verification.

Port 3

Port 3 is an 8-bit bi-directional I/O port with internal 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 because of the pull-ups. Port 3 receives some control signals for Flash

 programming and verification.

Port 3 also serves the functions of various special features of the 8051, as shown in the

following table.

Page 16: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 16/60

 

Table: Port 3 Alternate functions

REGISTERS:-

 A register is a very small amount of very fast memory that is built into the CPU (central

 processing unit) in order to speed up its operations by providing quick access to commonly used

values.

In 8051 there are basically 8 general purpose registers which we can use frequently.

Registers are used for allocating memory.

We are using registers for reading, writing and for other operations can be done in a fast

manner.

Advantage for using registers is to increase the cpu speed because of their high access rate in

comparison by RAM.

In 8051 there are 21 SFR(Special function registers) in standard 8051 namely

The 8051 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes

of downloadable Flash programmable and erasable read-only memory and 2K bytes of

Page 17: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 17/60

EEPROM. The device is manufactured using Atmel’s high-density nonvolatile memory

technology and is compatible with the industry-standard 80C51 instruction set and pinout.

The on-chip downloadable Flash allows the program memory to be reprogrammed through an

SPI serial interface or by a conventional nonvolatile memory programmer. By combining a

versatile 8-bit CPU with downloadable Flash on a monolithic chip, the Atmel 8051 is a powerful

microcontroller, which provides a highly-flexible and cost-effective solution to many embedded

control applications.

res: 4K bytes of downloadable Flash, 2K bytes of EEPROM, 128 bytes of RAM, 32 I/O lines,

two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full

duplex serial port, on-chip oscillator, and clock circuitry.

In addition, the 8051 is designed with static logic for operation down to zero frequency and

supports two software selectable power saving modes. The Idle Mode stops the CPU while

allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The

Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip

functions until the next external interrupt or hardware reset.

The downloadable Flash can be changed a single byte at a time and is accessible through the SPI

serial interface. Holding RESET active forces the SPI bus into a serial programming interface

and allows the program memory to be written to or read from unless lock bits have been

activated.

Data Memory –  EEPROM and RAM

The 8051 implements 2K bytes of on-chip EEPROM for data storage and 256 bytes of RAM.

The upper 128 bytes of RAM occupy a parallel space to the Special Function Registers i.e., the

upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR

space.

Page 18: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 18/60

 

When an instruction accesses an internal location above address 7FH, the address mode

used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the

SFR space.

Instructions that use direct addressing access SFR space. For example, the following direct

addressing instruction accesses the SFR at location 0A0H (which is P2).

MOV 0A0H, #data

Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the

following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at

address 0A0H, rather than P2 (whose address is 0A0H).

MOV @R0, #data

It should be noted that stack operations are examples of indirect addressing, so the upper 128

 bytes of data RAM are available as stack space.

The on-chip EEPROM data memory is selected by setting the EEMEN bit in the WMCON

register at SFR address location 96H. The EEPROM address range is from 000H to 7FFH. The

MOVX instructions are used to access the EEPROM. To access off-chip data memory with the

MOVX instructions, the EEMEN bit needs to be set to ―0‖. 

MCON REGISTER

PS2 PS1 PS0 EEMWE EEMEN DPS RDY/BSY WDTEN

7 6 5 4 3 2 1 0

Page 19: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 19/60

 

The EEMEN and EEMWE bits are used to select the 2K bytes on-chip EEPROM, and to enable

 byte-write. The DPS bit selects one of two DPTR registers available.

PROGRAMMING THE FLASH AND EEPROM

Atmel’s 8051 Flash Microcontroller offers 8K bytes of in-system reprogrammable Flash Code

memory and 2K bytes of EEPROM Data memory. The 8051 is normally equipped with the on-

chip Flash Code and EEPROM Data memory arrays in the erased state (i.e. contents = FFH) and

ready to be programmed.

This device supports a high-voltage (12-V VPP) Parallel programming mode and a low-voltage

(5-V VCC) Serial programming mode.

Serial Programming mode:

This mode provides a convenient way to reprogram the 8051 inside the user’s system. The Code

and Data memory arrays are mapped via separate address spaces in this mode. An auto-erase

cycle is provided with the self-timed programming operation. There is no need to perform the

Chip Erase operation to reprogram any memory location in this programming mode unless any

of the lock bits have been programmed.

Parallel Programming mode:

Page 20: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 20/60

 The parallel programming mode is compatible with conventional third party Flash or EPROM

 programmers. In this mode, the two arrays occupy one contiguous address space: 0000H to

1FFFH for the Code array and 2000H to 27FFH for the Data array. In this mode, there is no

auto-erase cycle. To reprogram any non-blank byte, the user needs to use the Chip Erase

operation first to erase both arrays.

The Code and Data memory arrays on the 8051 are programmed byte-by-byte in either

 programming mode.

Parallel Programming Algorithm:

To program and verify the 8051 in the parallel programming mode, the following sequence is

recommended:

1. Power-up sequence: Apply power between VCC and GND pins. Set RST pin to ―H‖. Apply a

3 MHz to 24 MHz clock to XTAL1 pin and wait for at least 10 milliseconds.

2. Set PSEN pin to ―L‖ ALE pin to ―H‖ EA pin to ―H‖ and all other pins to ―H‖. 

3. Apply the appropriate combination of ―H‖ or ―L‖ logic levels to pins P2.6, P2.7, P3.6, and

P3.7 to select one of the programming operations shown in the Flash Programming Modes table.

4. Apply the desired byte address to pins P1.0 to P1.7 and P2.0 to P2.5. Apply data to pins P0.0

to P0.7 for Write Code operation.

5. Raise EA/VPP to 12V to enable Flash programming, erase or verification.

6. Pulse ALE/PROG once to program a byte in the Code memory array, the Data mem-ory array

or the lock bits. The byte-write cycle is self-timed and typically takes 1.5 ms.

7. To verify the byte just programmed, bring pin P2.7 to ―L‖ and read the programmed data at

 pins P0.0 to P0.7.

Page 21: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 21/60

 8. Repeat steps 3 through 7 changing the address and data for the entire 2K or 8K bytes array or

until the end of the object file is reached.

9. Power-off sequence: Set XTAL1 to ―L‖. Set RST and EA pins to ―L‖. Turn VCC power off. 

Data Polling:

The 8051 features DATA Polling to indicate the end of a byte write cycle. During a byte write

cycle in the parallel or serial programming mode, an attempted read of the last byte written will

result in the complement of the written datum on P0.7 (parallel mode), and on the MSB of the

serial output byte on MISO (serial mode). Once the write cycle has been completed, true data are

valid on all outputs, and the next cycle may begin. DATA Polling may begin any time after a

write cycle has been initiated.

Ready/Busy:

The progress of byte programming in the parallel programming mode can also be monitored by

the RDY/BSY output signal. Pin P3.4 is pulled Low after ALE goes high during programming to

indicate BUSY. P3.4 is pulled High again when programming is done to indicate READY.

Program Verify:

If lock bits LB1 and LB2 have not been programmed, the programmed Code or Data byte can be

read back via the address and data lines for verification. The state of the lock bits can also be

verified directly in the parallel programming mode. In the serial programming mode, the state of

the lock bits can only be verified indirectly by observing that the lock bit features are enabled.

Chip Erase:

Page 22: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 22/60

Both Flash and EEPROM arrays are erased electrically at the same time. In the parallel

 programming mode, chip erase is initiated by using the proper combination of control signals

and by holding ALE/PROG low for 10 ms. The Code and Data arrays are written with all ―1‖s in

the Chip Erase operation. In the serial programming mode, a chip erase operation is initiated by

issuing the Chip Erase instruction. In this mode, chip erase is self-timed and takes about 16 ms.

During chip erase, a serial read from any address location will return 00H at the data outputs.

SERIAL DOWNLOADING:

Both the Code and Data memory arrays can be programmed using the serial SPI bus while RST

is pulled to VCC. The serial interface consists of pins SCK, MOSI (input) and MISO (output).

After RST is set high, the Programming Enable instruction needs to be executed first before

 program/erase operations can be executed.

An auto-erase cycle is built into the self-timed programming operation (in the serial mode

ONLY) and there is no need to first execute the chip erase instruction unless any of the lock bits

have been programmed. The Chip Erase operation turns the content of every memory location in

 both the Code and Data arrays into FFH. The Code and Data memory arrays have separate

address spaces: 0000H to 1FFFH for Code memory and 000H to 7FFH for Data memory. Either

an external system clock is supplied at pin XTAL1 or a crystal needs to be connected across pins

Page 23: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 23/60

XTAL1 and XTAL2. The maximum serial clock (SCK) frequency should be less than 1/40 of the

crystal frequency. With a 24 MHz oscillator clock, the maximum SCK frequency is 600 kHz.

Serial Programming Algorithm:

To program and verify the 8051 in the serial programming mode, the following sequence is

recommended:

1. Power-up sequence: Apply power between VCC and GND pins. Set RST pin to ―H‖. If a

crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 24 MHz clock to

XTAL1 pin and wait for at least 10 milliseconds.

2. Enable serial programming by sending the Programming Enable serial instruction to pin

MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the

CPU clock at XTAL1 divided by 40.

3. The Code or Data array is programmed one byte at a time by supplying the address and data

together with the appropriate Write instruction. The selected memory loca-tion is first

automatically erased before new data is written. The write cycle is self-timed and typically takes

less than 2.5 ms at 5V.

4. Any memory location can be verified by using the Read instruction which returns the content

at the selected address at serial output MISO/P1.6.

5. At the end of a programming session, RST can be set low to commence normal operation.

6. Power-off sequence (if needed): Set XTAL1 to ―L‖ (if a crystal is not used). Set RST to ―L‖.

Turn VCC power off.

The algorithm used in this project to enable EEPROM is serial programming mode.

Page 24: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 24/60

Machine cycle for the 8052

The CPU takes a certain number of clock cycles to execute an instruction. In the 8052 family,

these clock cycles are referred to as machine cycles. The length of the machine cycle depends on

the frequency of the crystal oscillator. The crystal oscillator, along with on-chip circuitry,

 provides the clock source for the 8052 CPU.

The frequency can vary from 4 MHz to 30 MHz, depending upon the chip rating and

manufacturer. But the exact frequency of 11.0592 MHz crystal oscillator is used to make the

8052 based system compatible with the serial port of the IBM PC.

In the original version of 8052, one machine cycle lasts 12 oscillator periods. Therefore, to

calculate the machine cycle for the 8052, the calculation is made as 1/12 of the crystal frequency

and its inverse is taken.

POWER SUPPLY:

The input to the circuit is applied from the regulated power supply. The a.c. input i.e., 230V from

the mains supply is step down by the transformer to 12V and is fed to a rectifier. The output

obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c voltage, the

output voltage from the rectifier is fed to a filter to remove any a.c components present even after

rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc

voltage.

Regulator

Bridge

Rectifier

Step down

transformer

230V AC

50Hz 

D.C

Output

Page 25: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 25/60

 

Fig: Power supply

Transformer:

Usually, DC voltages are required to operate various electronic equipment and these voltages are

5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.c input available at the

mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a

transformer. Thus, a step down transformer is employed to decrease the voltage to a required

level.

Rectifier:

The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C. The

rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used

 because of its merits like good stability and full wave rectification.

Filter:

Capacitive filter is used in this project. It removes the ripples from the output of rectifier and

smoothens the D.C. Output received from this filter is constant until the mains voltage and load

is maintained constant. However, if either of the two is varied, D.C. voltage received at this point

changes. Therefore a regulator is applied at the output stage.

Voltage regulator:

As the name itself implies, it regulates the input applied to it. A voltage regulator is an

electrical regulator designed to automatically maintain a constant voltage level. In this project,

 power supply of 5V and 12V are required. In order to obtain these voltage levels, 7805 and 7812

voltage regulators are to be used. The first number 78 represents positive supply and the numbers

05, 12 represent the required output voltage levels.

Page 26: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 26/60

CAPACITORS:-

A capacitor or condenser is a passive electronic component consisting of a pair of

conductors separated by a dielectric. When a voltage potential difference exists between the

conductors, an electric field is present in the dielectric. This field stores energy and produces a

mechanical force between the plates. The effect is greatest between wide, flat, parallel, narrowly

separated conductors.

Fig -25:

An ideal capacitor is characterized by a single constant value, capacitance, which is

measured in farads. This is the ratio of the electric charge on each conductor to the potential

difference between them. In practice, the dielectric between the plates passes a small amount of

leakage current. The conductors and leads introduce an equivalent series resistance and the

dielectric has an electric field strength limit resulting in a breakdown voltage.

Page 27: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 27/60

  The properties of capacitors in a circuit may determine the resonant frequency and

quality factor of a resonant circuit, power dissipation and operating frequency in a digital logic

circuit, energy capacity in a high-power system, and many other important aspects.

A capacitor (formerly known as condenser) is a device for storing electric charge. The forms of

 practical capacitors vary widely, but all contain at least two conductors separated by a non-

conductor. Capacitors used as parts of electrical systems, for example, consist of metal foils

separated by a layer of insulating film.

Capacitors are widely used in electronic circuits for blocking direct current while allowing

alternating current to pass, in filter networks, for smoothing the output of  power supplies, in the

resonant circuits that tune radios to particular  frequencies and for many other purposes.

.

History

Fig-26:

Battery of four  Leyden jars in Museum Boerhaave, Leiden, the Netherlands

In October 1745, Ewald Georg von Kleist of  Pomerania in Germany found that charge could be

stored by connecting a high voltage electrostatic generator by a wire to a volume of water in a

Page 28: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 28/60

hand-held glass jar. Von Kleist's hand and the water acted as conductors and the jar as a

dielectric (although details of the mechanism were incorrectly identified at the time). Von Kleist

found, after removing the generator that touching the wire resulted in a painful spark. In a letter

describing the experiment, he said "I would not take a second shock for the kingdom of France."

The following year, the Dutch physicist Pieter van Musschenbroek invented a similar capacitor,

which was named the Leyden jar, after the University of Leiden where he worked.

Daniel Gralath was the first to combine several jars in parallel into a "battery" to increase the

charge storage capacity. Benjamin Franklin investigated the Leyden jar and "proved" that the

charge was stored on the glass, not in the water as others had assumed. He also adopted the term

"battery", (denoting the increasing of power with a row of similar units as in a battery of

cannon), subsequently applied to clusters of electrochemical cells. Leyden jars were later made

 by coating the inside and outside of jars with metal foil, leaving a space at the mouth to prevent

arcing between the foils. The earliest unit of capacitance was the 'jar', equivalent to about 1

nanofarad Leyden jars or more powerful devices employing flat glass plates alternating with foil

conductors were used exclusively up until about 1900, when the invention of  wireless (radio) 

created a demand for standard capacitors, and the steady move to higher  frequencies required

capacitors with lower  inductance. A more compact construction began to be used of a flexible

dielectric sheet such as oiled paper sandwiched between sheets of metal foil, rolled or folded into

a small package.

Early capacitors were also known as condensers, a term that is still occasionally used

today. The term was first used for this purpose by Alessandro Volta in 1782, with reference to

the device's ability to store a higher density of electric charge than a normal isolated conductor.

Theory of operation

Capacitance

Page 29: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 29/60

 

Fig-27:

Charge separation in a parallel-plate capacitor causes an internal electric field. A dielectric

(orange) reduces the field and increases the capacitance.

Fig -28:

A simple demonstration of a parallel-plate capacitor

A capacitor consists of two conductors separated by a non-conductive region. The non-

conductive region is called the dielectric or sometimes the dielectric medium. In simpler terms,

the dielectric is just an electrical insulator. Examples of dielectric mediums are glass, air, paper,

Page 30: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 30/60

Page 31: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 31/60

Current-voltage relation

The current i(t) through any component in an electric circuit is defined as the rate of flow of a

charge q(t) passing through it, but actual charges, electrons, cannot pass through the dielectric

layer of a capacitor, rather an electron accumulates on the negative plate for each one that leaves

the positive plate, resulting in an electron depletion and consequent positive charge on one

electrode that is equal and opposite to the accumulated negative charge on the other. Thus the

charge on the electrodes is equal to the integral of the current as well as proportional to the

voltage as discussed above. As with any anti-derivative, a constant of integration is added to

represent the initial voltage v (t0). This is the integral form of the capacitor equation,

.

Taking the derivative of this, and multiplying by C, yields the derivative form,

.

The dual of the capacitor is the inductor, which stores energy in the magnetic field rather than the

electric field. Its current-voltage relation is obtained by exchanging current and voltage in the

capacitor equations and replacing C with the inductance L.

DC circuits

RC circuit

Page 32: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 32/60

A simple resistor-capacitor circuit demonstrates charging of a capacitor

A series circuit containing only a resistor, a capacitor, a switch and a constant DC source of

voltage V0 is known as a charging circuit. If the capacitor is initially uncharged while the switch

is open, and the switch is closed at t = 0, it follows from Kirchhoff's voltage law that

Taking the derivative and multiplying by C, gives a first-order differential equation, 

At t = 0, the voltage across the capacitor is zero and the voltage across the resistor is V0. The

initial current is then i (0) =V0 /R. With this assumption, the differential equation yields

where τ0 = RC is the time constant of the system.

As the capacitor reaches equilibrium with the source voltage, the voltage across the resistor and

the current through the entire circuit decay exponentially. The case of discharging a charged

capacitor likewise demonstrates exponential decay, but with the initial capacitor voltage

replacing V0 and the final voltage being zero.

AC circuits

Impedance, the vector sum of  reactance and resistance, describes the phase difference and the

ratio of amplitudes between sinusoidally varying voltage and sinusoidally varying current at a

given frequency. Fourier analysis allows any signal to be constructed from a spectrum of

Page 33: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 33/60

frequencies, whence the circuit's reaction to the various frequencies may be found. The reactance

and impedance of a capacitor are respectively

where j is the imaginary unit and ω is the angular velocity of the sinusoidal signal. The - j phase

indicates that the AC voltage V = Z I lags the AC current by 90°: the positive current phase

corresponds to increasing voltage as the capacitor charges; zero current corresponds to

instantaneous constant voltage, etc.

 Note that impedance decreases with increasing capacitance and increasing frequency. This

implies that a higher-frequency signal or a larger capacitor results in a lower voltage amplitude

 per current amplitude an AC "short circuit" or  AC coupling. Conversely, for very low

frequencies, the reactance will be high, so that a capacitor is nearly an open circuit in AC

analysis — those frequencies have been "filtered out".

Capacitors are different from resistors and inductors in that the impedance is inversely

 proportional to the defining characteristic, i.e. capacitance.

Parallel plate model

Page 34: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 34/60

Fig-29:

Dielectric is placed between two conducting plates, each of area A and with a separation

of d.The simplest capacitor consists of two parallel conductive plates separated by a dielectric

with permittivity ε (such as air). The model may also be used to make qualitative predictions f or

other device geometries. The plates are considered to extend uniformly over an area A and a

charge density ±ρ = ±Q/A exists on their surface. Assuming that the width of the plates is much

greater than their separation d, the electric field near the centre of the device will be uniform with

the magnitude E = ρ/ε. The voltage is defined as the line integral of the electric field between the

 plates

Solving this for C = Q/V reveals that capacitance increases with area and decreases with

separation

.

The capacitance is therefore greatest in devices made from materials with a high permittivity.

Several capacitors in parallel

 Networks

For capacitors in parallel

Page 35: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 35/60

Capacitors in a parallel configuration each have the same applied voltage. Their capacitances add

up. Charge is apportioned among them by size. Using the schematic diagram to visualize parallel

 plates, it is apparent that each capacitor contributes to the total surface area.

For capacitors in series

Several capacitors in series

Connected in series, the schematic diagram reveals that the separation distance, not the plate

area, adds up. The capacitors each store instantaneous charge build-up equal to that of every

other capacitor in the series. The total voltage difference from end to end is apportioned to each

capacitor according to the inverse of its capacitance. The entire series acts as a capacitor smaller

than any of its components.

Capacitors are combined in series to achieve a higher working voltage, for example for

smoothing a high voltage power supply. The voltage ratings, which are based on plate

separation, add up. In such an application, several series connections may in turn be connected in

 parallel, forming a matrix. The goal is to maximize the energy storage utility of each capacitor

without overloading it. Series connection is also used to adapt electrolytic capacitors for AC use.

 Non-ideal behavior

Capacitors deviate from the ideal capacitor equation in a number of ways. Some of these, such as

leakage current and parasitic effects are linear, or can be assumed to be linear, and can be dealt

with by adding virtual components to the equivalent circuit of the capacitor. The usual methods

of  network analysis can then be applied. In other cases, such as with breakdown voltage, the

effect is non-linear and normal (i.e., linear) network analysis cannot be used, the effect must be

Page 36: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 36/60

dealt with separately. There is yet another group, which may be linear but invalidate the

assumption in the analysis that capacitance is a constant. Such an example is temperature

dependence.

Breakdown voltage

Above a particular electric field, known as the dielectric strength Eds, the dielectric in a

capacitor becomes conductive. The voltage at which this occurs is called the breakdown voltage

of the device, and is given by the product of the dielectric strength and the separation between

the conductors,

Vbd = Edsd

The maximum energy that can be stored safely in a capacitor is limited by the breakdown

voltage. Due to the scaling of capacitance and breakdown voltage with dielectric thickness, all

capacitors made with a particular dielectric have approximately equal maximum energy density, 

to the extent that the dielectric dominates their volume.

For air dielectric capacitors the breakdown field strength is of the order 2 to 5MV/m; for  mica

the breakdown is 100 to 300 MV/m, for oil 15 to 25MV/m, and can be much less when other

materials are used for the dielectric. The dielectric is used in very thin layers and so absolute

 breakdown voltage of capacitors is limited. Typical ratings for capacitors used for general

electronics applications range from a few volts to 100V or so. As the voltage increases, the

dielectric must be thicker, making high-voltage capacitors larger than those rated for lower

voltages. The breakdown voltage is critically affected by factors such as the geometry of the

capacitor conductive parts; sharp edges or points increase the electric field strength at that point

and can lead to a local breakdown. Once this starts to happen, the breakdown will quickly "track"

through the dielectric till it reaches the opposite plate and cause a short circuit. The usual

 breakdown route is that the field strength becomes large enough to pull electrons in the dielectric

from their atoms thus causing conduction. Other scenarios are possible, such as impurities in the

dielectric, and, if the dielectric is of a crystalline nature, imperfections in the crystal structure can

Page 37: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 37/60

result in an avalanche breakdown as seen in semi-conductor devices. Breakdown voltage is also

affected by pressure, humidity and temperature.

Equivalent circuit

Fig-30:

Two different circuit models of a real capacitor

An ideal capacitor only stores and releases electrical energy, without dissipating any. In reality,

all capacitors have imperfections within the capacitor's material that create resistance. This is

specified as the equivalent series resistance or ESR of a component. This adds a real component

to the impedance:

As frequency approaches infinity, the capacitive impedance (or reactance) approaches zero andthe ESR becomes significant. As the reactance becomes negligible, power dissipation approaches

PRMS = VRMS² /RESR.

Similarly to ESR, the capacitor's leads add equivalent series inductance or ESL to the

component. This is usually significant only at relatively high frequencies. As inductive reactance

Page 38: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 38/60

is positive and increases with frequency, above a certain frequency capacitance will be cancelled

 by inductance. High-frequency engineering involves accounting for the inductance of all

connections and components.

If the conductors are separated by a material with a small conductivity rather than a perfect

dielectric, then a small leakage current flows directly between them. The capacitor therefore has

a finite parallel resistance, and slowly discharges over time (time may vary greatly depending on

the capacitor material and quality).

Ripple current

Ripple current is the AC component of an applied source (often a switched-mode power supply) 

whose frequency may be constant or varying. Certain types of capacitors, such as electrolytic

tantalum capacitors, usually have a rating for maximum ripple current (both in frequency and

magnitude). This ripple current can cause damaging heat to be generated within the capacitor due

to the current flow across resistive imperfections in the materials used within the capacitor, more

commonly referred to as equivalent series resistance (ESR). For example electrolytic tantalum

capacitors are limited by ripple current and generally have the highest ESR ratings in the

capacitor family, while ceramic capacitors generally have no ripple current limitation and have

some of the lowest ESR ratings.

Capacitance instability

The capacitance of certain capacitors decreases as the component ages. In ceramic capacitors,

this is caused by degradation of the dielectric. The type of dielectric and the ambient operating

and storage temperatures are the most significant aging factors, while the operating voltage has a

smaller effect. The aging process may be reversed by heating the component above the Curie

 point. Aging is fastest near the beginning of life of the component, and the device stabilizes over

time. Electrolytic capacitors age as the electrolyte evaporates. In contrast with ceramic

capacitors, this occurs towards the end of life of the component.

Page 39: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 39/60

Temperature dependence of capacitance is usually expressed in parts per million (ppm) per °C. It

can usually be taken as a broadly linear function but can be noticeably non-linear at the

temperature extremes. The temperature coefficient can be either positive or negative, sometimes

even amongst different samples of the same type. In other words, the spread in the range of

temperature coefficients can encompass zero. See the data sheet in the leakage current section

above for an example.

Capacitor types

Types of capacitor

Practical capacitors are available commercially in many different forms. The type of internal

dielectric, the structure of the plates and the device packaging all strongly affect the

characteristics of the capacitor, and its applications.

Values available range from very low (pico farad range; while arbitrarily low values are in

 principle possible, stray (parasitic) capacitance in any circuit is the limiting factor) to about 5 kF

super capacitors. 

Dielectric materials

Fig-31:

Capacitor materials. From left: multilayer ceramic, ceramic disc, multilayer polyester

film, tubular ceramic, polystyrene, metalized polyester film, aluminum electrolytic. Major scale

divisions are in centimeters.

Page 40: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 40/60

Most types of capacitor include a dielectric spacer, which increases their capacitance. These

dielectrics are most often insulators. However, low capacitance devices are available with a

vacuum between their plates, which allows extremely high voltage operation and low losses.

Variable capacitors with their plates open to the atmosphere were commonly used in radio tuning

circuits. Later designs use polymer foil dielectric between the moving and stationary plates, with

no significant air space between them.

In order to maximise the charge that a capacitor can hold, the dielectric material needs to have as

high a permittivity as possible, while also having as high a breakdown voltage as possible.

Tantalum capacitors offer better frequency and temperature characteristics than aluminium, but

higher  dielectric absorption and leakage. OS-CON (or OC-CON) capacitors are a polymerized

organic semiconductor solid-electrolyte type that offer longer life at higher cost than standard

electrolytic capacitors.

Several other types of capacitor are available for specialist applications. Super capacitors store

large amounts of energy. Super capacitors made from carbon aerogel, carbon nano tubes, or

highly porous electrode materials offer extremely high capacitance (up to 5 kF as of

2010[update]) and can be used in some applications instead of  rechargeable batteries. Alternating

current capacitors are specifically designed to work on line (mains) voltage AC power circuits.

They are commonly used in electric motor circuits and are often designed to handle large

currents, so they tend to be physically large. They are usually ruggedly packaged, often in metal

cases that can be easily grounded /earthed. They also are designed with direct current breakdown

voltages of at least five times the maximum AC voltage.

Structure

Page 41: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 41/60

 

Fig -32:

Capacitor packages: SMD ceramic at top left; SMD tantalum at bottom left; through-hole

tantalum at top right; through-hole electrolytic at bottom right. Major scale divisions are cm.

The arrangement of plates and dielectric has many variations depending on the desired ratings of

the capacitor. For small values of capacitance (microfarads and less), ceramic disks use metallic

coatings, with wire leads bonded to the coating. Larger values can be made by multiple stacks of

 plates and disks. Larger value capacitors usually use a metal foil or metal film layer deposited on

the surface of a dielectric film to make the plates, and a dielectric film of impregnated paper or

 plastic –  these are rolled up to save space. To reduce the series resistance and inductance for long

 plates, the plates and dielectric are staggered so that connection is made at the common edge of

the rolled-up plates, not at the ends of the foil or metalized film strips that comprise the plates.

The assembly is encased to prevent moisture entering the dielectric –  early radio equipment used

a cardboard tube sealed with wax. Modern paper or film dielectric capacitors are dipped in a hard

thermoplastic. Large capacitors for high-voltage use may have the roll form compressed to fit

into a rectangular metal case, with bolted terminals and bushings for connections. The dielectric

in larger capacitors is often impregnated with a liquid to improve its properties.

Capacitors may have their connecting leads arranged in many configurations, for example axially

or radially. "Axial" means that the leads are on a common axis, typically the axis of the

capacitor's cylindrical body –  the leads extend from opposite ends. Radial leads might more

accurately be referred to as tandem; they are rarely actually aligned along radii of the body's

circle, so the term is inexact, although universal. The leads (until bent) are usually in planes

 parallel to that of the flat body of the capacitor, and extend in the same direction; they are often

 parallel as manufactured.

.Capacitor markings

Page 42: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 42/60

Most capacitors have numbers printed on their bodies to indicate their electrical characteristics.

Larger capacitors like electrolytics usually display the actual capacitance together with the unit

(for example, 220 μF). Smaller capacitors like ceramics, however, use a shorthand consisting of

three numbers and a letter, where the numbers show the capacitance in pF (calculated as XY x

10Z for the numbers XYZ) and the letter indicates the tolerance (J, K or M for ±5%, ±10% and

±20% respectively).

Additionally, the capacitor may show its working voltage, temperature and other relevant

characteristics.

Example

A capacitor with the text 473K 330V on its body has a capacitance of 47 x 103 pF = 47 nF

(±10%) with a working voltage of 330 V.

Applications

Capacitors have many uses in electronic and electrical systems. They are so common that it is a

rare electrical product that does not include at least one for some purpose.

Energy storage

A capacitor can store electric energy when disconnected from its charging circuit, so it can be

used like a temporary battery. Capacitors are commonly used in electronic devices to maintain

 power supply while batteries are being changed. (This prevents loss of information in volatile

memory.)

Conventional capacitors provide less than 360 joules per kilogram of energy density, while

capacitors using developing technologies could provide more than 2.52 kilojoules per kilogram.

Page 43: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 43/60

In car audio systems, large capacitors store energy for the amplifier to use on demand. Also for a

flash tube a capacitor is used to hold the high voltage. 

Pulsed power and weapons

Groups of large, specially constructed, low-inductance high-voltage capacitors (capacitor banks)

are used to supply huge pulses of current for many pulsed power applications. These include

electromagnetic forming, Marx generators, pulsed lasers (especially TEA lasers), pulse forming

networks, radar, fusion research, and particle accelerators. 

Large capacitor banks (reservoir) are used as energy sources for the exploding bridge wire

detonators or  slapper detonators in nuclear weapons and other specialty weapons. Experimental

work is under way using banks of capacitors as power sources for  electromagneticarmour and

electromagnetic railguns and coilguns. 

RF MODULE:-

The RF module, as the name suggests, operates at Radio Frequency. The corresponding

frequency range varies between 30 kHz & 300 GHz. In this RF system, the digital data is

represented as variations in the amplitude of carrier wave. This kind of modulation is known as

Amplitude Shift Keying (ASK).

Transmission through RF is better than IR (infrared) because of many reasons. Firstly, signals

through RF can travel through larger distances making it suitable for long range applications.

Also, while IR mostly operates in line-of-sight mode, RF signals can travel even when there is an

obstruction between transmitter & receiver. Next, RF transmission is more strong and reliable

than IR transmission. RF communication uses a specific frequency unlike IR signals which are

affected by other IR emitting sources.

Page 44: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 44/60

This RF module comprises of an RF Transmitter and an RF Receiver. The transmitter/receiver

(Tx/Rx) pair operates at a frequency of 434 MHz. An RF transmitter receives serial data and

transmits it wirelessly through RF through its antenna connected at pin4. The transmission

occurs at the rate of 1Kbps - 10Kbps.The transmitted data is received by an RF receiver

operating at the same frequency as that of the transmitter.

The RF module is often used alongwith a pair of encoder/decoder. The encoder is used for

encoding parallel data for transmission feed while reception is decoded by a decoder. HT12E-

HT12D, HT640-HT648, etc. are some commonly used encoder/decoder pair ICs.

Pin Diagram:

Page 45: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 45/60

Pin Description:

RF Transmitter

Pin No Function Name

1 Ground (0V) Ground

2 Serial data input pin Data

3 Supply voltage; 5V Vcc

4 Antenna output pin ANT

RF Receiver

Pin No Function Name

1 Ground (0V) Ground

2 Serial data output pin Data

3 Linear output pin; not connected NC

4 Supply voltage; 5V Vcc

5 Supply voltage; 5V Vcc

6 Ground (0V) Ground

7 Ground (0V) Ground

Page 46: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 46/60

8 Antenna input pin ANT

LED INTERFACING:

LED stands for Light Emitting Diode.

Microcontroller port pins cannot drive these LEDs as these require high currents to switch on.

Thus the positive terminal of LED is directly connected to Vcc, power supply and the negative

terminal is connected to port pin through a current limiting resistor.

Light-emitting diodes are elements for light signalization in electronics. They are manufactured

in different shapes, colors and sizes. For their low price, low consumption and simple use, they

have almost completely pushed aside other light sources- bulbs at first place. They perform

similar to common diodes with the difference that they emit light when current flows through

them.

Page 47: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 47/60

It is important to know that each diode will be immediately destroyed unless its current is

limited. This means that a conductor must be connected in parallel to a diode. In order to

correctly determine value of this

conductor, it is necessary to know diode’s

voltage drop in forward direction, which

depends on what material a diode is made

of and what colour it is. Values typical for the

most frequently used diodes are shown in table

 below: As seen, there are three main types

of LEDs. Standard ones get ful

 brightness at current of 20mA. Low

Current diodes get ful brightness at ten times lower current while Super Bright diodes produce

more intensive light than Standard ones.

Since the 8052 microcontrollers can provide only low input current and since their pins are

configured as outputs when voltage level on them is equal to 0, direct connectining to LEDs is

carried out as it is shown on figure (Low current LED, cathode is connected to output pin).

This current limiting resistor is connected to protect the port pins from sudden flow of high

currents from the power supply.

Thus in order to glow the LED, first there should be a current flow through the LED. In order to

have a current flow, a voltage difference should exist between the LED terminals. To ensure the

voltage difference between the terminals and as the positive terminal of LED is connected to

 power supply Vcc, the negative terminal has to be connected to ground. Thus this ground value

is provided by the microcontroller port pin. This can be achieved by writing an instruction ―CLR

P1.0‖. With this, the port pin P1.0 is initialized to zero and thus now a voltage difference is

established between the LED terminals and accordingly, current flows and therefore the LED

glows. LED and switches can be connected to any one of the four port pins.

Page 48: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 48/60

 

Fig: LED Interfacing with the microcontroller

In this project, four LEDS are used, two for each IR section. Red LED is to indicate that the gate

is closed and Green LED to indicate the gate is opened.

SEVEN SEGMENT DISPLAY:

A seven-segment display less commonly known as a seven-segment indicator is a form of

display device that is an alternative to the more complex dot-matrix displays. Seven segment

displays are commonly used in electronics as a method of displaying decimal numeric feedback

on the internal operations of devices.

P1.0

Vcc

Page 49: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 49/60

 

Fig: LED-based 7-segment display showing the 16 hex digits.

Fig: The individual segments of a seven-segment display.

Fig: A typical 7-segment LED display component, with decimal point.

Seven-segment displays may use liquid crystal display (LCD), arrays of light-emitting diodes

(LEDs), and other light-generating or controlling techniques such as such as cold cathode gas

discharge, vacuum fluorescent, incandescent filaments, and others. For gasoline price totems and

other large signs, electromagnetically flipped light-reflecting segments (sometimes called

"vanes") are still commonly used. An alternative to the 7 segment display in the 1950s through

the 1970s was the cold-cathode, neon-lamp-like nixie tube. Starting in 1970, RCA sold a display

Page 50: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 50/60

device known as the Numitron that used incandescent filaments arranged into a seven-segment

display.

In a simple LED package, each LED is typically connected with one terminal to its own pin on

the outside of the package and the other LED terminal connected in common with all other LEDs

in the device and brought out to a shared pin. This shared pin will then make up all of the

cathodes (negative terminals) OR all of the anodes (positive terminals) of the LEDs in the

device; and so will be either a "Common Cathode" or "Common Anode" device depending how

it is constructed. Hence a 7 segment plus DP package will only require nine pins to be present

and connected.

Integrated displays also exist, with single or multiple digits. Some of these integrated displays

incorporate their own internal decoder, though most do not. Each individual LED is brought out

to a connecting pin as described. Multiple-digit LED displays as used in pocket calculators and

similar devices used multiplexed displays to reduce the number of IC pins required to control the

display. For example, all the anodes of the A segments of each digit position would be connected

together and to a driver pin, while the cathodes of all segments for each digit would be

connected. To operate any particular segment of any digit, the controlling integrated circuit

would turn on the cathode driver for the selected digit, and the anode drivers for the desired

segments; then after a short blanking interval the next digit would be selected and new segments

lit, in a sequential fashion. In this manner an eight digit display with seven segments and a

decimal point would require only 8 cathode drivers and 8 anode drivers, instead of sixty-four

drivers and IC pins. Often in pocket calculators the digit drive lines would be used to scan the

keyboard as well, providing further savings; however, pressing multiple keys at once would

 produce odd results on the multiplexed display.

7 Segment displays are basically 7 LED's.

Page 51: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 51/60

 

Basically there are two types of 7-Seg displays:

Common Cathode where all the segments share the same Cathode.

Common Anode where all Segments share the same Anode.

In this project, we are using the Common Anode type. In common, Anode in order to turn ON a

segment, the corresponding pin must be set to 0. Moreover, to turn it OFF, it is set to 1.

Page 52: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 52/60

 

Fig: 7 segment display interface with microcontroller

Fig: Lookup table

Page 53: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 53/60

 

Fig: Interfacing 7 segment displays with microcontroller using transistors

Page 54: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 54/60

 

Page 55: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 55/60

 

Page 56: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 56/60

 

ULN2003 CURRENT DRIVER:

Fig: DIP 16 Package

The ULN2003 current driver is a high voltage, high current Darlington arrays each containing

seven open collector Darlington pairs with common emitters. Each channel is rated at 500mA

and can withstand peak currents of 600mA. Suppression diodes are included for inductive load

driving and the inputs are pinned opposite the outputs to simplify board layout.

These versatile devices are useful for driving a wide range of loads including solenoids, relays

DC motors, LED displays filament lamps, thermal print heads and high power buffers. This chip

is supplied in 16 pin plastic DIP packages with a copper lead frame to reduce thermal resistance.

Page 57: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 57/60

 

Fig: Pin Connection

This ULN2003 driver can drive seven relays at a time. The pins 8 and 9 provide ground and Vcc

respectively.

The working of ULN driver is as follows:

It can accept seven inputs at a time and produces seven corresponding outputs. If the input to any

one of the seven input pins is high, then the value at its corresponding output pin will be low, for

example if the input at pin 6 is high, then the value at the corresponding output i.e., output at pin

11 will be low. Similarly if the input at a particular pin is low, then the corresponding output will

 be high.

Page 58: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 58/60

Stepper motor contains five terminals. These five terminals are connected to the ULN driver, one

of which is connected to VCC pin of ULN driver. In order to rotate the stepper motor, the ULN

driver should be provided with an input from the microcontroller.

2.1.4 LED

LEDs are semiconductor devices. Like transistors, and other diodes, LEDs are made out of

silicon. What makes an LED give off light are the small amounts of chemical impurities that are

added to the silicon, such as gallium, arsenide, indium, and nitride.

When current passes through the LED, it emits photons as a byproduct. Normal light bulbs

 produce light by heating a metal filament until it is white hot. LEDs produce photons directly

and not via heat, they are far more efficient than incandescent bulbs.

Fig -11 : Typical LED

Fig - 12: circuit symbol

Page 59: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 59/60

 Not long ago LEDs were only bright enough to be used as indicators on dashboards or electronic

equipment. But recent advances have made LEDs bright enough to rival traditional lighting

technologies. Modern LEDs can replace incandescent bulbs in almost any application.

Switches:-

In electrical engineering, a switch is an electrical component that can break an electrical circuit,

interrupting the current or diverting it from one conductor to another. The most familiar form of

switch is a manually operated electromechanical device with one or more sets of electrical

contacts, which are connected to external circuits. Each set of contacts can be in one of two

states: either "closed" meaning the contacts are touching and electricity can flow between them,

or "open", meaning the contacts are separated and the switch is nonconducting. The mechanism

actuating the transition between these two states (open or closed) can be either a "toggle" (flip

switch for continuous "on" or "off") or "momentary" (push-for "on" or push-for "off") type.

A switch may be directly manipulated by a human as a control signal to a system, such as a

computer keyboard button, or to control power flow in a circuit, such as a light switch.

Automatically operated switches can be used to control the motions of machines, for example, to

indicate that a garage door has reached its full open position or that a machine tool is in a

 position to accept another workpiece. Switches may be operated by process variables such as

 pressure, temperature, flow, current, voltage, and force, acting as sensors in a process and used to

automatically control a system. For example, a thermostat is a temperature-operated switch used

to control a heating process. A switch that is operated by another electrical circuit is called a

relay. Large switches may be remotely operated by a motor drive mechanism. Some switches are

used to isolate electric power from a system, providing a visible point of isolation that can be

 padlocked if necessary to prevent accidental operation of a machine during maintenance, or to

 prevent electric shock.

Page 60: Document of Trafic Light Control Priority for Emergency Vehicles

8/10/2019 Document of Trafic Light Control Priority for Emergency Vehicles

http://slidepdf.com/reader/full/document-of-trafic-light-control-priority-for-emergency-vehicles 60/60

An ideal switch would have no voltage drop when closed, and would have no limits on voltage

or current rating. It would have zero rise time and fall time during state changes, and would

change state without "bouncing" between on and off positions.

Practical switches fall short of this ideal; they have resistance, limits on the current and voltage

they can handle, finite switching time, etc. The ideal switch is often used in circuit analysis as it

greatly simplifies the system of equations to be solved, but this can lead to a less accurate

solution. Theoretical treatment of the effects of non-ideal properties is required in the design of

large networks of switches, as for example used in telephone exchanges.