VIEWS: 452 PAGES: 23

									                     TRAFFIC LIGHT CONTROLLER

Power Supply
Power supply fundamental:-

For any electronics project the power supply plays a very important role in its proper

In this project we are using external A.C supply (220 v) as input , this high voltage is
converted into 12 Volts A.C by step down transformer , then we use voltage regulators
and filters with bridge rectifier to convert the A.C into D.C voltage .
For voltage regulation we are using LM 7805 and 7812 to produce ripple free 5 and 12
volts D.C constant supply.

Voltage regulator LM 78XX :-

                                           IC LM 78XX
                      LM 78XX Series

Basic fundamental:-
   Power supply application circuit :-


 The IC 8051 is a low-power; high-performance CMOS 8-bit microcomputer
with 4K bytes of Flash programmable and erasable read only memory
(PEROM). The device is manufactured using Atmel’s high-density nonvolatile
memory technology and is compatible with the industry-standard MCS-51
instruction set and pin out. The on-chip Flash allows the program memory to
be reprogrammed in-system or by a conventional nonvolatile memory
programmer. By combining a versatile 8-bit CPU with Flash on a monolithic
chip, the Atmel IC 8051 is a powerful microcomputer which provides a highly-
flexible and cost-effective solution to many embedded control applications.
The IC 8051 provides the following standard features: 4K bytes of Flash, 128
bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level
interrupt architecture, full duplex serial port, on-chip oscillator and clock
circuitry. In addition, the IC 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.
Pin Description of the 8051
                P1.0   1               40   Vcc
                P1.1   2               39   P0.0(AD0)
                P1.2   3               38   P0.1(AD1)
                              8051     37
                P1.5   6     (8031)    35   P0.4(AD4)
                P1.6   7               34   P0.5(AD5)
                P1.7   8               33   P0.6(AD6)
                RST    9               32   P0.7(AD7)
        (RXD)P3.0      10              31   EA/VPP
         (TXD)P3.1     11              30   ALE/PROG
        (INT0)P3.2     12              29   PSEN
        (INT1)P3.3     13              28   P2.7(A15)
            (T0)P3.4   14              27   P2.6(A14)
            (T1)P3.5   15              26   P2.5(A13)
          (WR)P3.6     16              25   P2.4(A12)
           (RD)P3.7    17              24   P2.3(A11)
              XTAL2    18              23   P2.2(A10)
              XTAL1    19              22   P2.1(A9)
               GND     20              21   P2.0(A8)    

 Figure No. 1.1: Pin Diagram of 8051

A processor is an electronic device capable of manipulating data in a way
specified by a sequence of instructions.


 Instructions in a computer are binary numbers just like data. Different
numbers, when read and executed by a processor, cause different things to
happen. The instructions are also called opcodes or machine codes.

 Different bit patterns activate or deactivate different parts of the processing
core. Every processor has its own instruction set varying in number, bit
pattern and functionality.


The sequence of instructions is what constitutes a program. The sequence of
instructions may be altered to suit the application.


 Writing and understanding such programs in binary or hexadecimal form is
very difficult ,so each instructions is given a symbolic notation in English
language called as mnemonics. A program written in mnemonics Form is
called an assembly language program. But it must be converted into machine
language for execution by processor.


  An assembly language program should be converted to machine language
for execution by processor. Special software called ASSEMBLER converts a
program written in mnemonics to its equivalent machine opcodes.

A high level language like C may be used to write programs for processors.
Software called compiler converts this high level language program down to
machine code. Ease of programming and portability.


VCC (Pin 40)

Provides voltage to the chip . +5V

GND (Pin 20)


XTAL1 (Pin 19) and XTAL2 (Pin 18)

Crystal Oscillator connected to pins 18, 19.Two capacitors of 30pF value.
Time for one machine cycle:11.0592/12=1.085 µ secs

    RST (Pin 9)


1.Active high. On applying a high pulse to this pin, microcontroller will reset
and terminate all activities.

2.INPUT pin

3.Minimum 2 machine cycles required to make RESET

4.Value of registers after RESET
External Access: EA 31

•Connected to VCC for on chip ROM

•Connected to Ground for external ROM containing the code Input Pin

Program Store Enable: PSEN 29

•Output Pin

•In case of external ROM with code it is connected to the OE pin of the ROM

Address Latch Enable: ALE 30

• Output Pin. Active high

•In case of external ROM ,ALE is used to de multiplex (PORT 0) the address
and data bus by connecting to the G pin of 74LS373 chip

I/O Port Pins and their Functions:

•Four ports P0,P1,P2,P3 with 8 pins each, making a total of 32 input/output

•On RESET all ports are configured as output. They need to be programmed
to make them function as inputs


•Pins 32-39

•Can be used as both Input or Output

•External pull up resistors of 10K need to be connected

•Dual role: 8051 multiplexes address and data through port 0 to save pins

•ALE is used to de multiplex data and address bus

