You are on page 1of 99




Embedded System based gesture recognition control system which provides 100% touch-free
interaction with the device. Intuitive gestures like virtual mouse tracker provides the most
complete touch-free interaction system available in the market. Use simple hand gestures such
as left, right, wave and select, to perform quick actions such change a channel, control volume.
In this project, the hardware system consists of ARM 32 bit microcontroller and OpenCV library
which helps for image/video processing by using various features and classification algorithms. It
overcomes the performance in terms of sensors and hardware cost which is also too high. Now
the camera will capture hand gestures and perform user’s stated actions. This system takes
capture image by means of web camera connected to ARM microcontroller through USB and the
image is processed by using OpenCV library. According to the User’s hand Gestures the TV
Operations should be performed.


As gesture recognition technology has improved, gesture recognition systems have been

gradually applied to electronic appliances in the daily lives. TV is a representative consumer

device to which gesture recognition techniques are being dynamically applied. 3D motion

sensors, which have gradually been applied to TVs, are useful for recognizing various complex

motions for natural human-to-TV interfaces. So far, however, the following obstacles still need to

be solved. 1) It is difficult to achieve competitive price and performance for high-end sensor

units compared to low-end remote controls. 2) Dedicated hardware or motion recognition is

absent. Resource allocation is required to process sensor signals. Assuming that 20% of

resources for hand gestures can be allocated for TV interfaces, 30% for face recognition, and 10%
for voice recognition, then only 40% of all resources are available to process the remaining TV

tasks. This reduces the quality of system performance. Although extra computing resources can

be added, the price must rise. 3) Lastly, the user interface provides low usability. Although such

interfaces can provide momentary entertainment and interest, users are often unwilling to

always adopt this unfamiliar method. 3D motion sensors, which have gradually been applied to

TVs, are useful for recognizing various complex motions for natural human-to-TV interfaces. So

far, however, the following obstacles still need to be solved. 1) It is difficult to achieve

competitive price and performance for high-end sensor units compared to low-end remote

controls. 2) Dedicated hardware or motion recognition is absent. Resource allocation is required

to process sensor signals. Assuming that 20% of resources for hand gestures can be allocated for

TV interfaces, 30% for face recognition, and 10% for voice recognition, then only 40% of all

resources are available to process the remaining TV tasks. This reduces the quality of system

performance. Although extra computing resources can be added, the price must rise. 3) Lastly,

the user interface provides low usability. Although such interfaces can provide momentary

entertainment and interest, users are often unwilling to always adopt this unfamiliar method.

Gesture recognition is a topic in computer science and language technology with the goal of

interpreting human gestures via mathematical algorithms. Gestures can originate from any

bodily motion or state but commonly originate from the face or hand. Current focuses in the

field include emotion recognition from the face and hand gesture recognition. Many approaches

have been made using cameras and computer vision algorithms to interpret sign language.

However, the identification and recognition of posture, gait, proxemics, and human behaviors is

also the subject of gesture recognition techniques. Gesture recognition can be seen as a way for

computers to begin to understand human body language, thus building a richer bridge between

machines and humans than primitive text user interfaces or even GUIs (graphical user
interfaces), which still limit the majority of input to keyboard and mouse. Gesture recognition

enables humans to communicate with the machine (HMI) and interact naturally without any

mechanical devices. Using the concept of gesture recognition, it is possible to point a finger at

the computer screen so that the cursor will move accordingly. This could potentially make

conventional input devices such as mouse, keyboards and even touch-screens redundant.

Gesture recognition can be conducted with techniques from computer vision and image



In existing system new principles or the adaptation of existing ones are required for

gestural interfaces,especially those without a GUI.Most computer-based assistive

technology products have been developed for relatively small groups of users, and have

consequently been rather expensive and spe-cialized for specific user groups.Input

methods such as voice recognition and remote control using a smartphone have been

attempted with a use of voice guidance of operation and menu are used in existing

system.The users were negative at pointer-type gestures and showed their concerns about

large motions of linear gestures and difficult matching of circular gestures.


 Creation of the classifier took the longest time of all tested algorithms

 Cost is high.
 Less interface with user.

 Only less gestures are used.


In this system, user hand gestures are recognized by capturing the motion path when the user
draws different symbols in the air. These gestures are used to interact with the TV. It is
implemented using a single camera dedicated hardware system. The camera can detect hand
gestures. This system captures the gestures from web-cam which is connected to micro
controller through USB host and the image is processed by means of image processing
technique. Here we are using Open CV library to detect a frontal hand as an image using its Haar
Cascade hand Detector, this will increase the human computer interaction. If any gesture is
recognized by the camera, a rectangular box will appear on monitor. The identified gestures are
sends to Raspberry PI board and we can perform TV related functions. In this way we are
implementing single camera dedicated television control system using gesture drawing.


 Easy to use.

 User interface high.

 Effective for visually impaired people.


 Gesture control TV System

 The concept of gesture recognition has many applications include automated homes,
operating visual devices like television solely with gestures and also medical applications
Meanwhile, this project deals with opening of various applications like Microsoft office
,windows media player, internet explorer etc.

 Sign language recognition. Just as speech recognition can transcribe speech to text, certain
types of gesture recognition software can transcribe the symbols represented through sign
language into text.




LEVEL Micro controller

DB9 ULN 2003


RC 5




Gesture detection ARM LPC 2148

The system begins by analyzing the captured video frame from the Raspbian camera. Normally
the video has to be cut in different images to identify the hand gestures using different color
markers. The image obtained is often in the BGR format and it has to be first converted into HSV
color space.

Capture the input:

The first step is to capture the live video stream from the Camera. In reference, this camera has
no infrared filter thus making it perfect to capture images which even during low light
conditions. The color markers are identified and the video is converted into picture frames for
gesture recognition.

Image acquisition:

The next step is to create windows for different color markers which are detected. Resize the
frames in order to reduce the resolution which will in turn reduce the computation time. In
references noise reduction is done by using the antialiasing filters.

Color space conversion:

A proper color model is needed to perform classification. The captured image which is in the
BGR color space is converted to HSV (Hue Saturation Value). HSV color space is the most suitable
one for color based image segmentation. Hue value represents the shades of the color, S
describes how pure the hue color is and V provides the intensity of the color. Different HSV
values for different colors are provided to represent the gray image of that particular color. The
gesture recognition system is processed dynamically for computation and to reduce the
complexity color markers are used for detection instead of skin tone detection which is used in

TITLE: Hand Gesture Recognition and Speech Conversion for Deaf and Dumb using
Feature Extraction

BY: Aswathy M , Heera Narayanan, Surya Rajan, Uthara P M, Jeena Jacob

YEAR: 2014

The main objective of the system is to make the communication between a normal person
and a dumb person easy. An emerging technology of image processing is used for that.
The system is designed with a minimized cost and higher accuracy. The dumb aid phone
has a camera for capturing the hand gestures shown by a dumb person. The orientations
of the fingers of the hand are identified by extracting the outline of the hand in the
captured image. This outline is then compared with outline of the hand gestures that are
stored in the database of the device. When match is found the sound file or voice note
corresponding to the gesture, in the database is send to the normal person on the other
side of the communication line. The sound file send from the database convey the
meaning of the gesture. The matrices of the gesture captured (the gestures captured are
converted into matrix format) are compared with matrices in the database by SIFT
algorithm. The image processing consists of mainly two steps, training and testing. The
training step deals with database creation. The image of the gesture captured is pre-
processed by changing the brightness, contrast, sharpness etc. After that the feature is
extracted from the image. Here the feature extracted is outline of the hand in the image.
The image in the matrix format is loaded to the database. Likewise all the gestures are
loaded to the database. Testing step also has the steps like image acquisition, pre-
processing, feature extraction. After the feature is extracted, the matrix obtained is
compared with that in the database using SIFT algorithm. The technology used here is
much more complicated than the existing, but it can ensure more accuracy than the

TITLE: Gesture Control for TV Using ARM based Mobile Platform

BY: A.S. Gundale and Pallavi G. Potadar

YEAR: 2012
Obviously currently these technologies are expensive. In this work we are developing a system in
which the Television is controlled using hand gestures. For gesture recognition we will be
incorporating OpenCV Libraries. OpenCV is Open Source Computer Vision Library that includes
image processing functions. All the processing will be done using ARM based platform like
PandaBoard which is an OMAP4430 platform designed to provide access to as many of the
powerful features of the OMAP4430 Multimedia Processor as possible, while maintaining a low



YEAR: 2015

As we tend to all grasp that communication plays a really outstanding role in our human
lives. At this gift innovative world, there square measure most of individuals World
Health Organization (WHO) square measure deaf and dumb ought to have a tiny low
dream on communicate as traditional people with others is not a straight forward task. An
electronic glove is developed for deaf-mute communication interpreter system that helps
out the deaf and dumb individuals to speak with dependability. Here only 1 hand is
employed .There is four flex detectors are employed and every square measure fitted with
length of every finger of glove. The hand gesture plays a key role. The gestures are
decoded by microcontroller. By the every specific gesture (i.e. creating completely
different positions of fingers) of the flex sensors, the Indian linguistic communication
alphabets/letters square measure to be created off. The concatenation of letters to create
words is finished in Controller. Message is shown in alphanumeric display and voice
output is produced from speaker.

TITLE Real-Time Hand Gesture Recognition Using Finger Segmentation


YEAR: 2014

Hand gesture recognition is very significant for human-computer

interaction. In this work, we present a novel real-time method for
hand gesture recognition. In our framework, the hand region is
extracted from the background with the background subtraction
method. Then, the palm and fingers are segmented so as to
detect and recognize the fingers. Finally, a rule classifier is
applied to predict the labels of hand gestures. The experiments
on the data set of 1300 images show that our method performs
well and is highly efficient. Moreover, our method shows better
performance than a state-of-art method on another data set of
hand gestures.



