Beruflich Dokumente
Kultur Dokumente
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 Features
3.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
2
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
CHAPTER-1
EMBEDDED SYSTEMS
Introduction
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
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
Embedded
System
Software Hardware
ALP
C Processor
VB Peripherals
Etc., memory
Software deals with the languages like ALP, C, and VB etc., and Hardware deals with
Processors, Peripherals, and Memory.
5
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)
ALU
CU
MEMORY
6
ALU
CU
Memory
EEPROM, ADC,
DAC, Timers,
USART, Oscillators
Etc.,
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.
7
• Communications
• Office systems and mobile equipment
• Banking, finance and commercial
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
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 lie much 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 of
IT 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
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:
9
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.
10
POWER SUPPLY:
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
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
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
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
Open the Keil µ Vision2
Go to Project – Open Project and browse for Hello in Ch03_00 in Pont and open it.
13
Select 8052(all variants) and click OK
14
Make sure that the oscillator frequency is 12MHz.
15
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
The flashing LED we will view will be connected to Port 1. We therefore want to observe
the activity on this port
17
To ensure that the port activity is visible, we need to start the ‘periodic window update’
flag
Go to Debug - Go
18
While the simulation is running, view the performance analyzer to check the delay
durations.
19
Go to Debug – Performance Analyzer and click on it
20
Double click on DELAY_LOOP_Wait in Function Symbols: and click Define button
21
CHAPTER-3
MICROCONTROLLER
Microcontroller
Description of Microcontroller 89S52:
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.
Features:
• Compatible with MCS-51 Products
22
• 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
Architecture of 8052:
24
Fig 9: pin configuration
PIN DESCRIPTION
VCC
Supply voltage.
GND
Ground
Port 0
Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink
eight TTL inputs. When 1sare written to port 0 pins, the pins can be used as high
impedance inputs. Port 0 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
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
26
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
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
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.
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
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.
30
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:
31
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.
32
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
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 .
33
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
34
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 ).
35
36
CHAPTER-4
HARDWARE 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
37
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.
38
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.
39
Aluminum gallium arsenide (AlGaAs)
Gallium arsenide phosphide (GaAsP)
1.63 < ΔV <
Red 610 < λ < 760 Aluminium gallium indium
2.03
phosphide (AlGaInP)
Gallium(III) phosphide (GaP)
Indium gallium
nitride (InGaN) / Gallium(III) nitride (GaN)
1.9[42] < Gallium(III) phosphide (GaP)
Green 500 < λ < 570
ΔV < 4.0 Aluminium gallium indium
phosphide (AlGaInP)
Aluminium gallium phosphide (AlGaP)
40
2.76 < ΔV <
Violet 400 < λ < 450 Indium gallium nitride (InGaN)
4.0
Keypad (matrix)
INTRODUCTION
41
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.
So keeping this outline we can construct a keypad using simple SPST Switches as shown
below:
42
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.
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
43
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
44
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
APPLICATION
• There used the companies to enter the id numbers of the particular employee.
46
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:
47
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
CONCLUSION
The project “brain relief flash system” is used for the reducing the tension and the stress
of the human brain.
APPLICATIONS
BIBLIOGRAPHY
Kenneth J. Ayala
Electronic Components
D.V.Prasad
49
www.national.com
www.atmel.com
www.microsoftsearch.com
www.geocities.com
www.google.com
50