•Pins 1 through 8

•Both input or output

•No dual function

•Internal pull up registers

•On RESET configured as output


•Pins 21 through 28

•No external pull up resistor required

•Both input or output

•Dual Function: Along with Port 0 used to provide the 16-Bit address for
external memory. It provides higher address A8-A16


•Pins 10 through 17

•No external pull up resistors required

             Block Diagram
External interrupts
                      On-chip                     Timer/Counter

     Interrupt        ROM for
                      program        On-chip      Timer 1         Counter
      Control                        RAM                          Inputs
                      code                        Timer 0


                       Bus                          Serial
                                    4 I/O Ports
       OSC            Control                       Port

                                    P0 P1 P2 P3    TxD RxD
Figure   No.   1.3:   Block   Diagram   of   Microcontroller

The Arithmetic Logic Unit (ALU) performs the internal arithmetic manipulation
of data line processor. The instructions read and executed by the processor
decide the operations performed by the ALU and also control the flow of data
between registers and ALU. Operations performed by the

 ALU are Addition , Subtraction , Not , AND , NAND , OR , NOR , XOR , Shift
Left/Right , Rotate Left/right , Compare          etc. Some ALU supports
Multiplication and Division. Operands are generally      transferred from two
registers or from one register and memory location to ALU data inputs. The
result of the operation is the placed back into a given destination register or
memory location from ALU output.


Registers are the internal storage for the processor. The number of registers
varies significantly between processor architectures.


Temporary storage during ALU Operations and data transfers.


Points to memory addresses.


Stores the current status of various flags denoting conditions resulting from
various operations.


Contains configuration bits that affect processor operation and the operating
modes of various internal subsystems.

Memory Organization

Program Memory
Data Memory

The right half of the internal and external data memory spaces available on
Atmel’s Flash microcontrollers. Hardware configuration for accessing up to 2K
bytes of external RAM. In this case, the CPU executes from internal Flash.
Port 0 serves as a multiplexed address/data bus to the RAM, and 3 lines of
Port 2 are used to page the RAM. The CPU generates RD and WR signals as
needed during external RAM accesses. You can assign up to 64K bytes of
external data memory. External data memory addresses can be either 1 or 2
bytes wide. One-byte addresses are often used in conjunction with one or
more other I/O lines to page the RAM. Two-byte addresses can also be used,
in which case the high address byte is emitted at Port 2.

Internal data memory addresses are always 1 byte wide, which implies an
address space of only 256 bytes. However, the addressing modes for internal
RAM can in fact accommodate 384 bytes. Direct addresses higher than 7FH
access one memory space, and indirect addresses higher than 7FH access a
different memory space. Thus, the Upper 128 and SFR space occupying the
same block of addresses, 80H through FFH, although they are physically
separate entities. The lowest 32 bytes are grouped into 4 banks of 8 registers.
Program instructions call out these registers as R0 through R7. Two bits in the
Program Status Word (PSW) select which register bank is in use. This
architecture allows more efficient use of code space, since register
instructions are shorter than instructions that use direct addressing.
Programming Status Word:

The Instruction Set

All members of the Atmel microcontroller family execute the same instruction set.
This instruction set is optimized for 8- bit control applications and it provides a variety
of fast addressing modes for accessing the internal RAM to facilitate byte operations
on small data structures. The instruction set provides extensive support for 1-bit
variables as a separate data type, allowing direct bit manipulation in control and logic
systems that require Boolean processing. The following overview of the instruction
set gives a brief description of how certain instructions can be used.

Program Status Word

The Program Status Word (PSW) contains status bits that reflect the current state of
the CPU. The PSW, shown in Figure 11, resides in SFR space. The PSW contains
the Carry bit, the Auxiliary Carry (for BCD operations), the tworegister bank select
bits, the Overflow flag, a Parity bit, and two user-definable status flags. The Carry bit,
in addition to serving as a Carry bit in arithmetic operations, also serves as the
“Accumulator” for a number of Boolean operations.

The bits RS0 and RS1 select one of the four register banks shown in Figure 8. A
number of instructions refer to these RAM locations as R0 through R7. The status of
the RS0 and RS1 bits at execution time determines which of the four banks is
selected. The Parity bit reflects the number of 1s in the Accumulator: P=1 if the
Accumulator contains an odd number of 1s, and P=0 if the Accumulator contains an
even number of 1s. Thus, the number of 1s in the Accumulator plus P is always
even. Two bits in the PSW are uncommitted and can be used as general purpose
status flags.
Addressing Modes

The addressing modes in the Flash microcontroller instruction set are as follows.

Direct Addressing

In direct addressing, the operand is specified by an 8-bit address field in the
instruction. Only internal data RAM and SFRs can be directly addressed.

Indirect Addressing