BY: Dejan Chandra Gope

YEAR: 2012

Hand tracking and hand gesture recognition is an important problem in the field of human-
computer interaction. A number of solutions have been proposed in the current literature, but
the problem is still far from being solved since the hand exhibits significant amounts of
articulation and self-occlusion that cause difficulties with existing algorithms. To further
exasperate these problems, interactive applications require that the hand tracking perform in
real-time. The current ubiquity of webcams offers an opportunity to create computer vision
systems which can enable novel new methods for human-computer interaction. To that end, we
present a system which allows the user to control the operating system cursor in a hands-free
way by gesturing in mid-air. Our system leverages OpenCV and the X windowing system to track
the index finger and thumb of a user using a webcam. The user can motion in the direction
she/he wishes the cursor to move, and can execute mouse operations by “pointing” toward the
camera and breaking a “plane of interaction”. Our goal with this work is to demonstrate a proof-
of-concept system for enabling a new method of controlling and interfacing with a computer
using commodity webcams.

AT89s52 Microcontroller:

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

microcontroller with 8K bytes of in-system programmable Flash memory.
The device is manufactured using Atmel’s high-density nonvolatile
memory technology and is compatible with the Indus-try-standard 80C51
instruction set and pin out.


 Compatible with MCS®-51 Products.

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

 256 x 8-bit Internal RAM.

 32 Programmable I/O Lines.

 Three 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.

 Fast Programming Time.

 Flexible ISP Programming (Byte and Page Mode).

 Green (Pb/Halide-free) Packaging Option.


The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller

with 8K bytes of in-system programmable Flash memory.

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

memory technology and is compatible with the Indus-try-standard 80C51
instruction set and pin out.

The on-chip Flash allows the program memory to be reprogrammed in-

system or by a conventional nonvolatile memory pro-grammars. By
combining a versatile 8-bit CPU with in-system programmable Flash on a
monolithic chip, the Atmel AT89S52 is a powerful microcontroller which
provides a highly-flexible and cost-effective solution to many 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, a six-vector two-level interrupt architecture, a 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 con-tents but freezes the
oscillator, disabling all other chip functions until the next interrupt or
hardware reset.

Pin configuration:
Block diagram:
Pin Description:


Supply voltage.



Port 0:

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each
pin can sink eight TTL inputs. When 1s are 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 bidirectional 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 inter-nal pull-ups and can be used as
As inputs, Port 1 pins that are externally being pulled low will source
current (IIL) because of the internal pull-ups. 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 bidirectional 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

