. The project and implimentation “brain relief flash light” is used to design relaxation to the human beings.

Description:

The main purpose of the project and implimentation 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

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

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

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.

CHAPTER-2
OVERVIEW OF PROJECT
Introduction of the project and implimentation:

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.

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.

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:
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 computer’s 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 project and implimentations 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 and implimentation discussed in Chapter 3 is in the directory “/Pont/Ch03_00-Hello”. Rather than using the project and implimentations 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
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’

Select 8052(all variants) and click OK

Now we need to check the oscillator frequency:
Go to project and implimentation – Options for Target ‘Target1’

Make sure that the oscillator frequency is 12MHz.

Building the Target

Build the target as illustrated in the figure below

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

The flashing LED we will view will be connected to Port 1. We therefore want to observe the activity on this port

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

Go to Debug - Go

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

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 Atmel’s 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.

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 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 address byte 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

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,
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 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 8051’s 32 input/output lines. Another SFR allows the user to set the serial baud rate, control and access timers, and configure the 8051’s 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.
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 8051’s 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.
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 isn’t included in the instruction, it is quickly accessible since it is stored in the 8051’s 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 8051’s 32 input/output lines. Another SFR allows the user to set the serial baud rate, control and access timers, and configure the 8051’s 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:
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 .

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 2’s overflow rate according to the following equation .
Modes 1 and 3 Baud Rates =Timer 2 Overflow Rate
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:
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

CHAPTER-4
HARDWARE DESCRIPTION
The hardware modules of this project and implimentation 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.

LED
Introduction:
A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps 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-carriers—electrons and holes—flow into the junction from electrodes with different voltages. When an electron meets a hole, it falls into a 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.

A keypad is a set of buttons arranged in a block or "pad" which usually bear digits and other symbols and usually a complete set of alphabetical letters. If it mostly contains numbers then it can also be called a numeric keypad.
Keypads are found on many alphanumeric keyboards and on other devices such as calculators, push-button telephones, combination locks, and digital door locks, which require mainly numeric input. In keypad we have keys arrays in which keys can be arranged in different combinations and the matrix keypad in which keys are arrange in a particular rows and columns.

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:

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. Let’s 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 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
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.

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.

USES
 The keypad of a calculator contains the digits 0 through 9, from bottom upwards, together with the four arithmetic 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
SCHEMATIC
5.1 Schematic Diagram:

5.2 SCHEMATIC EXPLANANTION
The project and implimentation 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

CONCLUSION
The project and implimentation “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