In indirect addressing, the instruction specifies a register that contains the address of
the operand. Both internal and external RAM can be indirectly addressed. The
address register for 8-bit addresses can be either the Stack Pointer or R0 or R1 of
the selected register bank. The address register for 16-bit addresses can be only the
16-bit data pointer register, DPTR.

Register Instructions

The register banks, which contain registers R0 through R7, can be accessed by
instructions whose opcodes carry a 3- bit register specification. Instructions that
access the registers this way make efficient use of code, since this mode eliminates
an address byte. When the instruction is executed, one of the eight registers in the
selected bank is accessed. One of four banks is selected at execution time by the
two bank select bits in the PSW.

Register-Specific Instructions

Some instructions are specific to a certain register. For example, some instructions
always operate on the Accumulator, so no address byte is needed to point to it. In
these cases, the opcode itself points to the correct register. Instructions that refer to
the Accumulator as A assemble as Accumulator-specific opcodes.

Indexed Addressing

Program memory can only be accessed via indexed addressing. This addressing
mode is intended for reading look-up tables in program memory. A 16-bit base
register (either DPTR or the Program Counter) points to the base of the table, and
the Accumulator is set up with the table entry number. The address of the table entry
in program memory is formed by adding the Accumulator data to the base pointer.
Another type of indexed addressing is used in the “case jump” instruction. In this
case the dest ination address of a jump instruction is computed as the sum of the
base pointer and the Accumulator data.


Volatile, fast, low capacity, expensive, requires lesser external support circuitry.

Volatile, relatively slow, highest capacity needs continuous refreshing. Hence require
external circuitry.


One time programmable, used for shipping in final products.


Erasable programmable, UV Erasing, Used for system development and debugging.


Electrically erasable and programmable, can be erased programmed in- circuit, Used
for storing system parameters.


Electrically programmable & erasable, large capacity, organized as sectors.


  A bus is a physical group of signal lines that have a related function. Buses allow
for the transfer of electrical signals between different parts of the processor

Processor buses are of three types:

•Data bus

•Address bus

•Control bus


 Processor brain decodes instructions and generate control signal for various sub
units. It has full control over the clock distribution unit of processor.

I/O Peripherals

The I/O devices are used by the processor to communicate with the external world

•Parallel Ports.

•Serial Ports.


       1 About Keil uVision 3
Keil Software to provide you with software development tools for 8051 based
microcontrollers. With the Keil tools, you can generate embedded applications
for virtually every 8051 derivative. The supported microcontrollers are listed in
the µVision
Device Database™. The Keil Software 8051 development tools are designed for
the professional software developer, but any level of programmer can use them to
get the most out of the 8051 microcontroller architecture.
Keil software converts the C-codes into the Intel Hex

                              A view of Keil uVision 3
                           8051 Burner Software

51 BURNER provides you with software burning tools for 8051 based

Microcontrollers in there Flash memory. The 51 BURNER tools, you can burn
AT89SXXXX series of ATMEL microcontrollers .

A popular type consists of seven small, bar-shaped LED segment
arranged so that depending on which combinations are energized, the
numbers 0 to 9 light up. All the LED cathodes (or sometimes anodes) are
joined to form a common connection. Current limiting resistors are
required (e.g. 270 ohms), preferably one per segment. Common cathode
method of connecting an array of display elements.


                                                     Common Cathode
   The main requirements for a suitable LED material are:-

   1)It must have on energy gap of appropriate width.

   2)Both P and N types must exist, preferably with low resistivities.

   3)Efficient radioactive pathways must be present.

   Generally, energy gaps greater than or equal to about 2 are required.

   Commercial LED materials:

   Gallium arsenide (Ga As) doped with Si

   Gallium Phosphide (GaP) doped with N & Bi

   Gallium arsenide Phosphide (Ga As1-x Px)

   Gallium aluminium arsenide (Gax Al1-x As)

To reduce reflection losses in LEDs there are two obvious ways: -

   a) The first is to ensure that most rays strike the surface at less than   the
   critical angle. This may be achieved by shaping the         semiconductor
   /air interface into a hemisphere.

   b) The second technique is to encapsulate the junction in a transparent
   medium of high refractive index. This is usually a plastic material with
   refractive index of about 1.5 molding the plastic into an approximately
   hemispherical shape can minimize the losses at the plastic lair interface.


This circuit oscillates two infrared LED's at 40 khz. To make sure it is
transmitting IR light. The oscillator will be used to generate a square
wave at a desired frequency. The wave is fed into a transistor that drives
an infrared LED on and off very rapidly. Because the emissions are
infrared and very fast, neither is visible to the human eye.

Inexpensive infrared receiver chips are available at 36 kHz, 38 kHz, and
40 kHz. The receivers are sensitive to oscillations several kilohertz to
either side, although reception distance improves with a better signal to
start with.
In our project we use microcontroller to generate the working frequency
of the IR LED. Microcontroller has a inbuilt oscillator by which we
generate 40kHz frequency to transmit a infrared ray from the IR LED.

To top