As inputs, Port 2 pins that are externally being pulled low will source
current (IIL) because of the internal pull-ups. Port 2 emits the high-order
address byte during fetches from external program memory and during
accesses to external data memory that uses 16-bit addresses (MOVX @
In this application, Port 2 uses strong internal pull-ups when emitting 1s.
During accesses to external data memory that uses 8-bit addresses
(MOVX @ RI), Port 2 emits the contents of the P2 Special Function

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

Port Pin Alternate Functions P1.0 T2 (external count input to

Timer/Counter 2), clock-out P1.1 T2EX (Timer/Counter 2 capture/reload
trigger and direction control) P1.5 MOSI (used for In-System
Programming) P1.6 MISO (used for In-System Programming) P1.7 SCK
(used for In-System Programming)

Port 3

Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3
output buffers can sink/source four TTL inputs. When 1s are written to Port
3 pins, they are pulled high by the internal pull-ups and can be used as

As inputs, Port 3 pins that are externally being pulled low will source
current (IIL) because of the pull-ups. Port 3 receives some control signals
for Flash programming and verification. Port 3 also serves the functions of
various special features of the AT89S52, as shown in the following table.

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

This pin drives high for 98 oscillator periods after the Watchdog times out.
The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this
feature. In the default state of bit DISRTO, the RESET HIGH out feature is


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 of 1/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

Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has
no effect if the microcontroller is in external execution mode.


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


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.


External Access Enable. EA must be strapped to GND in order to enable

the device to fetch code from external program memory locations starting
at 0000H up to FFFFH.

Note, however, that if lock bit 1 is programmed, EA will be internally

latched on reset. EA should be strapped to VCC for internal program
executions. This pin also receives the 12-volt programming enable voltage
(VPP) during Flash programming.

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


Output from the inverting oscillator amplifier.

Memory Organization:

MCS-51 devices have a separate address space for Program and Data
Memory. Up to 64K bytes each of external Program and Data Memory can
be addressed.

Program Memory:

If the EA pin is connected to GND, all program fetches are directed to

external memory. On the AT89S52, if EA is connected to VCC, program
fetches to addresses 0000H through 1FFFH are directed to internal
memory and fetches to addresses 2000H through FFFFH are to external

Data Memory:

The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes
occupy a parallel address space to the Special Function Registers.

This means that the upper 128 bytes have the same addresses as the
SFR space but are physically separate from SFR space.

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

address mode used in the instruction specifies whether the CPU accesses
the upper 128 bytes of RAM or the SFR space. Instructions which use
direct addressing access the SFR space.
For example, the following direct addressing instruction accesses the SFR
at location 0A0H (which is P2). MOV 0A0H, #data Instructions that use
indirect addressing access the upper 128 bytes of RAM.

For example, the following indirect addressing instruction, where R0

contains 0A0H, accesses the data byte at address 0A0H, rather than P2
(whose address is 0A0H).

MOV @R0, #data Note that stack operations are examples of indirect
addressing, so the upper 128 bytes of data RAM are available as stack

Watchdog Timer:

The WDT is intended as a recovery method in situations where the CPU

may be subjected to software upsets. The WDT consists of a 14-bit
counter and the Watchdog Timer Reset (WDTRST) SFR. The WDT is
defaulted to disable from exiting reset.

To enable the WDT, a user must write 01EH and 0E1H in sequence to the
WDTRST register (SFR location 0A6H).

When the WDT is enabled, it will increment every machine cycle while the
oscillator is running. The WDT timeout period is dependent on the external
clock frequency.

There is no way to disable the WDT except through reset (either hardware
reset or WDT overflow reset). When WDT over-flows, it will drive an output
RESET HIGH pulse at the RST pin.

Using the WDT:

To enable the WDT, a user must write 01EH and 0E1H in sequence to the
WDTRST register (SFR location 0A6H).

When the WDT is enabled, the user needs to service it by writing 01EH
and 0E1H to WDTRST to avoid a WDT overflow. The 14-bit counter overflows
when it reaches 16383 (3FFFH), and this will reset the device.

When the WDT is enabled, it will increment every machine cycle while the
oscillator is running. This means the user must reset the WDT at least every
16383 machine cycles.

To reset the WDT the user must write 01EH and 0E1H to WDTRST.
WDTRST is a write-only register. The WDT counter cannot be read or

When WDT overflows, it will generate an output RESET pulse at the RST
pin. The RESET pulse duration is 98xTOSC, where TOSC = 1/FOSC.

To make the best use of the WDT, it should be serviced in those sections
of code that will periodically be executed within the time required to
prevent a WDT reset.

WDT during Power-down and Idle:

In Power-down mode the oscillator stops, which means the WDT also
stops. While in Power-down mode, the user does not need to service the

There are two methods of exiting Power-down mode: by a hardware reset

or via a level-activated external interrupt which is enabled prior to entering
Power-down mode.
When Power-down is exited with hardware reset, servicing the WDT should
occur as it normally does whenever the AT89S52 is reset. Exiting Power-
down with an interrupt is significantly different. The interrupt is held low
long enough for the oscillator to stabilize.

When the interrupt is brought high, the interrupt is serviced. To prevent the
WDT from resetting the device while the interrupt pin is held low, the WDT
is not started until the interrupt is pulled high. It is suggested that the WDT
be reset during the interrupt service for the interrupt used to exit Power-
down mode.

To ensure that the WDT does not overflow within a few states of exiting
Power-down, it is best to reset the WDT just before entering Power-down
mode. Before going into the IDLE mode, the WDIDLE bit in SFR AUXR is
used to determine whether the WDT continues to count if enabled.

The WDT keeps counting during IDLE (WDIDLE bit = 0) as the default
state. To prevent the WDT from resetting the AT89S52 while in IDLE
mode, the user should always set up a timer that will periodically exit
IDLE, service the WDT, and reenter IDLE mode.

With WDIDLE bit enabled, the WDT will stop to count in IDLE mode and
resumes the count upon exit from IDLE.

Uses of microcontroller:

Like all good things, this powerful component is basically very simple. It is
made by mixing tested and high- quality "ingredients" (components) as per
following receipt:

The simplest computer processor is used as the "brain" of the future system.

Depending on the taste of the manufacturer, a bit of memory, a few A/D

converters, timers, input/output lines etc. are added.
All that is placed in some of the standard packages.

Simple software able to control it all and which everyone can easily learn about
has been developed.

On the basis of these rules, numerous types of microcontrollers were designed

and they quickly became man's invisible companion.

Their incredible simplicity and flexibility conquered us a long time ago and if you
try to invent something about them, you should know that you are probably
late, someone before you has either done it or at least has tried to do it.

The following things have had a crucial influence on development and success of
the microcontrollers:

Powerful and carefully chosen electronics embedded in the microcontrollers can

independently or via input/output devices (switches, push buttons,
sensors, LCD displays, relays etc.), control various processes and devices
such as industrial automation, electric current, temperature, engine
performance etc.

Very low prices enable them to be embedded in such devices in which, until
recent time it was not worthwhile to embed anything. Thanks to that, the
world is overwhelmed today with cheap automatic devices and various
“smart” appliances.

Prior knowledge is hardly needed for programming. It is sufficient to have a PC

(software in use is not demanding at all and is easy to learn) and a simple
device (called the programmer) used for “loading” ready-to-use programs
into the microcontroller.

So, if you are infected with a virus called electronics, there is nothing left for you
to do but to learn how to use and control its power.

Working of microcontroller:
Even though there is a large number of different types of microcontrollers
and even more programs created for their use only, all of them have many
things in common.

Thus, if you learn to handle one of them you will be able to handle them all.
A typical scenario on the basis of which it all functions is as follows:

Power supply is turned off and everything is still…the program is loaded

into the microcontroller, nothing indicates what is about to come…

Power supply is turned on and everything starts to happen at high speed!

The control logic unit keeps everything under control.

It disables all other circuits except quartz crystal to operate. While the
preparations are in progress, the first milliseconds go by.

Power supply voltage reaches its maximum and oscillator frequency

becomes stable. SFRs are being filled with bits reflecting the state of all
circuits within the microcontroller.

All pins are configured as inputs. The overall electronis starts operation in
rhythm with pulse sequence. From now on the time is measured in micro
and nanoseconds.

Program Counter is set to zero. Instruction from that address is sent to

instruction decoder which recognizes it, after which it is executed with
immediate effect.

The value of the Program Counter is incremented by 1 and the whole

process is repeated...several million times per second.
Inside a microcontroller:

As you can see, all the operations within the microcontroller are performed
at high speed and quite simply, but the microcontroller itself would not be
so useful if there are not special circuits which make it complete. In
continuation, we are going to call your attention to them.

Read Only Memory (ROM):

Read Only Memory (ROM) is a type of memory used to permanently save
the program being executed. The size of the program that can be written
depends on the size of this memory.

ROM can be built in the microcontroller or added as an external chip,

which depends on the type of the microcontroller. Both options have some

If ROM is added as an external chip, the microcontroller is cheaper and

the program can be considerably longer. At the same time, a number of
available pins is reduced as the microcontroller uses its own input/output
ports for connection to the chip.

The internal ROM is usually smaller and more expensive, but leaves more
pins available for connecting to peripheral environment. The size of ROM
ranges from 512B to 64KB.

Random Access Memory (RAM):

Random Access Memory (RAM) is a type of memory used for temporary

storing data and intermediate results created and used during the
operation of the microcontrollers.

The content of this memory is cleared once the power supply is off. For
example, if the program performes an addition, it is necessary to have a
register standing for what in everyday life is called the “sum”.

For that purpose, one of the registers in RAM is called the "sum" and used
for storing results of addition. The size of RAM goes up to a few KBs.

Electrically Erasable Programmable ROM (EEPROM).

The EEPROM is a special type of memory not contained in all

Its contents may be changed during program execution (similar to RAM ),

but remains permanently saved even after the loss of power (similar to

It is often used to store values, created and used during operation (such
as calibration values, codes, values to count up to etc.), which must be
saved after turning the power supply off.

A disadvantage of this memory is that the process of programming is

relatively slow. It is measured in miliseconds.
Special Function Registers (SFR):

Special function registers are part of RAM memory. Their purpose is

predefined by the manufacturer and cannot be changed therefore. Since
their bits are physically connected to particular circuits within the
microcontroller, such as A/D converter, serial communication module etc.,
any change of their state directly affects the operation of the
microcontroller or some of the circuits.

For example, writing zero or one to the SFR controlling an input/output

port causes the appropriate port pin to be configured as input or output. In
other words, each bit of this register controls the function of one single pin.

Program Counter:

Program Counter is an engine running the program and points to the

memory address containing the next instruction to execute. After each
instruction execution, the value of the counter is incremented by 1. For this
reason, the program executes only one instruction at a time just as it is

However…the value of the program counter can be changed at any

moment, which causes a “jump” to a new memory location. This is how
subroutines and branch instructions are executed.

After jumping, the counter resumes even and monotonous automatic

counting +1, +1, +1…

Central Processor Unit (CPU):

As its name suggests, this is a unit which monitors and controls all
processes within the microcontroller and the user cannot affect its work.

It consists of several smaller subunits, of which the most important are:

Instruction decoder is a part of the electronics which recognizes program
instructions and runs other circuits on the basis of that. The abilities of this
circuit are expressed in the "instruction set" which is different for each
microcontroller family.

Arithmetical Logical Unit (ALU) performs all mathematical and logical

operations upon data.

Accumulator is an SFR closely related to the operation of ALU. It is a kind

of working desk used for storing all data upon which some operations
should be executed (addition, shift etc.).

It also stores the results ready for use in further processing. One of the
SFRs, called the Status Register, is closely related to the accumulator,
showing at any given time the "status" of a number stored in the
accumulator (the number is greater or less than zero etc.). A bit is just a
word invented to confuse novices at electronics. Joking aside, this word in
practice indicates whether the voltage is present on a conductor or not. If it
is present, the approprite pin is set to logic one (1), i.e. the bit’s value is 1.

Otherwise, if the voltage is 0 V, the appropriate pin is cleared (0), i.e. the
bit’s value is 0. It is more complicated in theory where a bit is referred to
as a binary digit, but even in this case, its value can be either 0 or 1.

Input/output ports (I/O Ports):

In order to make the microcontroller useful, it is necessary to connect it to

peripheral devices.
Each microcontroller has one or more registers (called a port) connected
to the microcontroller pins.

Why do we call them input/output ports? Because it is possible to change

a pin function according to the user's needs. These registers are the only
registers in the microcontroller the state of which can be checked by


Even pulses generated by the oscillator enable harmonic and synchronous

operation of all circuits within the microcontroller. It is usually configured as
to use quartz-crystal or ceramics resonator for frequency stabilization.
It can also operate without elements for frequency stabilization (like RC
oscillator). It is important to say that program instructions are not executed
at the rate imposed by the oscillator itself, but several times slower.

It happens because each instruction is executed in several steps. For

some microcontrollers, the same number of cycles is needed to execute
any instruction, while it's different for other microcontrollers.

Accordingly, if the system uses quartz crystal with a frequency of 20MHz,

the execution time of an instruction is not expected 50nS, but 200, 400 or
even 800 nS, depending on the type of the microcontroller.


Most programs use these miniature electronic "stopwatches" in their

operation. These are commonly 8- or 16-bit SFRs the contents of which is
automatically incremented by each coming pulse. Once the register is
completely loaded, an interrupt is generated!

If these registers use an internal quartz oscillator as a clock source, then it

is possible to measure the time between two events (if the register value is
T1 at the moment measurement has started, and T2 at the moment it has
finished, then the elapsed time is equal to the result of subtraction T2-T1 ).

If the registers use pulses coming from external source, then such a timer
is turned into a counter.

This is only a simple explanation of the operation itself. It’s somehow more
complicated in practice.
A register or a memory cell is an electronic circuit which can memorize
the state of one byte. Besides 8 bits available to the user, each register
has also a number of addressing bits. It is important to remember that:

All registers of ROM as well as those of RAM referred to as general-

purpose registers are mutually equal and nameless. During programming,
each of them can be assigned a name, which makes the whole operation
much easier.

All SFRs are assigned names which are different for different types of the
microcontrollers and each of them has a special function as their name
Power Supply Circuit:

There are two things worth attention concerning the microcontroller power
supply circuit:

Brown out is a potentially dangerous state which occurs at the moment the
microcontroller is being turned off or when power supply voltage drops to
the lowest level due to electric noise.

As the microcontroller consists of several circuits which have different

operating voltage levels, this can cause its out of control performance. In
order to prevent it, the microcontroller usually has a circuit for brown out
reset built-in.

This circuit immediately resets the whole electronics when the voltage
level drops below the lower limit.

Reset pin is usually referred to as Master Clear Reset (MCLR) and serves
for external reset of the microcontroller by applying logic zero (0) or one
(1) depending on the type of the microcontroller. In case the brown out is
not built in the microcontroller, a simple external circuit for brown out reset
can be connected to this pin.
Serial communication:

Parallel connections between the microcontroller and peripherals

established over I/O ports are the ideal solution for shorter distances up to
several meters.

However, in other cases, when it is necessary to establish communication

between two devices on longer distances it is obviously not possible to
use parallel connections.

Then, serial communication is the best solution.

Today, most microcontrollers have several different systems for serial

communication built in as a standard equipment. Which of them will be
used depends on many factors of which the most important are:

How many devices the microcontroller has to exchange data with?

How fast the data exchange has to be?

What is the distance between devices?

Is it necessary to send and receive data simultaneously?

One of the most important things concerning serial communication is the
Protocol which should be strictly observed. It is a set of rules which must
be applied in order that devices can correctly interpret data they mutually

Fortunately, the microcontrollers automatically take care of this, so the

work of the programmer/user is reduced to a simple write (data to be sent)
and read (received data).
A byte consists of 8 bits grouped together. If a bit is a digit then it is
logical that bytes are numbers. All mathematical operations can be
performed upon them, just like upon common decimal numbers, which is
carried out in the ALU.

It is important to remember that byte digits are not of equal significance.

The largest value has the leftmost bit called the most significant bit (MSB).
The rightmost bit has the least value and is therefore called the least
significant bit (LSB).

Since 8 digits (zeros and ones) of one byte can be combined in 256
different ways, the largest decimal number which can be represented by
one byte is 255 (one combination represents zero).


Unlike other integrated circuits which only need to be connected to other

components and turn the power supply on, the microcontrollers need to be
programmed first. This is a so called "bitter pill" and the main reason why
hardware-oriented electronics engineers stay away from microcontrollers.
It is a trap causing huge losses because the process of programming the
microcontroller is basically very simple.
In order to write a program for the microcontroller, several "low-level"
programming languages can be used such as Assembly, C and Basic (and
their versions as well). Writing program procedure consists of simple
writing instructions in the order in which they should be executed.

There are also many programs running in Windows environment used to

facilitate the work providing additional visual tools.

This book describes the use of Assembly because it is the simplest

language with the fastest execution allowing entire control on what is
going on in the circuit.
Interrupt - electronics is usually more faster than physical processes it
should keep under control. This is why the microcontroller spends most of
its time waiting for something to happen or execute. In other words, when
some event takes place, the microcontroller does something.

In order to prevent the microcontroller from spending most of its time

endlessly checking for logic state on input pins and registers, an interrupt
is generated. It is the signal which informs the central processor that
something attention worthy has happened.

As its name suggests, it interrupts regular program execution. It can be

generated by different sources so when it occurs, the microcontroller
immediately stops operation and checks for the cause.

If it is needed to perform some operations, a current state of the program

counter is pushed onto the Stack and the appropriate program is
executed. It's the so called interrupt routine.
Stack is a part of RAM used for storing the current state of the program
counter (address) when an interrupt occurs. In this way, after a subroutine
or an interrupt execution, the microcontroller knows from where to
continue regular program execution.
This address is cleared after returning to the program because there is no
need to save it any longer, and one location of the stack is automatically
availale for further use. In addition, the stack can consist of several levels.
This enables subroutines’ nesting, i.e. calling one subroutine from another.


Automotive electronics are a demanding application, encompassing a wide range of

products, from body electronics, engine components, and access systems to lighting and
entertainment components.

They must support small designs and offer a high level of integration, to fit the
limited space available in automotive environments. To meet the diverse needs of a
variety of automotive applications, developers need solutions that offer:

 Compliance with strict automotive qualification demands, including industry standards

and automotive-qualified fabs.
 Flexible interface options for a variety of HMI capabilities.
 Standards-based connectivity for intelligent networked solutions.
 Protection and compatibility for high-voltage products, including robust electromagnetic
compatibility (EMC); electrostatic discharge (ESD) protection; and OEM approvals.
 Resistance to high temperatures for trouble-free operation in automotive environments.
 Maximum safety for automobile access.
 Low power consumption for maximum efficiency.

Building Automation:

Today's intelligent home and building automation solutions offer new levels of
comfort, security, and efficiency. To develop the sophisticated solutions that meet the
needs that consumers demand, designers need standards-based, flexible technology that
can provide:
 Innovative touch control to enable a variety of home devices, including remote controls,
control panels, or thermostats.
 Power efficiency to meet the needs of today's green applications.
 Compatibility with standards-based technology to bring innovative solutions to market,
 Support for wireless networking to enable home connectivity.
 Robust security through hardware authentication and secure communication, which is
essential for highly networked devices.

Home Appliances:
More than ever, consumers have high expectations for home appliances. They
demand sophisticated, feature-rich products that are reliable and easy to use. To meet
these needs, developers of white goods need technology that provides:

 Advanced motor control features for safe, quiet operation.

 Green, power-efficient technology, as well as energy measurement and control through
connectivity with smart metering networks.
 Advanced human machine interface (HMI) support through touchscreen technology for
a rich, easy user experience.
 Flexible, compatible connectivity to integrate devices with the outside world.
 Standards-based certification to enable reliable, high-quality solutions.

Home Entertainment:
Home entertainment systems continue to evolve in size and sophistication, delivering
new levels of experiences and adventure to consumers.
Home Entertainment has expanded to become a veritable indoor electronic
playground for children and adults alike, with systems incorporating large-screen
displays, gaming consoles, audio equipment, and docking stations.
And often this entertainment empire is completely controlled and managed through a
single remote control. Atmel solutions for home entertainment help you address your
most pressing design challenges, including:

 Delivering innovative capabilities that entice consumers to upgrade and expand.

 Responding to consumer demand for energy-saving solutions.
 Integrating wireless and touchscreen technologies.
 Connecting and protecting more home entertainment products.
 Robust RF interference protection.

Industrial Automation:
As industrial environments become more advanced and connected, automation
technology is developing at a rapid pace. To deliver the communication features and
intelligence required at the plant floor and beyond, developers need solutions that can

 High performance together with power efficiency.

 Rugged environmental design to resist water, dust, moisture, and extreme temperatures.
 Advanced, yet cost effective Human Machine Interface (HMI) features.
 Support for high-speed wired and wireless communication.
 Dedicated features for functional safety implementation.

Fluorescent and LED lights use 50 to 80 percent less energy than their incandescent
counterparts. No wonder U.S. and European governments are pushing vendors for
lighting solutions that rely on high frequency electronic ballasts. Successful ballast design
depends on a few key tradeoffs:

 Balancing ease of use against design complexity and cost.

 Balancing voltage and current control against design complexity and board space.
 Balancing functionality against low power consumption.

The market for energy, water, and gas metering systems is rapidly changing, driven
by new environmental and conservation concerns and regulations. Traditional standalone
meters are now being replaced by complex networked systems that utilize a variety of
communication methods. To meet the needs of this evolving Smart Grid, metering
developers need solutions that can provide:

 Intelligent support for application and communication stacks.

 Robust security functionality.
 Remote upgrades in the field.
 Support for communications protocols for home connectivity.

Mobile Electronics:
Today's mobile products are changing the way people consume information,
socialize, conduct business, and purchase products. Major technology revolutions have
completely changed the landscape for mobile devices.
To meet the needs of increasingly mobile customers, designers require solutions that

 Efficient power management to support portable devices on the move.

 Fast response time for nimble operation.
 Highly integrated design for small footprint and minimal BOM.
 Support for intuitive touchscreen interfaces.
 Secure hardware authentication of accessoryes.

PC Peripherals:
Today's personal computers do so much more than compute. With the right
peripheral, computers can entertain, educate, connect, monitor, and secure. Successful PC
peripheral design depends on some key tradeoffs:
 Balancing high performance against design complexity and board space.
 Balancing ease of use against design complexity and cost.
 Balancing high functionality against low-power consumption.


A universal asynchronous receiver/transmitter is a type of "asynchronous

receiver/transmitter", a piece of computer hardware that translates data between parallel
and serial forms. UARTs are commonly used in conjunction with other communication
standards such as EIA RS-232.

A UART is usually an individual (or part of an) integrated circuit used for serial
communications over a computer or peripheral device serial port. UARTs are now
commonly included in microcontrollers. A dual UART or DUART combines two UARTs
into a single chip. Many modern ICs now come with a UART that can also communicate
synchronously; these devices are called USARTs.

The Universal Asynchronous Receiver/Transmitter (UART) controller is the key

component of the serial communications subsystem of a computer. The UART takes
bytes of data and transmits the individual bits in a sequential fashion. At the destination, a
second UART re-assembles the bits into complete bytes. Serial transmission of digital
information (bits) through a single wire or other medium is much more cost effective than
parallel transmission through multiple wires. A UART is used to convert the transmitted
information between its sequential and parallel form at each end of the link. Each UART
contains a shift register which is the fundamental method of conversion between serial
and parallel forms.


The MAX232 is an integrated circuit that converts signals from an RS-232 serial port
to signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual
driver/receiver and typically converts the RX, TX, CTS and RTS signals.

The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single + 5 V
supply via on-chip charge pumps and external capacitors. This makes it useful for
implementing RS-232 in devices that otherwise do not need any voltages outside the 0 V
to + 5 V range, as power supply design does not need to be made more complicated just
for driving the RS-232 in this case.

The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to standard 5 V
TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of
0.5 V.

The later MAX232A is backwards compatible with the original MAX232 but may
operate at higher baud rates and can use smaller external capacitors – 0.1 μF in place of
the 1.0 μF capacitors used with the original device.

Pin Diagram:

Relays and contactors use a low level control signal to switch a much higher voltage or current
supply using a numer of different contact arrangements.

Thus far we have seen a selection of Input devices that can be used to detect or “sense” a
variety of physical variables and signals and are therefore called Sensors. But there are
also a variety of electrical and electronic devices which are classed as Output devices
used to control or operate some external physical process. These output devices are
commonly called Actuators.

Actuators convert an electrical signal into a corresponding physical quantity such as

movement, force, sound etc. An actuator is also classed as a transducer because it changes
one type of physical quantity into another and is usually activated or operated by a low
voltage command signal. Actuators can be classed as either binary or continuous devices
based upon the number of stable states their output has.
For example, a relay is a binary actuator as it has two stable states, either energised and
latched or de-energised and unlatched, while a motor is a continuous actuator because it
can rotate through a full 360o motion. The most common types of actuators or output
devices are Electrical Relays, Lights, Motors and Loudspeakers.

We saw previously that solenoids can be used to electrically open latches, doors, open or
close valves, and in a variety of robotic and mechatronic applications, etc. However, if
the solenoid plunger is used to operate one or more sets of electrical contacts, we have a
device called a relay that is so useful it can be used in an infinite number of different
ways and in this tutorial we will look at Electrical Relays.

Electrical Relays can also be divided into mechanical action relays called
“Electromechanical Relays” and those which use semiconductor transistors, thyristors,
triacs, etc, as their switching device called “Solid State Relays” or SSR’s.

Electrical Relays however, are basically electrically operated switches that come in
many shapes, sizes and power ratings suitable for all types of applications. Relays can
also have single or multiple contacts within a single package with the larger power relays
used for mains voltage or high current switching applications being called “Contactors”.

electrical relays we are just concerned with the fundamental operating principles of
“light duty” electromechanical relays we can use in motor control or robotic circuits.
Such relays are used in general electrical and electronic control or switching circuits
either mounted directly onto PCB boards or connected free standing and in which the
load currents are normally fractions of an ampere up to 20+ amperes. The relay circuit are
common in Electronics applications.

As their name implies, electromechanical relays are electro-magnetic devices that convert
a magnetic flux generated by the application of a low voltage electrical control signal
either AC or DC across the relay terminals, into a pulling mechanical force which
operates the electrical contacts within the relay. The most common form of
electromechanical relay consist of an energizing coil called the “primary circuit” wound
around a permeable iron core.
This iron core has both a fixed portion called the yoke, and a moveable spring loaded part
called the armature, that completes the magnetic field circuit by closing the air gap
between the fixed electrical coil and the moveable armature. The armature is hinged or
pivoted allowing it to freely move within the generated magnetic field closing the
electrical contacts that are attached to it. Connected between the yoke and armature is
normally a spring (or springs) for the return stroke to “reset” the contacts back to their
initial rest position when the relay coil is in the “de-energized” condition, i.e. turned

Electrical Relay Contact Types.

As well as the standard descriptions of Normally Open, (NO) and Normally Closed, (NC)
used to describe how the relays contacts are connected, relay contact arrangements can
also be classed by their actions. Electrical relays can be made up of one or more
individual switch contacts with each “contact” being referred to as a “pole”. Each one of
these contacts or poles can be connected or “thrown” together by energizing the relays
coil and this gives rise to the description of the contact types as being:

 SPST – Single Pole Single Throw

 SPDT – Single Pole Double Throw

 DPST – Double Pole Single Throw

 DPDT – Double Pole Double Throw

with the action of the contacts being described as “Make” (M) or “Break” (B). Then a
simple relay with one set of contacts as shown above can have a contact description of:

“Single Pole Double Throw – (Break before Make)”, or SPDT – (B-M)

Examples of just some of the more common diagrams used for electrical relay contact
types to identify relays in circuit or schematic diagrams is given below but there are many
more possible configurations.

Electrical Relay Contact Configurations

 Where:

 C is the Common terminal

 NO is the Normally Open contact

 NC is the Normally Closed contact

Relays are also denoted by the combinations of their contacts or switching elements and
the number of contacts combined within a single relay. For example, a contact which is
normally open in the de-energised position of the relay is called a “Form A contact” or
make contact. Whereas a contact which is normally closed in the de-energised position of
the relay is called a “Form B contact” or break contact.

When both a make and a break set of contact elements are present at the same time so
that the two contacts are electrically connected to produce a common point (identified by
three connections), the set of contacts are referred to as “Form C contacts” or change-
over contacts. If no electrical connection exists between the make and break contacts it is
referred to as a double change-over contact.

One final point to remember about using electrical relays. It is not advisable at all to
connect relay contacts in parallel to handle higher load currents. For example, never
attempt to supply a 10A load with two relay contacts in parallel that have 5A contact
ratings each, as the mechanically operated relay contacts never close or open at exactly
the same instant of time. The result is that one of the contacts will always be overloaded
even for a brief instant resulting in premature failure of the relay over time.

Also, while electrical relays can be used to allow low power electronic or computer type
circuits to switch relatively high currents or voltages both “ON” or “OFF”. Never mix
different load voltages through adjacent contacts within the same relay such as for
example, high voltage AC (240v) and low voltage DC (12v), always use separate relays
for safety.

One of the more important parts of any electrical relay is its coil. This converts electrical
current into an electromagnetic flux which is used to mechanically operate the relays
contacts. The main problem with relay coils is that they are “highly inductive loads” as
they are made from coils of wire. Any coil of wire has an impedance value made up of
resistance ( R ) and inductance ( L ) in series (LR Series Circuit).

As the current flows through the coil a self induced magnetic field is generated around it.
When the current in the coil is turned “OFF”, a large back emf (electromotive force)
voltage is produced as the magnetic flux collapses within the coil (transformer theory).
This induced reverse voltage value may be very high in comparison to the switching
voltage, and may damage any semiconductor device such as a transistor, FET or micro-
controller used to operate the relay coil.
One way of preventing damage to the transistor or any switching semiconductor device,
is to connect a reverse biased diode across the relay coil.

When the current flowing through the coil is switched “OFF”, an induced back emf is
generated as the magnetic flux collapses in the coil.

This reverse voltage forward biases the diode which conducts and dissipates the stored
energy preventing any damage to the semiconductor transistor.

When used in this type of application the diode is generally known as a Flywheel
Diode, Free-wheeling Diode and even Fly-back Diode, but they all mean the same thing.
Other types of inductive loads which require a flywheel diode for protection are
solenoids, motors and inductive coils.

As well as using flywheel Diodes for protection of semiconductor components, other

devices used for protection include RC Snubber Networks, Metal Oxide
Varistors or MOV and Zener Diodes.
The Solid State Relay, While the electromechanical relay (EMR) are
inexpensive, easy to use and allow the switching of a load circuit controlled
by a low power, electrically isolated input signal, one of the main
disadvantages of an electromechanical relay is that it is a “mechanical
device”, that is it has moving parts so their switching speed (response time)
due to physically movement of the metal contacts using a magnetic field is

Over a period of time these moving parts will wear out and fail, or that the contact
resistance through the constant arcing and erosion may make the relay unusable and
shortens its life. Also, they are electrically noisy with the contacts suffering from contact
bounce which may affect any electronic circuits to which they are connected.

To overcome these disadvantages of the electrical relay, another type of relay called
a Solid State Relay or (SSR) for short was developed which is a solid state contactless,
pure electronic relay.

The solid state relay being a purely electronic device has no moving parts within its
design as the mechanical contacts have been replaced by power transistors, thyristors or
triac’s. The electrical separation between the input control signal and the output load
voltage is accomplished with the aid of an opto-coupler type Light Sensor.

The Solid State Relay provides a high degree of reliability, long life and reduced
electromagnetic interference (EMI), (no arcing contacts or magnetic fields), together with
a much faster almost instant response time, as compared to the conventional
electromechanical relay.

Also the input control power requirements of the solid state relay are generally low
enough to make them compatible with most IC logic families without the need for
additional buffers, drivers or amplifiers. However, being a semiconductor device they
must be mounted onto suitable heatsinks to prevent the output switching semiconductor
device from over heating.

A relay is an electrically operated switch. Current flowing through the coil of the relay creates a
magnetic field which attracts a lever and changes the switch contacts. The coil current can be on
or off so relays have two switch positions and most have double throw (changeover) switch
contacts as shown in the diagram.

Relays allow one circuit to switch a second circuit which can be completely separate from the
first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains circuit.
There is no electrical connection inside the relay between the two circuits, the link is magnetic
and mechanical.

The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be as
much as 100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot
provide this current and a transistor is usually used to amplify the small IC current to the larger
value required for the relay coil. The maximum output current for the popular 555 timer IC is
200mA so these devices can supply relay coils directly without amplification.

Relays are usuallly SPDT or DPDT but they can have many more sets of switch contacts, for
example relays with 4 sets of changeover contacts are readily available. For further information
about switch contacts and the terms used to describe them please see the page on switches.
Most relays are designed for PCB mounting but you can solder wires directly to the pins
providing you take care to avoid melting the plastic case of the relay.

The supplier's catalogue should show you the relay's connections. The coil will be obvious and it
may be connected either way round. Relay coils produce brief high voltage 'spikes' when they
are switched off and this can destroy transistors and ICs in the circuit. To prevent damage you
must connect a protection diode across the relay coil.

The animated picture shows a working relay with its coil and switch contacts. You can see a lever
on the left being attracted by magnetism when the coil is switched on. This lever moves the
switch contacts. There is one set of contacts (SPDT) in the foreground and another behind them,
making the relay DPDT.


The ULN2003 is a monolithic high voltage and high current Darlington transistor arrays. It
consists of seven NPN darlington pairs that features high-voltage outputs with common-
cathodeclamp diode for switching inductive loads. The collector-current rating of a single
darlington pair is 500mA.

The darlington pairs may be parrlleled for higher current capability. Applications includerelay
drivers,hammer drivers, lampdrivers,display drivers(LED gasdischarge),line drivers, and logic
buffers.The ULN2003 has a 2.7kW series base resistor for eachdarlington pair for operation
directly with TTL or 5V CMOSdevices.


* 500mA rated collector current(Single output)

* High-voltage outputs: 50V

* Inputs compatible with various types of logic.

* Relay driver application

Relay application considerations

A large relay with two coils and many sets of contacts, used in an old telephone switching

Several 30-contact relays in "Connector" circuits in mid 20th century 1XB switch and 5XB switch
telephone exchanges; cover removed on one

Selection of an appropriate relay for a particular application requires evaluation of many

different factors:

 Number and type of contacts – normally open, normally closed, (double-throw)

 Contact sequence – "Make before Break" or "Break before Make". For example, the old
style telephone exchanges required Make-before-break so that the connection didn't get
dropped while dialing the number.
 Rating of contacts – small relays switch a few amperes, large contactors are rated for up
to 3000 amperes, alternating or direct current

 Voltage rating of contacts – typical control relays rated 300 VAC or 600 VAC, automotive
types to 50 VDC, special high-voltage relays to about 15 000 V

 Coil voltage – machine-tool relays usually 24 VAC, 120 or 250 VAC, relays for switchgear
may have 125 V or 250 VDC coils, "sensitive" relays operate on a few milliamperes

 Coil current

 Package/enclosure – open, touch-safe, double-voltage for isolation between circuits,

explosion proof, outdoor, oil and splash resistant, washable for printed circuit board

 Assembly – Some relays feature a sticker that keeps the enclosure sealed to allow PCB
post soldering cleaning, which is removed once assembly is complete.

 Mounting – sockets, plug board, rail mount, panel mount, through-panel mount,
enclosure for mounting on walls or equipment

 Switching time – where high speed is required

 "Dry" contacts – when switching very low level signals, special contact materials may be
needed such as gold-plated contacts

 Contact protection – suppress arcing in very inductive circuits

 Coil protection – suppress the surge voltage produced when switching the coil current

 Isolation between coil circuit and contacts

 Aerospace or radiation-resistant testing, special quality assurance

 Expected mechanical loads due to acceleration – some relays used in aerospace

applications are designed to function in shock loads of 50 g or more

 Accessories such as timers, auxiliary contacts, pilot lamps, test buttons

 Regulatory approvals

 Stray magnetic linkage between coils of adjacent relays on a printed circuit board.


In any electric motor, operation is based on simple

electromagnetism. A current-carrying conductor generates a magnetic field
when this is then placed in an external magnetic field, it will experience a
force proportional to the current in the conductor, and to the strength of the
external magnetic field. As you are well aware of from playing with magnets
as a kid, opposite (North and South) polarities attract, while like polarities
(North and North, South and South) repel. The internal configuration of a
DC motor is designed to harness the magnetic interaction between a current-
carrying conductor and an external magnetic field to generate rotational

The shunt motor is different from the series motor in that the field
winding is connected in parallel with the armature instead of in series. You
should remember from basic electrical theory that a parallel circuit is often
referred to as a shunt. Since the field winding is placed in parallel with the
armature, it is called a shunt winding and the motor is called a shunt motor.
Figure shows a diagram of a shunt motor. Notice that the field terminals are
marked Fl and F2, and the armature terminals are marked Al andA2. You
should notice in this diagram that the shunt field is represented with multiple
turns using a thin line.

Let's start by looking at a simple 2-pole DC electric motor (here red

represents a magnet or winding with a "North" polarization, while green
represents a magnet or winding with a "South" polarization).
Every DC motor has six basic parts -- axle, rotor (a.k.a., armature),
stator, commutator, field magnet(s), and brushes. In most common DC
motors (and all that BEAMers will see), the external magnetic field is
produced by high-strength permanent magnets1. The stator is the stationary
part of the motor ,this includes the motor casing, as well as two or more
permanent magnet pole pieces. The rotor (together with the axle and
attached commutator) rotate with respect to the stator. The rotor consists of
windings (generally on a core), the windings being electrically connected to
the commutator. The above diagram shows a common motor layout -- with
the rotor inside the stator (field) magnets.

The geometry of the brushes, commutator contacts, and rotor

windings are such that when power is applied, the polarities of the energized
winding and the stator magnet(s) are misaligned, and the rotor will rotate
until it is almost aligned with the stator's field magnets. As the rotor reaches
alignment, the brushes move to the next commutator contacts, and energize
the next winding. Given our example two-pole motor, the rotation reverses
the direction of current through the rotor winding, leading to a "flip" of the
rotor's magnetic field, driving it to continue rotating.
In real life, though, DC motors will always have more than two
poles (three is a very common number). In particular, this avoids "dead
spots" in the commutator. You can imagine how with our example two-pole
motor, if the rotor is exactly at the middle of its rotation (perfectly aligned
with the field magnets), it will get "stuck" there. Meanwhile, with a two-pole
motor, there is a moment where the commutator shorts out the power supply
(i.e., both brushes touch both commutator contacts simultaneously). This
would be bad for the power supply, waste energy, and damage motor
components as well. Yet another disadvantage of such a simple motor is that
it would exhibit a high amount of torque "ripple" (the amount of torque it
could produce is cyclic with the position of the rotor).

Diagram of DC shunt motor.

Two factors are important in the selection of a motor for a particular
application: the variation of the speed with a change in load, and the
variation of the torque with a change in load. A shunt motor is basically a
constant speed device. If a load is applied, the motor tends to slow down.

The slight loss in speed reduces the counter emf and results in an
increase of the armature current. This action continues until the increased
current produces enough torque to meet the demands of the increased load.
As a result, the shunt motor is in a state of stable equilibrium because a
change of load always produces a reaction that adapts the power input to the
change in load.

The basic circuit for a shunt motor is shown in figure. Note that only
a shunt field winding is shown. Figure shows the addition of a series
winding to counteract the effects of armature reaction. From the standpoint
of a schematic diagram, figure represents a compound motor. However, this
type of motor is not considered to be a com pound motor because the
commutating winding is not wound on the same pole as the field winding
and the series field has only a few turns of wire in series with the armature
circuit. As a result, the operating characteristics are those of a shunt motor.
This is so noted on the nameplate of the motor by the terms compensated
shunt motor or stabilized shunt motor.


A shunt-wound motor is a direct-current motor in which the field

windings and the armature may be connected in parallel across a constant-
voltage supply. In adjustable speed applications, the field is connected across
a constant-voltage supply and the armature is connected across an
independent adjustable-voltage supply. Permanent magnet motors have
similar control


It will be easier to understand the operation of the DC motor

from a basic diagram that shows the magnetic interaction between the
rotating armature and the stationary field's coils. Below Figure shows three
diagrams that explain the DC motor's operation in terms of the magnetic
In Fig. (a) you can see that a bar magnet has been mounted on a
shaft so that it can spin. The field winding is one long coil of wire that has
been separated into two sections. The top section is connected to the positive
pole of the battery and the bottom section is connected to the negative pole
of the battery. It is important to understand that the battery represents a
source of voltage for this winding. In the actual industrial-type motor this
voltage will come from the DC voltage source for the motor. The current
flow in this direction makes the top coil the north pole of the magnet and the
bottom coil the south pole of the magnet.

The bar magnet represents the armature and the coil of wire represents
the field. The arrow shows the direction of the armature's rotation. Notice
that the arrow shows the armature starting to rotate in the clockwise
direction. The north pole of the field coil is repelling the north pole of the
armature, and the south pole of the field coil is repelling the south pole of
the armature.

(a) Magnetic diagram that explains the operation of a DC motor. The

rotating magnet moves clockwise because like poles repel.
(b) The rotating magnet is being attracted because the poles are unlike.
(c) The rotating magnet is now shown as the armature coil, and its
polarity is determined by the brushes and commutator segments.

As the armature begins to move, the north pole of the armature

comes closer to the south pole of the field, and the south pole of the
armature is coming closer to the north pole of the field. As the two unlike
poles near each other, they begin to attract. This attraction becomes stronger
until the armature's north pole moves directly in line with the field's south
pole, and its south pole moves directly in line with the field's north pole (b).

When the opposite poles are at their strongest attraction, the

armature will be "locked up" and will resist further attempts to continue
spinning. For the armature to continue its rotation, the armature's polarity
must be switched. Since the armature in this diagram is a permanent magnet,
you can see that it would lock up during the first rotation and not work. If
the armature is an electromagnet, its polarity can be changed by changing
the direction of current flow through it. For this reason the armature must be
changed to a coil (electromagnet) and a set of commutator segments must be
added to provide a means of making contact between the rotating member
and the stationary member.

One commutator segment is provided for each terminal of the

magnetic coil. Since this armature has only one coil, it will have only two
terminals, so the commutator has two segments.

Since the armature is now a coil of wire, it will need DC current

flowing through it to become magnetized. This presents another problem;
since the armature will be rotating, the DC voltage wires cannot be
connected directly to the armature coil.

A stationary set of carbon brushes is used to make contact to the

rotating armature. The brushes ride on the commutator segments to make
contact so that Current will flow through the armature coil.In Fig. (C) you
can see that the DC voltage is applied to the field and to the brushes.

Since negative DC voltage is connected to one of the brushes, the

commutator segment the negative brush rides on will also be negative. The
armature's magnetic field causes the armature to begin to rotate. This time
when the armature gets to the point where it becomes locked up with the
magnetic field, the negative brush begins to touch the end of the armature
coil that was previously positive and the positive brush begins to touch the
end of the armature coil that was negative.
This action switches the direction of current flow through the
armature, which also switches the polarity of the armature coil's magnetic
field at just the right time so that the repelling and attracting continues. The
armature continues to switch its magnetic polarity twice during each
rotation, which causes it to continually be attracted and repelled with the
field poles.

This is a simple two-pole motor that is used primarily for

instructional purposes. Since the motor has only two poles, the motor will
operate rather roughly and not provide too much torque. Additional field
poles and armature poles must be added to the motor for it to become useful
for industry.

Two factors are important in the selection of a motor for a particular


(1) the variation of the speed with a change in load.

(2) the variation of the torque with a change in load.

A shunt motor is basically a constant speed device. If a load is

applied, the motor tends to slow down. The slight loss in speed reduces the
counter emf and results in an increase of the armature current.

This action continues until the increased current produces enough

torque to meet the demands of the increased load. As a result, the shunt
motor is in a state of stable equilibrium because a change of load always
produces a reaction that adapts the power input to the change in load.

The basic circuit for a shunt motor is shown in figure . Note that only
a shunt field winding is shown. Figure 1-10B shows the addition of a series
winding to counteract the effects of armature reaction. From the standpoint
of a schematic diagram, figure 1-10B represents a compound motor.
However, this type of motor is not considered to be a com pound motor
because the commutating winding is not wound on the same pole as the field
winding and the series field has only a few turns of wire in series with the
armature circuit.

As a result, the operating characteristics are those of a shunt motor. This

is so noted on the nameplate of the motor by the terms compensated shunt
motor or stabilized shunt motor.

Speed Control

A dc shunt motor has excellent speed control. To operate the motor

above its rated speed, a field rheostat is used to reduce the field current and
field flux. To operate below rated speed, reduce the voltage applied to the
armature circuit.
A more modem method of speed control is the electronic speed control
system. The principles of control are the same as the manual controls.
Speeds above normal are achieved by reducing the field voltage
electronically and speeds below normal reduce the voltage applied to the


The direction of armature rotation may be changed by reversing the

direction of cur rent in either the field circuit or the armature circuit. For a
motor with a simple shunt field circuit, it may be easier to reverse the field
circuit lead. If the motor has a series winding, or an interpole winding to
counteract armature reaction, the same relative direction of cur rent must be
maintained in the shunt and series windings. For this reason, it is always
easier to reverse the direction of the armature current.

Shunt motor connections:

(A) Without Commutating Poles; (B) With Commutating Poles


A dc shunt motor has high torque at any speed. At startup, a dc shunt motor
develops 150 percent of its rated torque if the resistors used in the starting
mechanism are capable of withstanding the heating effects of the current.
For very short periods of time, the motor can develop 350 percent of full
load torque, if necessary.

Speed Regulation

The speed regulation of a shunt motor drops from 5 percent to 10 percent

from the no-load state to full load. As a result, a shunt motor is superior to
the series dc motor, but is inferior to a compound-wound dc motor. Figure
shows a dc motor with horse power ratings ranging from 1 hp to 5 hp.
the field coil. In this application the armature coil is usually changed, as was
the case with the series motor. the electrical diagram of a DC shunt motor
connected to a forward and reversing motor starter. You should notice that
the Fl and F2 terminals of the shunt field are connected directly to the power
supply, and the Al and A2 terminals of the armature winding are connected
to the reversing starter. When the FMS is energized, its contacts connect the
Al lead to the positive power supply terminal and the A2 lead to the negative
power supply terminal.

The Fl motor lead is connected directly to the positive terminal of the

power supply and the F2 lead is connected to the negative terminal. When
the motor is wired in this configuration, it will begin to run in the forward
direction. When the RMS is energized, its contacts reverse the armature
wires so that the Al lead is connected to the negative power supply terminal
and the A2 lead is connected to the positive power supply terminal. The field
leads are connected directly to the power supply, so their polarity is not

Since the field's polarity has remained the same and the armature's
polarity has reversed, the motor will begin to rotate in the reverse direction.
The control part of the diagram shows that when the FMS coil is energized,
the RMS coil is locked out. Installing a Shunt Motor A shunt motor can be
installed easily.

The motor is generally used in belt-drive applications. This means that

the installation procedure should be broken into two sections, which include
the mechanical installation of the motor and its load, and the installation of
electrical wiring and controls.

When the mechanical part of the installation is completed, the

alignment of the motor shaft and the load shaft should be checked. If the
alignment is not true, the load will cause an undue stress on the armature
bearing and there is the possibility of the load vibrating and causing damage
to it and the motor. After the alignment is checked, the tension on the belt
should also be tested. As a rule of thumb, you should have about V2 to 1/4
inch of play in the belt when it is properly tensioned.
Several tension measurement devices are available to determine when a
belt is tensioned properly. The belt tension can also be compared to the
amount of current the motor draws.

The motor must have its electrical installation completed to use this
method. The motor should be started, and if it is drawing too much current,
the belt should be loosened slightly but not enough to allow the load to slip.
If the belt is slipping, it can be tightened to the point where the motor is able
to start successfully and not draw current over its rating The electrical
installation can be completed before,

8051- C51 C Compiler

The Keil C51 C Compiler for the 8051 microcontroller is the most popular 8051 C
compiler in the world. It provides more features than any other 8051 C compiler
available today.The C51 Compiler allows you to write 8051 microcontroller applications
in C that, once compiled, have the efficiency and speed of assembly language. Language
extensions in the C51 Compiler give you full access to all resources of the 8051.

The C51 Compiler translates C source files into relocatable object modules which
contain full symbolic information for debugging with the µVision Debugger or an in-
circuit emulator. In addition to the object file, the compiler generates a listing file which
may optionally include symbol table and cross reference information.


 Nine basic data types, including 32-bit IEEE floating-point,

 Flexible variable allocation with bit, data, bdata, idata, xdata, and pdata memory

 Interrupt functions may be written in C,

 Full use of the 8051 register banks,

 Complete symbol and type information for source-level debugging,

 Use of AJMP and ACALL instructions,

 Bit-addressable data objects,

 Built-in interface for the RTX51 Real-Time Kernel,

 Support for dual data pointers on Atmel, AMD, Cypress, Dallas Semiconductor,
Infineon, Philips, and Triscend microcontrollers,

 Support for the Philips 8xC750, 8xC751, and 8xC752 limited instruction sets,

 Support for the Infineon 80C517 arithmetic unit.

Development Tool Overview

The following chart shows the Keil development tools and how they interface to
each other.
Keil development tools for the 8051 Microcontroller Architecture support every
level of software developer from the professional applications engineer to the student
just learning about embedded software development.

The industry-standard Keil C Compilers, Macro Assemblers, Debuggers, Real-time

Kernels, Single-board Computers, and Emulators support all 8051 derivatives and help
you get your projects completed on schedule.

 When starting a new project, simply select the microcontroller you use from the
Device Database and the µVision IDE sets all compiler, assembler, linker, and memory
options for you.
 Numerous example programs are included to help you get started with the most
popular embedded 8051 devices.

 The Keil µVision Debugger accurately simulates on-chip peripherals (I²C, CAN,
UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of
your 8051 device. Simulation helps you understand hardware configurations and
avoids time wasted on setup problems. Additionally, with simulation, you can write
and test applications before target hardware is available.

 When you are ready to begin testing your software application with target
hardware, use the MON51, MON390, MONADI, or FlashMON51 Target Monitors, the
ISD51 In-System Debugger, or the ULINK USB-JTAG Adapter to download and test
program code on your target system.


This chapter explains how to setup an operating environment and how to install the
software on your hard disk. Before starting the installation program, you must do the

 Verify that your computer system meets the minimum requirements.

 Make a copy of the installation diskette for backup purposes.

System Requirements

There are minimum hardware and software requirements that must be satisfied to

ensure that the compiler and utilities function properly.

For our Windows-based tools, you must have the following:

 100% IBM compatible 386 or higher PC,

 Windows 3.1 or higher,
 4 MB RAM minimum,
 Hard disk with 6 MB free disk space.
For our DOS-based tools, you must have the following:

 100% IBM compatible 386 or higher PC with 640 KB RAM,

 MS-DOS Version 3.1 or higher,
 Hard disk with 6 MB free disk space
A51 Assembler Kit

The CA51 Compiler Kit for the 8051 microcontroller family supports all 8051
derivatives including classic devices and IP cores from companies like Analog Devices,
Atmel, Cypress Semiconductor, Dallas Semiconductor, Goal, Hynix, Infineon, Intel, NXP
(founded by Philips), OKI, Silicon Labs, SMSC, STMicroelectronics, Synopsis, TDK, Temic,
Texas Instruments, and Winbond.

On-chip peripherals and other key features of the 8051 are easy to access with the
CA51 Compiler Kit.


 µVision
o Integrated Development Environment

 Keil Classic 8051 Compilation Tools

o A51 Macro Assembler

o C51 ANSI C Compiler

o BL51 Code Banking Linker/Locator

o OH51 Object-HEX Converter

o OC51 Banked Object Converter

You should consider the CA51 Compiler Kit if you...

 Will work with a variety of 8051 microcontrollers,

 Need to write code in C,

 Already have a simulator or emulator.

Keil Tools for Embedded Development

Keil™, an ARM® Company, makes C compilers, assemblers, integrated development

environments, real-time kernels, debuggers, simulators and JTAG emulators for
embedded systems using the the ARM7/ARM9/Cortex-M3, XC16x/C16x/ST10, 251, and
8051 cores.

Keil also offers an extensive range of evaluation boards and starter kits to quick start
your development. Evaluation boards are available for ARM, 8051 and C16x devices.

Keil's product-range includes:

 µVision IDE and Debugger

 RealView Microcontroller Development Kit for ARM®

 RealView Real-Time Library for ARM®

 Developer's Kit for 8051

 XC16x, C16x and ST10 Development Tools

 ULINK JTAG and Serial Wire Debug interfaces

µVision Integrated Development Environment

Common to all Keil software development tools, Keil's µVision IDE and Debugger
combines project management, make facilities, revision control, source code editing,
target program debugging, device simulation and Flash programming in a single fully-
integrated environment. With a simple and logical Getting-Started process, the µVision
development platform helps you to quickly create embedded programs that work. The
Editor and Debugger are integrated in a single application that provides a seamless
embedded project development environment.

µVision IDE/Debugger/Simulator

µVision is the Keil Integrated Development and Debugging Environment that helps
you quickly create, test and debug embedded applications for ARM7, ARM9, Cortex-M3,
C16x, ST10, XC16x, C251, and C51 embedded microcontrollers.

The µVision Debugger supports simulation using only your PC or laptop, and
debugging using your target system and a debugger interface. µVision includes all
essential debugging capabilities, including simple and complex breakpoints, watch
windows, and execution control, together with industrial-strength features that include
trace capture, execution profiler, code coverage, and logic analysis.

Developer's Kit for 8051

The Keil Developer's Kit for 8051 supports all 8051 derivatives from vendors that
include Analog Devices, Atmel, Cypress, Maxim (Dallas), Infineon, Intel, NXP, SMC,
Synopsis, TDK, Temic, TI, Triscend and Winbond.

The Keil Cx51 ANSI C Compiler supports all classic and extended 8051 device
variants, including those from Analog Devices, Atmel, Cypress, Maxim (Dallas), Infineon,
NXP, SMC, Synopsis, TDK, Temic, TI, Triscend and Winbond. Compiler extensions provide
full access to all CPU resources, and support up to 16MB memory. The full range of NXP
C51Mx-core exytended memory devices is supported, together with NXP's SmartMX2
Smart Card devices.

Keil Cx51 generates code with the efficiency and speed of hand-optimized assembly.
New compiler and linker optimizations shrink programs into the smallest single-chip

The Keil μVision® IDE fully integrates Cx51 Version 8 and provides control of the
Compiler, Assembler, Real-Time OS, Project Manager, and Debugger in a single,
intelligent environment. With support for all 8051 devices and full compatibility with
emulators and third party tools, Keil Cx51 is clearly the best choice for your 8051 project.

 Supports all 8051 variants, up to 16MB memory

 Easy-to-use IDE supports the complete development cycle

 Complete Device Support, including peripherals simulation

 Drivers for Flexible Debugging in Target Hardware

 Supports Flash Programming and JTAG/OCDS debugging on suitable target-

devices, using ULINK debug interfaces

 Fully supported by Ashling's PathFinder Source Debugger and the Ashling Ultra-
51 and Ultra-SmartMX Emulators.

The Keil PK51, CA51 and A51 software packages contain the following components:

Keil 8051 Development Packages

Product: PK51 CA51 A51

IDE µVision IDE µVision IDE µVision IDE

Debugger µVision debugger

Simulator µVision simulator

C Compiler, extended memory CX51 C Compiler

Assembler, extended memory AX51 Assembler

Linker, extended memory LX51 Linker

Hex converter, extended memory OHX51 converter

C Compiler, standard memory C51 C Compiler C51 C Compiler

Assembler, standard memory A51 Assembler A51 Assembler A51 Assembler

Linker, standard and banked

BL51 Linker BL51 Linker BL51 Linker

Hex converter, standard memory OH51 converter OH51 converter OH51 converter

Banked object converter OC51 converter OC51 converter

Real-Time Kernel RTX51 Tiny

In-System Debugger ISD51

MON51 Target Monitor MON51

MON390 Target Monitor MON390

MONADI Target Monitor MONADI

Concept of compiler: -

Compilers are programs used to convert a High Level Language to object code.
Desktop compilers produce an output object code for the underlying microprocessor,
but not for other microprocessors. I.E the programs written in one of the HLL like ‘C’
will compile the code to run on the system for a particular processor like x86
(underlying microprocessor in the computer). For example compilers for Dos
platform is different from the Compilers for Unix platform
So if one wants to define a compiler then compiler is a program that translates
source code into object code. The compiler derives its name from the way it works,
looking at the entire piece of source code and collecting and reorganizing the
instruction. See there is a bit little difference between compiler and an interpreter.
Interpreter just interprets whole program at a time while compiler analyzes and
execute each line of source code in succession, without looking at the entire

The advantage of interpreters is that they can execute a program immediately.

Secondly programs produced by compilers run much faster than the same programs
executed by an interpreter. However compilers require some time before an
executable program emerges. Now ascompilers translate source code into object
code, which is unique for each type of computer, many compilers are available for
the same language.

Evaluation and Demo Kits

Keil Software provides two kits that let you evaluate our tools.

The 8051/251 Demo Kit includes demonstration versions of our tools. The tools in
the Demo Kit do not generate actual object code. They generate listing files where you
can see the code generated by the compiler and other tools.

The 8051/251 Evaluation Kit includes evaluation versions of our tools. The tools in
the Evaluation Kit let you generate applications up to 2 Kbytes in size. You may use this
kit to evaluate the effectiveness of our tools and to generate small target applications.
Both kits include this user’s guide and software. This user’s guide is also included in
each of our tool kits.

Types of Users

This manual addresses three types of users: evaluation users, new users, and
experienced users.

Evaluation Users are those users who have not yet purchased the software but have
requested the evaluation package to get a better feel for what the tools do and how they
perform. The evaluation package includes evaluation copies of the development tools.
You may use the included sample programs to get real-world experience with our 8051
and 251 development tools. Even if you are only a evaluation user, take the time to read
this manual. It explains how to install the software, provides you with an overview of the
development tools, and introduces the sample programs.

New Users are those users who are purchasing our 8051 development tools for the
first time. The included software provides you with the latest development tool versions
as well as sample programs. If you are new to the 8051 or 251 or the tools, take the time
to review the sample programs described in this manual. This manual provides a quick
tutorial and helps new or inexperienced users quickly get started with the tools.

Experienced Users are those users who have previously used our 8051 development
tools and are now upgrading to the latest 8051 or 251 tools. The software included with
a product upgrade contains the latest development tools, the sample programs, and a
full set of manuals.

Embedded Development Tools

MDK Version 5 Microcontroller Development Kit

Keil MDK Version 5 is the latest release of our complete software development
environment for a wide range of ARM, Cortex-M, and Cortex-R based microcontroller
devices. MDK includes the µVision IDE/Debugger, ARM C/C++ Compiler, and essential
middleware components. It's easy to learn and use.

DS-5 Development Studio

The ARM DS-5 Development Studio is an Eclipse based tool suite for ARM
application processors and System-on-Chip (SoC) devices. It supports multicore
debugging, Streamline performance analyzer, and Linux application profiling. DS-5 is the
right choice for Cortex-A based devices such as Atmel SAMA5, Freescale i.MX/Vybrid,
nvidia Tegra, Renesas EM/EV2, Samsung Exynos, STEricsson Nova, TI OMAP or Xilinx

8051 Development Tools

Keil C51 is the industry-standard toolchain for all 8051-compatible devices, it

supports classic 8051, Dallas 390, NXP MX, extended 8051 variants, and C251 devices.
The µVision IDE/Debugger integrates complete device simulation, interfaces to many
target debug adapters, and provides various monitor debug solutions.

C166 Development Tools

Keil C166 development tools support the Infineon C166, XC166, XE166, XC2000 and
ST10 microcontroller families. The µVision IDE/Debugger interfaces to the Infineon DAVE
code generation tool and various debug solutions including the ULINK2.

Evaluation Boards
Keil offers an extensive range of evaluation boards and starter kits to quick start your
development. Boards are available for ARM, 8051, and 166 processor-based devices.

µVision IDE and Debugger

The Keil µVision IDE is common to all Keil software development tools.

Supported Microcontrollers

The Keil development tools support a huge range of standard microcontroller

devices from a variety of vendors, a complete list of the supported devices is available in
the Device Database.
Click the Project
Give the Folder
name & open.
Click ‘ Target ‘
Click ‘ Output ‘
File --> New / Ctrl+N
After finishing the
Embedded C program to
save the file.
Click the + symbol

Right Click The



The project “Automatic user state recognition for hand gesture based low-cost television control
system” has demonstrated how to get a fully functional embedded product developed from
scratch. This included the cross compilation and deployment of essential libraries, the
configuration of embedded Linux and cloud computing technology for the development of
specialized TV controlling using gesture recognition.

[1] I. S. Mackenzie and W. Buxton, “Extending fitts’ law to two-dimensional tasks, “in
Proceedings of CHI’92, pp.219-226, May 1992.

[2] S. K. Kim, G. H. Park, S. H. Yim, S. M. Choi, and S. J. Choi, “Gesture recognizing hand-held
interface with vibrotactile feedback for 3D interaction,” IEEE Trans. Consumer Electronics, vol. 55,
no. 3, pp. 1169-1177, Aug. 2009.

[3] H. Heo, E. C. Lee, K. R. Park, C. J. Kim, and M. C. Whang, “A realistic game system using multi-
modal user interfaces,” IEEE Trans. Consumer Electronics, vol. 56, no. 3, pp. 1364-1372, Aug.

[4] D. W. Lee, J. M. Lim, S. W. John, I. Y. Cho, and C. H. Lee, “Actual remote control: a universal
remote control using hand motions on a virtual menu,” IEEE Trans. Consumer Electronics, vol. 55,
no. 3, pp. 1439-1446, Aug. 2009.

[5] R. Aoki, M. Ihara, A. Maeda, M. Kobayashi, and S. Kagami, “Expanding kinds of gestures for
hierarchical menu selection by unicursal gesture interface,” IEEE Trans. Consumer Electronics,
vol. 57, no. 2, pp. 731-737, May 2011.

[6] Y. M. Han, “A low-cost visual motion data glove as an input device to interpret human hand
gestures,” IEEE Trans. Consumer Electronics, vol. 56, no. 2, pp. 501-509, May 2010.

[7] L. C. Miranda, H. H. Hornung, M. C. .Baranauskas, “Adjustable interactive rings for iDTV,” IEEE
Trans. on Consumer Electronics, Vol. 56, No. 3, pp. 1988-1996, August 2010.

[8] J.-S. Park, G.-J. Jang, J.-H. Kim, S.-H. Kim, “Acoustic interference cancellation for a voice-driven
interface in smart TVs,” IEEE Trans. on Consumer Electronics, Vol. 59, No. 1, pp. 244-249,
February 2013.

[9] I. Papp, Z. Saric, N. Teslic, “Hands-free voice communication with TV,” IEEE Trans. on
Consumer Electronics, Vol. 57, No. 1, pp. 606-614, February 2011.

[10] W. T. Freeman and C. D. Weissman, “Television control by hand gestures,” in Proceeding of

IEEE International Workshop on Automatic Face and Gesture Recognition, Zurich, Switzerland,
pp. 179-183, June 1995.
[11] S. Jeong, J. Jin, T. Song, K. Kwon, and J. W. Jeon, “Single-Camera Dedicated Television Control
System using Gesture Drawing,” IEEE Trans. on Consumer Electronics, Vol. 58, No. 4, pp. 1129-
1137, November 2012.

[12]Tutorials [Online]. Available:

[13]Python [Online]. Available: