25.brain relief flash light

Upload: vaishnavi-vangala

Post on 09-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    1/50

    INDEX

    S.no CONTENTS PAGE NUMBERS

    1. Index

    2. Abstract

    3. Chapter-1: Embedded System

    1.1 Introduction

    1.2 Microprocessor and Microcontroller

    1.3 Introduction to Application of embedded system

    1.4 Industrial functions of embedded system

    1.5 Compared with commercial system

    4. Chapter-2: Over view of the Project

    2.1 Introduction of project

    2.2 Block Diagram

    2.3 Software used in Project

    5. Chapter-3: Microcontroller

    3.1 Description

    3.2 Features3.3 Architecture

    3.4 Pin-Configuration of AT89S52

    3.5 Pin-Description

    6. Chapter-4: Hardware Description

    4.1 Power Supply board

    4.2 LED

    4.3 Keypad

    7. Chapter-5: Schematic Diagram

    5.1 Schematic Diagram

    5.2 Schematic Explanation

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    2/50

    8. Coding

    9. Conclusion

    10. Future Aspects

    11. Applications

    12. Bibliography

    2

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    3/50

    ABSTRACT (BRAIN RELEIF FLASH LIGHT)

    Aim:

    . The project brain relief flash light is used to design relaxation to the human beings.

    Description:

    The main purpose of the project is to maintain the relief to Human beings. It is generated

    by connecting seven switches and tri color LED.LED stands for light emitting diode these

    LEDs used for indicating purpose.LED can produce seven Colors VIBGYOR these

    color variations can be done by Setting different frequency and wave length range.

    Different colors have different frequencies and wave length. Depending upon those

    colors we internal set those Frequencies and wave length. The variations can observe by

    Pressing switches.

    Hardware Implementation:

    Microcontroller

    LED

    Keypad

    Software used:

    Keil uVision

    Embedded C

    Express PCB

    3

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    4/50

    CHAPTER-1

    EMBEDDED SYSTEMS

    Introduction

    An embedded system is some combination of computer hardware and software,

    either fixed in capability or programmable, that is specifically designed for a particular

    function.

    A general-purpose definition of embedded systems is that they are devices used to

    control, monitor or assist the operation of equipment, machinery or plant. "Embedded"

    reflects the fact that they are an integral part of the system. In many cases their embedded

    ness may be such that their presence is far from obvious to the casual observer and even

    the more technically skilled might need to examine the operation of a piece of equipment

    for some time before being able to conclude that an embedded control system was

    involved in its functioning. At the other extreme a general-purpose computer may be used

    to control the operation of a large complex processing plant, and its presence will be

    obvious.

    All embedded systems are including computers or microprocessors. Some of

    these computers are however very simple systems as compared with a personal computer.

    The very simplest embedded systems are capable of performing only a single

    function or set of functions to meet a single predetermined purpose. In more complex

    systems an application program that enables the embedded system to be used for a

    particular purpose in a specific application determines the functioning of the embedded

    system. The ability to have programs means that the same embedded system can be used

    for a variety of different purposes. In some cases a microprocessor may be designed in

    such a way that application software for a particular purpose can be added to the basic

    4

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    5/50

    software in a second process, after which it is not possible to make further changes. The

    applications software on such processors is sometimes referred to as firmware

    The simplest devices consist of a single microprocessor (often called a "chip),

    which may itself be packaged with other chips in a hybrid system or Application Specific

    Integrated Circuit (ASIC). Its input comes from a detector or sensor and its output goes to

    a switch or activator which (for example) may start or stop the operation of a machine or,

    by operating a valve, may control the flow of fuel to an engine.

    As the embedded system is the combination of both software and hardware

    Figure: Block diagram of Embedded System

    Software deals with the languages like ALP, C, and VB etc., and Hardware deals with

    Processors, Peripherals, and Memory.

    Memory: It is used to store data or address.

    Peripherals: These are the external devices connected

    EmbeddedSystem

    Software Hardware

    ALP

    C

    VBEtc.,

    Processor

    Peripheralsmemory

    5

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    6/50

    Processor: It is an IC which is used to perform some task

    Processors are classified into four types like:

    1. Micro Processor (p)

    2. Micro controller (c)

    3. Digital Signal Processor (DSP)

    4. Application Specific Integrated Circuits (ASIC)

    Micro Processor (p):

    It is an electronic chip which performs arithmetic and logical operations with

    assistance of internal memory.

    ALU

    CU

    MEMORY

    Figure: Block Diagram of Micro Processor (p)

    Micro Controller (c):

    It is a highly integrated micro processor designed for specific use in embedded systems.

    6

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    7/50

    Figure: Block Diagram of Micro Controller (c)

    Applications of embedded system

    Introduction

    Embedded controllers may be found in many different kinds of system and are

    used for many different applications. The list, which follows, is indicative rather than

    exhaustive. An item in the list may be relevant to a particular company because either (a)it is or involves a core process or product, (b) it is or involves an ancillary function or

    service performed by the company or (c) it refers to a product or service provided by a

    contractor under some form of agreement and the vulnerability of the supplier may need

    to be considered.

    List of applications of embedded systems

    Manufacturing and process control

    Construction industry

    Transport

    Buildings and premises

    Domestic service

    EEPROM, ADC,

    DAC, Timers,

    USART, OscillatorsEtc.,

    ALU

    CU

    Memory

    7

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    8/50

    Communications

    Office systems and mobile equipment

    Banking, finance and commercial

    Medical diagnostics, monitoring and life support

    Testing, monitoring and diagnostic systems

    Industrial functions of embedded systems

    A manufacturing company has provided the following list of embedded systems

    Multi-loop control and monitoring - DCS, SCADA, telemetry

    Panel mounted devices - Control, display, recording and operations

    Safety and security - Alarm and trip systems, fire and gas systems, buildings and facilities

    security

    Field devices - measurement, actuation

    Analytical systems - Laboratory systems; on-line/ plant systems

    Electrical supply - supply, measurement, control, protection

    Tools - for design, documentation, testing, maintenance

    Embedded systems compared with commercial systems

    The Year 2000 problem in embedded systems differs from the problem in commercial /

    database / transaction processing systems (often referred to as IT systems) in a number of

    ways. Firstly the user's problem may much liemuch deeper than packages or applications

    software. It may lie in and be inseparable from systems and operating software and from

    hardware, i.e. in the platform on which the application software is based. When users ofIT systems have hardware or operating software problems they can and should be made

    the concern of the computer supplier: typically, this is not the case with microprocessors

    and devices based on them.

    8

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    9/50

    Secondly in embedded systems the concern is often with intervals rather than with

    specific dates: the need may be for an event to occur at 100-day intervals rather than on

    the 5th day of each month. This has the implication that Year 2000 problems may reveal

    themselves both before and for some time after 1 January 2000 and not at all on the date

    itself.

    The lifetime of embedded systems tends to be greater than that of commercial data

    processing systems: they remain in use for longer without alteration to their software.

    Because their software may therefore be older they are rendered more liable to Year 2000

    problems.

    CHAPTER-2

    OVERVIEW OF PROJECT

    Introduction of the project:

    emWave PC is an easy-to-use software program and patented heart rhythm

    monitor designed to prevent, manage and reverse the negative effects of stress, anxiety,

    fatigue, depression and more. The system is an innovative approach to stress relief based

    on learning to change the heart rhythm pattern and create physiological coherence in the

    body. The analysis of Heart Rate Variability (HRV), or heart rhythms, is recognized as a

    powerful, non-invasive measure that reflects heart-brain interactions and autonomic

    nervous system dynamics, which are particularly sensitive to changes in the emotional

    state. emWave PC collects pulse data through a finger or ear sensor which plugs into your

    computer. The program translates the information from your heart rhythms into user

    friendly graphics displayed on your computer screen.

    9

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    10/50

    In the same way each color in the spectrum is responsible for the emotions of the brain.

    For example the color red can be easily captured by the brain because of its wavelength.

    In the same way depending upon the colors of the spectrum tensions and stress of the

    human brain can be reduced.

    Block Diagram of the Project:

    10

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    11/50

    POWER SUPPLY:

    Process to do the project (block diagram)

    Power Supply:

    In this power supply circuit we are using again four components. Step-down

    transformer is used to step-down the AC 230v into 15v or 12v depending on the

    transformer rating. This transformer output is connected to Bridge rectifier. It converts

    AC 15v into pulsated DC 15v. Because finally we need DC voltage to our

    microcontroller. Bridge rectifier output is fed to the filter circuit to remove the unwanted

    components or ripples. From filter circuit output is fed to the DC voltage regulator. This

    regulator converts this pulsated voltage into constant voltage. If we use 7805 regulator,

    we will get DC 5v. If we use 7812 regulator, we get DC 12v output. This regulator output

    is fed to the microcontroller and different components in the PCB depending on their

    power requirement.

    Microcontroller

    Here we are using AT89S52 controller. This is used to interface and control all

    the devices and operations to meet our requirements.

    KEYPAD:

    11

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    12/50

    Keypads are a part of HMI or Human Machine Interface and play really important

    role in a small embedded system where human interaction or human input is needed

    TRI COLOR LED:

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

    package with three leads. They are called tri-color because mixed red and green light

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

    SOFTWARE USED:

    KEIL Software

    Installing the Keil software on a Windows PC

    Insert the CD-ROM in your computers CD drive

    On most computers, the CD will auto run, and you will see the Keil installation

    menu. If the menu does not appear, manually double click on the Setup icon, in

    the root directory: you will then see the Keil menu.

    On the Keil menu, please select Install Evaluation Software. (You will not

    require a license number to install this software).

    Follow the installation instructions as they appear.

    Loading the Projects

    The example projects for this book are NOT loaded automatically when you install the

    Keil compiler. These files are stored on the CD in a directory /Pont. The files are

    arranged by chapter: for example, the project discussed in Chapter 3 is in the directory

    /Pont/Ch03_00-Hello. Rather than using the projects on the CD (where changes cannot

    be saved), please copy the files from CD onto an appropriate directory on your hard disk.

    Note: you will need to change the file properties after copying: file transferred from the

    CD will be read only.

    Configuring the Simulator

    12

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    13/50

    Open the Keil Vision2

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

    Go to Project Select Device for Target Target1

    13

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    14/50

    Select 8052(all variants) and click OK

    Now we need to check the oscillator frequency:

    Go to project Options for Target Target1

    14

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    15/50

    Make sure that the oscillator frequency is 12MHz.

    Building the Target

    Build the target as illustrated in the figure below

    15

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    16/50

    Running the Simulation

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

    First start a debug session

    16

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    17/50

    The flashing LED we will view will be connected to Port 1. We therefore want to observe

    the activity on this port

    17

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    18/50

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

    flag

    Go to Debug - Go

    18

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    19/50

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

    durations.

    19

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    20/50

    Go to Debug Performance Analyzer and click on it

    20

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    21/50

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

    21

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    22/50

    CHAPTER-3

    MICROCONTROLLER

    Microcontroller

    Description of Microcontroller 89S52:

    The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller with

    8Kbytes of in-system programmable flash memory. The device is manufactured

    Using Atmels high-density nonvolatile memory technology and is compatible with the

    industry-standard 80C51 micro controller. 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 in-system programmable flash one monolithic http;

    the Atmel AT89S52 is a powerful micro controller, which provides a highly flexible and

    cost effective solution to any cost effective solution to any embedded control applications

    to any embedded control applications

    The AT89S52 provides the following standard features: 8K bytes of Flash, 256

    bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit

    timer/counters, full duplex serial port, on-chip oscillator, and clock circuitry. In addition,

    the AT89S52 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

    interrupt Or hardware reset.

    Features:

    Compatible with MCS-51 Products

    22

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    23/50

    8K Bytes of In-System Programmable (ISP) Flash Memory

    Endurance: 1000 Write/Erase Cycles

    4.0V to 5.5V Operating Range

    Fully Static Operation: 0 Hz to 33 MHz

    Three-level Program Memory Lock

    256K Internal RAM

    32 Programmable I/O Lines

    3 16-bit Timer/Counters

    Eight Interrupt Sources

    Full Duplex UART Serial Channel

    Low-power Idle and Power-down Modes

    Interrupt Recovery from Power-down Mode

    Watchdog Timer

    Dual Data Pointer

    Power-off Flag

    23

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    24/50

    Architecture of 8052:

    Fig10: architecture of 8052

    Pin configuration of AT89S52:

    24

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    25/50

    Fig 9: pin configuration

    PIN DESCRIPTIONVCC

    Supply voltage.

    GND

    Ground

    Port 0

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

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

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

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

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

    25

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    26/50

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

    program verification

    Port 1

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

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

    by the internal pull-ups and can be used as inputs. In

    addition, 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, as shown

    in the following table. Port 1 also receives the low-order address bytes during Flash

    programming and verification.

    Port 2

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

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

    by the internal pull-ups and can be used as inputs. Port 2 emits the high-order addressbyte during fetches from external program memory and during accesses to external data

    memory that use 16-bit addresses (MOVX @DPTR). In this application, Port 2 uses

    strong internal pull-ups when emitting 1s. During accesses to external data memory that

    use 8-bit addresses (MOVX @ RI), Port 2emits the contents of the P2 Special

    26

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    27/50

    Function Register. 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 writ 1s are written to Port 3 pins, they are

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

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

    also serves the functions of various special features of the AT89S52, as shown in the

    following table.

    Port 3 also receives some control signals for Flash programming

    And verification.

    RST

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

    resets the device.

    ALE/PROG

    Address Latch Enable (ALE) 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 of1/6

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

    however,

    27

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    28/50

    that one ALE pulse is skipped during each access to external data Memory. If desired,

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

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

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

    execution mode.

    PSEN

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

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

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

    external data memory.

    EA/VPP

    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. A

    should be strapped to VCC for internal program executions. This pin also receives the 12-

    voltProgramming enables voltage (VPP) during Flash programming.

    XTAL1

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

    XTAL2

    Output from the inverting oscillator amplifier.

    Oscillator Characteristics

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

    can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz

    28

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    29/50

    crystal or ceramic resonator may be used. To drive the device from an External clock

    source, XTAL2 should be left unconnected while XTAL1 is driven, as shown in Figure 2.

    Figure 11:. Oscillator Connections

    Special Function Register (SFR) Memory: -

    Special Function Registers (SFR s) are areas of memory that control specific

    functionality of the 8051 processor. For example, four SFRs permit access to the 8051s

    32 input/output lines. Another SFR allows the user to set the serial baud rate, control and

    access timers, and configure the 8051s interrupt system.

    The Accumulator: The Accumulator, as its name suggests is used as a general register to

    accumulate the results of a large number of instructions. It can hold 8-bit (1-byte) value

    and is the most versatile register.

    The R registers: The R registers are a set of eight registers that are named R0, R1.

    Etc up to R7. These registers are used as auxiliary registers in many operations.

    29

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    30/50

    The B registers: The B register is very similar to the accumulator in the sense that it

    may hold an 8-bit (1-byte) value. Two only uses the B register 8051 instructions: MUL

    AB and DIV AB.

    The Data Pointer: The Data pointer (DPTR) is the 8051s only user accessible 16-bit

    (2Bytes) register. The accumulator, R registers are all 1-Byte values. DPTR, as the

    name suggests, is used to point to data. It is used by a number of commands, which allow

    the 8051 to access external memory.

    THE PROGRAM COUNTER AND STACK POINTER:

    The program counter (PC) is a 2-byte address, which tells the 8051 where the next

    instruction to execute is found in memory. The stack pointer like all registers except

    DPTR and PC may hold an 8-bit (1-Byte) value

    ADDRESSING MODES:

    An addressing mode refers that you are addressing a given memory location. In

    summary, the addressing modes are as follows, with an example of each:

    Each of these addressing modes provides important flexibility.

    Immediate Addressing MOV A, #20 H

    Direct Addressing MOV A, 30 H

    Indirect Addressing MOV A, @R0

    Indexed Addressing

    a. External Direct MOVX A, @DPTR

    b. Code In direct MOVC A, @A+DPTR

    Immediate Addressing:

    Immediate addressing is so named because the value to be stored in memory immediately

    follows the operation code in memory. That is to say, the instruction itself dictates what

    value will be stored in memory. For example, the instruction:

    MOV A, #20H:

    This instruction uses immediate Addressing because the accumulator will be loaded with

    the value that immediately follows in this case 20(hexadecimal). Immediate addressing is

    very fast since the value to be loaded is included in the instruction. However, since the

    value to be loaded is fixed at compile-time it is not very flexible.

    30

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    31/50

    Direct Addressing:

    Direct addressing is so named because the value to be stored in memory is obtained by

    directly retrieving it from another memory location.

    for example:

    MOV A, 30h

    This instruction will read the data out of internal RAM address 30(hexadecimal) and

    store it in the Accumulator. Direct addressing is generally fast since, although the value

    to be loaded isnt included in the instruction, it is quickly accessible since it is stored in

    the 8051s internal RAM. It is also much more flexible than Immediate Addressing since

    the value to be loaded is whatever is found at the given address which may variable.

    Also it is important to note that when using direct addressing any instruction that refers to

    an address between 00h and 7Fh is referring to the SFR control registers that control the

    8051 micro controller itself.

    Indirect Addressing:

    Indirect addressing is a very powerful addressing mode, which in many cases provides an

    exceptional level of flexibility. Indirect addressing is also the only way to access the extra

    128 bytes of internal RAM found on the 8052. Indirect addressing appears as follows:

    MOV A, @R0:

    This instruction causes the 8051 to analyze Special Function Register (SFR) Memory:

    Special Function Registers (SFRs) are areas of memory that control specific functionality

    of the 8051 processor. For example, four SFRs permit access to the 8051s 32

    input/output lines. Another SFR allows the user to set the serial baud rate, control and

    access timers, and configure the 8051s interrupt system.

    Timer 2 Registers:

    Control and status bits are contained in registers T2CON and T2MOD for Timer 2.

    The register pair (RCAP2H , RCAP2L) are the Capture / Reload registers for

    Timer 2 in 16-bit capture mode or 16-bit auto-reload mode .

    Interrupt Registers:

    31

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    32/50

    The individual interrupt enable bits are in the IE registe . Two priorities can be

    set for each of the six interrupt sources in the IP register.

    Timer 2:

    Timer 2:

    is a 16-bit Timer / Counter that can operate as either a timer or an event counter.

    The type of operation is selected by bit C/T2 in the SFR T2CON. Timer 2 has

    three operating Modes : capture , auto-reload ( up or down Counting ) , and

    baud rate generator . The modes are selected by bits in T2CON. Timer2 consists

    of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is

    incremented every machine cycle. Since a machine cycle consists of 12 oscillator

    periods, the count rate is 1/12 of the oscillator frequency.

    In the Counter function , the register is incremented in response to a 1-to-0

    transition at its corresponding external input pin , T2 .When the samples show a

    high in one cycle and a low in the next cycle, the count is incremented . Since

    two machine cycles (24 Oscillator periods ) are required to recognize 1-to-0

    transition , the maximum count rate is 1 / 24 of the oscillator frequency .

    32

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    33/50

    To ensure that a given level is sampled at least once before it changes , the

    level should be held for at least one full machine cycle.

    Capture Mode:

    In the capture mode , two options are selected by bit EXEN2 in T2CON . If

    EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets

    bit TF2 in T2CON . This bit can then be used to generate an interrupt. If EXEN2 =

    1 , Timer 2 performs the same operation , but a 1-to-0 transition at external

    input T2EX also causes the current value in TH2 and TL2 to be captured

    into RCAP2H and RCAP2L , respectively

    Auto-reload (Up or Down Counter):

    Timer 2 can be programmed to count up or down when configured in its 16-bit

    auto-reload mode. This feature is invoked by the DCEN (Down Counter Enable)

    bit located in the SFR T2MOD . Upon reset , the DCEN bit is set to 0 so

    that timer 2 will default to count up. When DCEN is set , Timer 2 can count

    up or down , depending on the value of the T2EX pin . In this mode , two

    options are selected by bit EXEN2 in T2CON . If EXEN2 = 0 , Timer 2

    counts up to 0FFFFH and then sets the TF2 bit upon overflow . If EXEN2 =

    1, a 16-bit reload can be triggered either by an overflow or by a 1-to-0

    transition at external input T2EX.

    Baud Rate Generator:

    Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK

    in T2CON . Note that the baud rates for transmit and receive can be different

    if Timer 2 is used for the receiver or transmitter and Timer 1 is used for the

    other function .The baud rates in Modes 1 and 3 are determined by Timer 2s

    overflow rate according to the following equation .

    Modes 1 and 3 Baud Rates =Timer 2 Overflow Rate

    33

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    34/50

    16

    The timer operation is different for Timer 2 when it is used as a baud rate

    generator .Normally ,as a timer , it increments every machine cycle (at 1/12 the

    oscillator frequency).As a baud rate generator , however, it increments every

    state time ( at 1/2 the oscillator frequency ) .

    Timer 0

    Timer 0 functions as either a timer or event counter in four modes of operation .

    Timer 0 is controlled by the four lower bits of the TMOD register and bits 0, 1,

    4 and 5 of the TCON register. Mode 0 ( 13-bit Timer) Mode 0 configures timer 0

    as a 13-bit timer which is set up as an 8-bit timer (TH0 register) with a

    modulo 32 prescaler implemented with the lower five bits of the TL0 register .

    The upper three bits of TL0 register are indeterminate and should be ignored.

    Prescaler overflow increments the TH0 register. Mode 1 ( 16-bit Timer )Mode 1

    is the same as Mode 0, except that the Timer register is being run with

    all 16 bits .

    Mode 1 configures timer 0 as a 16-bit timer with the TH0 and TL0 registers

    connected in cascade. The selected input increments the TL0 register. Mode 2 (8- bit Timer with Auto-Reload)Mode 2 configures timer 0 as an 8-bit timer ( TL0

    register ) that automatically reloads from the TH0 register . TL0 overflow sets

    TF0 flag in the TCON register and reloads TL0 with the contents of TH0,

    which is preset by software. Mode 3 ( Two 8-bit Timers )Mode 3 configures

    timer 0 so that registers TL0 and TH0 operate as separate 8-bit timers. This

    mode is provided for applications requiring an additional 8-bit timer or counter.

    Timer 1

    Timer 1 is identical to timer 0, except for mode 3, which is a hold-count mode.

    Mode 3 (Halt) Placing Timer 1 in mode 3 causes it to halt and hold its count.

    This can be used to halt Timer 1 when TR1 run control bit is not available

    i.e., when Timer 0 is in mode 3.

    Baud Rates:

    34

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    35/50

    The baud rate in Mode 0 is fixed. The baud rate in Mode 2 depends on

    the value of bit SMOD in Special Function Register PCON. If SMOD = 0

    (which is its value on reset), the baud rate is 1/64 the oscillator frequency. If

    SMOD = 1, the baud rate is 1/32 the oscillator frequency. In the 89S52, the baud

    rates in Modes 1 and 3 are determined by the Timer 1 overflow rate. In case

    of Timer 2 , these baud rates can be determined by Timer 1 , or by Timer 2 ,

    or by both (one for transmit and the other for receive ).

    Fig 12: TCON REGISTER: Timer/counter Control Register

    Fig 13:TMOD REGISTER: Timer/Counter 0 and 1 Modes

    35

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    36/50

    36

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    37/50

    CHAPTER-4

    HARDWARE DESCRIPTION

    The hardware modules of this project are:

    Power supply board

    LED

    Keypad

    Power supply description:

    As the microcontroller operating voltage is +5V DC. Through this power supply

    circuit we have to create a +5V DC which is given to the micro controller. The below

    components are used to create the power supply

    Description:230V AC supply is given to the step down transformer of 12A type. It may be a 230V to

    9V or 12V step down transformer. The output of the step down transformer is given to

    bridge rectifier. The bridge rectifier is formed with 1N4007 diodes. The bridge rectifier

    converts the AC Voltage into DC Voltage. But the output DC Voltage contains some AC

    component (ripples). So we use a capacitors-2200uF/25V, 0.1uF/D and resistor of 10K as

    a filter for removing ripples. That output DC Voltage is given to the positive voltage

    regulator LM7805 (i.e., 78 represents the positive series and 5 represent the output

    voltage it can provide). So the output of the regulator will be the regulated +5V DC. To

    indicate the condition of the circuit we place a LED at the end of the circuit.

    37

    Step down

    transformer

    Bridge

    rectifier

    230V AC

    supply FilterRegulator

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    38/50

    LED

    Introduction:

    A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicatorlamps in many devices, and are increasingly used for lighting. Introduced as a practical

    electronic component in 1962, early LEDs emitted low-intensity red light, but modern

    versions are available across the visible, ultraviolet and infrared wavelengths, with very

    high brightness.

    The LED is based on the semiconductor diode. When a diode is forward

    biased, electrons are able to recombine with holes within the device, releasing energy in

    the form of photons. This effect is called electroluminescence and the color of the light

    (corresponding to the energy of the photon) is determined by the energy gap of the

    semiconductor. An LED is usually small in area (less than 1 mm2), and integrated optical

    components are used to shape its radiation pattern and assist in reflection. LEDs present

    many advantages over incandescent light sources including lower energy consumption,

    longer lifetime, improved robustness, smaller size, faster switching, and greater durability

    and reliability. However, they are relatively expensive and require more

    precise current and heat management than traditional light sources. Current LED products

    for general lighting are more expensive to buy than fluorescent lamp sources of

    comparable output.

    Working: Charge-carrierselectrons and holesflow into the junction

    from electrodes with different voltages. When an electron meets a hole, it falls into a

    38

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    39/50

    lower energy level, and releases

    energy in the form of a photon.

    The wavelength of the light emitted, and

    therefore its color, depends on the band

    gap energy of the materials forming

    the p-n junction. In silicon or

    germanium diodes, the electrons and

    holes recombine by a non-radiative

    transition which produces no optical

    emission, because these are indirect band

    gap materials. The materials used for the

    LED have a direct band gap with

    energies corresponding to near-infrared, visible or near-ultraviolet light.

    Colors and materials :

    Color Wavelength (nm) Voltage (V) Semiconductor Material

    Infrared > 760 V< 1.9Gallium arsenide (GaAs)

    Aluminum gallium arsenide (AlGaAs)

    39

    http://en.wikipedia.org/wiki/Delta_(letter)http://en.wikipedia.org/wiki/Delta_(letter)
  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    40/50

    Red 610

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    41/50

    Violet 400

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    42/50

    Figure: matrix keypad on PCB board.

    CONSTRUCTING A MATRIX

    KEYPAD

    Construction of a keypad is

    really simple. As per the outline shown in the figure below we have four rows and four

    columns. In between each overlapping row and column line there is a key.

    Figure: internal arrangement of the keypad

    So keeping this outline we can construct a keypad using simple SPST Switches as shown

    below:

    42

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    43/50

    Figure: internal key connections

    Now our keypad is ready, all we have to do is connect the rows and columns to a port of

    microcontroller and program the controller to read the input.

    SCANNING A MATRIX KEYPAD

    There are many methods depending on how you connect your keypad with your

    controller, but the basic logic is same. We make the columns as i/p and we drive the rows

    making them o/p, this whole procedure of reading the keyboard is called scanning.

    In order to detect which key is pressed from the matrix, we make row lines low

    one by one and read the columns. Lets say we first make Row1 low, and then read the

    columns. If any of the key in row1 is pressed will make the corresponding column as low

    i.e. if second key is pressed in Row1, then column2 will give low. So we come to know

    that key 2 of Row1 is pressed. This is how scanning is done.

    So to scan the keypad completely, we need to make rows low one by one and

    read the columns. If any of the button is pressed in a row, it will take the corresponding

    43

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    44/50

    column to a low state which tells us that a key is pressed in that row. If button 1 of a row

    is pressed then Column 1 will become low, if button 2 then column2 and so on...

    SCHEMATIC

    Figure: keypad arrangement

    44

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    45/50

    The internal arrangement of the keys in a matrix keypad can be seen in the above

    figure. We can arrange them in the particular columns and particular rows. Interface of

    the key pad to the micro controller is shown the figure below. Depending on the number

    of keys required for the application the matrix form is prepared. So for each key has two

    terminals one for the ground and one is for the port pins. Each key need port allotment.

    Matrix keypad of 4*4 (four rows and four columns) for that one columns

    ground terminals are connected commonly and that is given to the one port pin. Input

    terminal of the keys according to the one row all are connected commonly and that is

    given to the one port pins.

    Like for 4*4 matrix keypad one port of micro controller totally used. Four

    pins for the ground purpose and four pins for the input purpose.

    45

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    46/50

    APPLICATION

    Key pad is used for the telephones, mobile phones

    Key pads are used at the bank locker system.

    There used the companies to enter the id numbers of the particular employee.

    46

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    47/50

    USES

    The keypad of a calculatorcontains the digits 0 through 9, from bottom upwards,

    together with the fourarithmetic operations.

    Keypads are also a feature of some combination locks. This type of lock is often

    used on doors, such as that found at the main entrance to some offices.

    Many laptop computers have special function keys which turn part of the

    alphabetical keyboard into a numerical keypad as there is insufficient space to

    allow a separate keypad to be built into the laptop's chassis. Separate external

    plug-in keypads can be purchased.

    CHAPTER-5

    SCHEMATIC5.1 Schematic Diagram:

    47

    http://en.wikipedia.org/wiki/Calculatorhttp://en.wikipedia.org/wiki/Arithmetichttp://en.wikipedia.org/wiki/Combination_lockhttp://en.wikipedia.org/wiki/Laptophttp://en.wikipedia.org/wiki/Calculatorhttp://en.wikipedia.org/wiki/Arithmetichttp://en.wikipedia.org/wiki/Combination_lockhttp://en.wikipedia.org/wiki/Laptop
  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    48/50

    5.2 SCHEMATIC EXPLANANTION

    The project brain relief flash system is consisting of a micro controller of the 40 pins

    and four ports. In these 40 pins pin9 is used as the reset pin which connected to a resistor

    and the capacitor.pin18, 19 is used for the crystal oscillators. In the four pins port1 is

    connected to the three keys they are p1.0, p1.1, p1.2 pins are used for the three switches

    for activating the colors.port2 is used for the bicolor LEDs as each LED is has three

    terminals in that two terminals are connected to the port pins from (p2.0, p2.1, p2.2, p2.3,

    p2.4, p2.5) which are six pins. And the another one pin of the LED is connected to the

    resistor and then connected to the ground pins.

    CODING

    48

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    49/50

    CONCLUSION

    The project brain relief flash system is used for the reducing the tension and the stress

    of the human brain.

    APPLICATIONS

    They are used at the musical laser shows

    They are also used at the real time shows.

    BIBLIOGRAPHY

    The 8051 Micro controller and Embedded Systems

    Muhammad Ali Mazidi

    Janice Gillispie Mazidi

    The 8051 Micro controller Architecture, Programming & Applications

    Kenneth J. Ayala

    Fundamentals of Micro processors and Micro computers

    B. Ram

    Micro processor Architecture, Programming & Applications

    Ramesh S. Gaonkar

    Electronic Components

    D.V.Prasad

    References on the Web:

    49

  • 8/7/2019 25.BRAIN RELIEF FLASH LIGHT

    50/50

    www.national.com

    www.atmel.com

    www.microsoftsearch.com

    www.geocities.com

    www.google.com

    http://www.national.com/http://www.atmel.com/http://www.microsoftsearch.com/http://www.geocities.com/http://www.google.com/http://www.national.com/http://www.atmel.com/http://www.microsoftsearch.com/http://www.geocities.com/http://www.google.com/