EMBEDDED SYSTEMS
EMBEDDED SYSTEM
Definition: An Embedded System is one that has
computer hardware with software embedded in it as
one of its important components. Its software embeds in
ROM (Read Only
Memory). It does not need
secondary memories as in
a computer
SOFTWARE PROGRAM
#include <16f876a.h>
#use delay (clock=20000000)
#byte PORTB=6
main()
HARDWARE {
set_tris_b(0);
portb=255; //decimal
delay_ms(1000);
portb=0x55; //hexadecimal
delay_ms(1000);
portb=0b10101010; //binary
delay_ms(500);
6
}
An embedded system is a
special-purpose computer system
designed to perform certain dedicated
•
functions. It is usually embedded as part
of a complete device including hardware
and mechanical parts.
In some cases, embedded systems are
part of a larger system or product, as is
the case of an anti- lock braking system
in a car.
Embedded System
• Embedded Systems is a big, fast growing
industry.
• Microprocessors/ Microcontrollers are the
core of embedded systems.
• The Software running on this core makes
the ES Tick…
Significance
Due to their compact size, low cost and
simple design aspects have made embedded
systems very popular. They have encroached
into human lives and have become
indispensable. They are found everywhere
from kitchen ware to space craft.
Embedded System (ES) Vs
Desktop Computer (DC)
• Embedded Systems (ES) are dedicated to
specific tasks
• ES can be implemented using wide variety of
processors, even generic or custom.
• ES are cost sensitive (but so are DC!)
• ES operate have real time constraints
• ES have environmental constraints (i.e.
Supposed to work in diverse environmental
conditions)
Embedded System (ES) Vs
Desktop Computer (DC)
• Embedded Systems (ES) usually run out of
ROM
• ES have resource constraints.
• ES are infrequently reprogrammed
• ES often work in reactive mode
• ES have hard reliability and correctness
constraints
Embedded systems everywhere?
Embedded systems span all aspects of modern life and
there are many examples of their use.
• Biomedical Instrumentation - ECG Recorder, Blood cell
recorder, patient monitor system.
• Communication systems - pagers, cellular phones, cable
TV terminals, fax and transreceivers, video games and so
on
• Peripheral controllers of a computer - Keyboard
controller, DRAM controller, DMA controller, Printer
controller, LAN controller, disk drive controller.
• Industrial Instrumentation - Process controller, DC
motor controller, robotic systems, CNC machine
controller, close loop engine controller, industrial
moisture recorder and controller.
• Scientific - digital storage system, CRT display
controller, spectrum analyser.
APPLICATIONS
•Household appliances:
Microwave ovens, Television, DVD
Players & Recorders
•Audio players
•Integrated systems in aircrafts and
missiles
•Cellular telephones
•Electric and Electronic Motor controllers
•Engine controllers in automobiles
•Calculators
• Medical equipments
•Videogames
•Digital musical instruments, etc.
42
Automotive embedded systems
Today's high-end automobile may have 100
microprocessors:
• 4-bit microcontroller checks seat belt;
• microcontrollers run dashboard devices;
• 16/32-bit microprocessor controls engine.
45
Were the embedded systems existing earlier
?
Yes, We have been enjoying the grace of embedded
system quite a long time. But they were not so popular
because in those days most of the embedded systems
were designed around a microprocessor unlike today's
systems which were built around a microcontroller.
As we know a microprocessor by itself do not possess any
memory, ports etc. So everything must be connected
externally by using peripherals like 8255, 8257, 8259 etc.
So the embedded system designed using microprocessor
was not only complicated in design but also large in size.
At the same time the speed of microprocessor is also a
limitation for high end applications.
PROCESSOR
• A Processor is the heart of the Embedded
System.
• For an embedded system design,
knowledge of microprocessor and
microcontroller is a must.
Two Essential Units: Operations
Control Unit (CU), Fetch
Execution Unit (EU) Execute
17
Microprocessor System
Vs
Microcontroller System
Why a microcontroller ?
• A microcontroller is a functional
computer system-on-a-chip. It contains a
processor, memory, and programmable
input/output peripherals.
• Microcontrollers include an integrated
CPU, memory (a small amount of RAM,
program memory, or both) and peripherals
capable of input and output.
30
Various Microcontrollers
INTEL
8031,8032,8051,8052,8751,8752
Microchip Technology
8-bit PIC16, PIC18,16-bit DSPIC33
Freescale (formerly Motorola)
68HC11/68HC11
ARM (advanced RISC machine)
Atmel
AVR
Zilog’s
Z8
MICROPROCESSOR MICROCONTROLLER
The functional blocks are ALU, It includes functional blocks of
registers, timing & control units microprocessors & in addition has
timer, parallel I/O, RAM, EPROM,
ADC & DAC
Bit handling instruction is less, Many type of bit
One or two type only handling instruction.
Rapid movements of code and Rapid movements of code and
data between external memory & data within microcontroller.
microprocessor
It is used for designing They are used for designing
general purpose digital application specific dedicated
computers system systems
So, its no wonder to say that the microcontroller is
the most sought after device for designing an
efficient embedded system.
Microcontroller can be classified into 3 types on the basis of
Type of Instruction set
▪ RISC (Reduced Instruction Set Computer)
▪ CISC (Complex Instruction Set Computer)
▪ MISC (Minimal Instruction Set Computer)
Memory Organization (the way the program and data
memory are accessed)
▪ Princeton or Von Neumann Architecture
▪ Harvard Architecture
The way the internal data is stored and manipulated
inside the CPU
▪ Stack Model
▪ Accumulator Model
▪ Register Memory Model
▪ Register Register Model
RISC
• Smaller and Simpler instruction set.
• Simple instructions, hence simple instruction
decoding.
• Instruction come under size of one word.
• Instruction take single clock cycle to get executed.
• More number of general purpose register.
• Simple Addressing Modes.
• Less Data types.
• Pipeline can be achieved.
• As number of instructions are few, a large program
code which increases compilation time
• Examples: ARM processors used in smart phones,
ATMEL’s AVR (Advanced Virtual RISC)
CISC
• Complex instruction, hence complex instruction
decoding.
• Instruction are larger than one word size.
• Instruction may take more than single clock cycle to get
executed.
• Less number of general purpose register as operation
get performed in memory itself.
• Complex Addressing Modes.
• More Data types.
• Complex Program Code
• Powerful and rich instruction set leads to compact
Program code
• Examples: Intel x86 family, Pentium series, Intel’s 8051
Example – Suppose we have to add two 8-bit
number:
•CISC approach: There will be a single command or
instruction for this like ADD which will perform the
task.
•RISC approach: Here programmer will write first load
command to load data in registers then it will use
suitable operator and then it will store result in desired
location.
So, add operation is divided into parts i.e. load,
operate, store due to which RISC programs are
longer and require more memory to get stored but
require less transistors due to less complex
command.
MISC
• Small number of basic instructions
• Instruction set is stack based rather than
register based
• Faster execution
• 32 or fewer instructions
Every microprocessor must have memory space to
store program (code) and data. While code
provides instructions to the CPU, the data provides
the information to be processed.
There are two types of architectures
• Von Neumann (Princeton)
• Harvard
VON NEUMANN
HARVARD ARCHITECTURE
ARCHITECTURE
It is ancient computer architecture It is modern computer architecture
based on stored program computer based on Harvard Mark I relay based
concept. model.
Same physical memory address is Separate physical memory address is
used for instructions and data. used for instructions and data.
There is common bus for data and Separate buses are used for
instruction transfer. transferring data and instruction.
Two clock cycles are required to An instruction is executed in a single
execute single instruction. cycle.
It is costly than Van Neumann
It is cheaper in cost. architecture. Data memory is more
expensive than Program memory.
CPU can not access instructions and CPU can access instructions and
read/write at the same time. read/write at the same time.
Point of Von Neumann
Harvard Architecture
Comparison Architecture
In Harvard architecture, the In Von-Neumann architecture,
CPU is connected with both there is no separate data and
Arrangement the data memory (RAM) and program memory. Instead, a
program memory (ROM), single memory connection is
separately. given to the CPU.
In contrast to the Harvard
It requires more hardware
architecture, this requires less
Hardware since it will be requiring
hardware since only a
requirements separate data and address
common memory needs to be
bus for each memory.
reached.
Von-Neumann Architecture
Space requirements This requires more space.
requires less space.
Speed of execution is faster Speed of execution is slower
because the processor since it cannot fetch the data
Speed of execution
fetches data and instructions and instructions at the same
Point of
Von Neumann
Compariso Harvard Architecture
Architecture
n
It results in wastage of space
Space is not wasted because
since if the space is left in the
the space of the data memory
data memory then the
Space usage can be utilized by the
instructions memory cannot
instructions memory and
use the space of the data
vice-versa.
memory and vice-versa.
Controlling becomes complex Controlling becomes simpler
since data and instructions since either data or
Controlling
are to be fetched instructions are to be fetched
simultaneously. at a time.
EMBEDDED SYSTEM HARDWARE
9
What makes embedded systems
different?
• Real-time Operation
• Size
• Cost
• Time
• Reliability
• Safety
• Energy
• Security 12
Features of an Embedded system
• Embedded systems do a very specific task, they cannot
be programmed to do different things.
• Embedded systems have very limited resources,
particularly the memory. Generally, they do not have
secondary storage devices such as the CDROM or the
floppy disk.
• Embedded systems have to work against some
deadlines. A specific job has to be completed within a
specific time. In some embedded systems, called
real-time systems, the deadlines are stringent. Missing a
deadline may cause a catastrophe - loss of life or
damage to property
• Embedded systems are constrained for power. As
many embedded systems operate through a battery,
the power consumption has to be very low.
• Embedded systems need to be highly reliable. Once
in a while, pressing ALT-CTRL-DEL is OK on your
desktop, but you cannot afford to reset your
embedded system.
• Some embedded systems have to operate in extreme
environmental conditions such as very high
temperatures and humidity.
3•
Miss. i1 e emb e dde v;n
tracking system
Hard Real-Time Embedded System
• Embedded systems that address the consumer
market (for example electronic toys} need to be very
cost-effective Even a reduction of Rs.10 is lot of
cost saving, because thousands or millions systems
may be sold.
• Unlike desktop computers in which the hardware
platform is dominated by Intel and the operating
system is dominated by Microsoft, there is a wide
variety of processors and operating systems for the
embedded systems. So, choosing the right
platform is the most complex task.
COMPONENTS OF EMBEDDED SYSTEM
It has Hardware
Processor, Timers, Interrupt controller, I/O Devices,
Memories, Ports, etc.
It has main Application Software
Which may perform concurrently the series of tasks or
multiple tasks.
It has Real Time Operating System (RTOS)
RTOS defines the way the system work which supervise
the application software. It sets the rules during the
execution of the application program. A small scale RTOS
may not need an RTOS.
What is inside an embedded system?
Every embedded system consists of custom-built
hardware built around a Central Processing Unit
(CPU). This hardware also contains memory chips
onto which the software is loaded. The software
residing on the memory chip is also called the 'firmware’
The operating system runs above the hardware, and
the application software runs above the operating
system. The same architecture is applicable to any
computer including a desktop computer. However,
there are significant differences. It is not compulsory to
have an operating system in every embedded system
For small appliances such as remote control units, air
conditioners, toys etc., there is no need for an operating
system and we can write only the software specific to
that application.
For applications involving complex processing, it is
advisable to have an operating system. In such a case,
you need to integrate the application software with the
operating system and then transfer the entire software
on to the memory chip. Once the software is
transferred to the memory chip, the software will
continue to run for a long time and you don't need to
reload new software.
Layered architecture of an Embedded System
Languages for Programming Embedded
Systems
• Assembly language was the pioneer for programming
embedded systems till recently. Nowadays there are
many more languages to program these systems.
Some of the languages are C, C++, Ada, Forth, and
Java together with its new enhancement J2ME.
• The majority of software for embedded systems is still
done in C language.
Recent survey indicates that approximately 45% of the
embedded software is still being done in C language.
C++ is also increasing its presence in embedded
systems. As C++ is based on C language, thus providing
programmer the object oriented methodologies to reap
the benefits of such an approach
C is very close to assembly programming and it allows
very easy access to underlying hardware. A huge
number of high quality compilers and debugging tools
are available for the C language.
Though C++ is theoretically more efficient than C, but
some of its compiler shave bugs due to the huge size
of the language. These compilers may cause a buggy
execution.
.
C language can definitely claim to have more mature
compilers C++. Now in order to avail the extra benefits of
C++ and plus to avoid buggy execution, experts are doing
efforts to identify a subset of C++ that can be used in
embedded systems and this subset is called Embedded
C++.
Communication Interfaces
For embedded systems to interact with the external world,
a number of external communication interfaces are
•available. They are
Serial Communication Interfaces {SCI):
RS-232, RS-422, RS-485 etc
Synchronous Serial Communication Interface:
12C, JTAG, SPI, SSC and ESSI
Universal Serial Bus {USB)
Networks:
Ethernet, Controller Area Network, LonWorks, etc
Timers:
PLL{s), Capture/Compare and Time Processing Units
Discrete 10:
General Purpose Input/Output {GPIO)
Analog to Digital/Digital to Analog {ADC/DAC)
Which is the best suited microcontroller for
design of embedded system?
There is always a trade off between efficiency and
power dissipation. To know this, let us review the
various types of microcontrollers and their
specifications and the vendors.
I
Bit Memory'Deices Instructio set Memory
s architectur
I n
8 3 e
I Embedde Externa
1
2 RIS CIS
Harward I Princeto
6 d l C C
n
mnemo
IC Chi A VLSI core ry
p (VHDL verilog
format) Famil
y
I I
805 Motorol PI Hitatch Texas ARM Other
1 a C i s
I I I
Inte Philip Atmel Siemen Dalla
l s s s
Embedded Systems...
• react on the environment at the speed of the
environment
• often real-time requirements
• are designed for one single task
• have often to be power-efficient
• are mass products and have to be cheap
• must be reliable
46
Thus,
• Microprocessors are used as key components in an
embedded design
• Programmable Logic and ASICs are used for
critical parts in a design
• An obective for an embedded system designer is to
find the cheapest solution that meets the
requirements.
• Find the cheapest solution that meets the
requirements
• Do not use a Pentium, when you
Challenges in embedded system design
• How much hardware do we need?
• How big is the CPU? Memory?
•How do we meet our deadlines?
•Faster hardware or cleverer software?
•How do we minimize power?
• Turn off unnecessary logic? Reduce memory accesses?
49
Challenges, etc
• Does it really work?
• Is the specification correct?
• Does the implementation meet the spec?
• How do we test for real-time characteristics?
• How do we test on real data?
• How do we work on the system?
• Observability, controllability?
• What is our development platform?
50
Three Criterion for choosing
Microcontrollers
1. Meeting the computing needs of the task at hand
efficiently and cost effectively
2. Availability of software and hardware development
tools such as compilers, assemblers, debuggers and
emulators
3. Wide availability and reliable sources of the
microcontroller
Meeting the computing needs of the task at
hand efficiently and cost effectively
• Foremost, we must see whether an 8 bit, 16 bit, or 32 bit
microcontroller can best handle the computing needs of
the task most effectively
• Speed: What is the highest speed that the uC supports?
• Packaging: DIP/QFP.. Important in terms of space,
assembling and prototyping the end product
• Power Consumption: Critical for battery powered
products
• Amount of RAM/ROM on the chip
• No. of I/O lines and timer on the chip
• Ease of upgrade to higher performance or lower
consumption versions
• Cost/unit: Very important in terms of final cost of the
product.
How easy to develop products
around it…..
Key considerations :
• Availability of an assembler
• debugger
• a code efficient C language compiler
• emulator
• technical support (both inhouse and outside
expertise)
Ready Availability…..
Sometimes, this is even more important than the
first two criterion…
Freescale, Atmel, Zilog and Microchip Technology
have all dedicated massive resources to ensure
wide and timely availability of their products as
their products are stable, mature and single
sourced.
Companies have started selling FPGA and ASIC
libraries for the different microcontrollers.
Why choose ATMEL’s AVR for
Application in Embedded Systems
• RISC architecture
• Harvard architecture
• In system programmable
• Can have up to 10MHz clock. AVR microcontrollers are
found to be 12 times faster than conventional CISC
microcontrollers
• Available in 8 pin (AT90S2323) to 100 pin (ATmega1280)
• Wide variety of on-chip peripherals- Digital I/Os, ADC,
USART, Timer, PWM, EEPROM.
Design of an embedded system - a Case study
To understand the design of a simple embedded
system let us first consider the idea of a data
acquisition system. The data acquisition
system is shown in the next slide.
Sensor Transducer Processor Output
Data acquisition system
• For example let me consider a simple case of
temperature measurement embedded system.
• First we must select a temperature sensor like
thermistor or AD590 or LM35 or LM335 or
LM75 etc.
• After this the analog data is converted into digital
data and at the same time proper signal
conditioning is done.
• This digital input is fed to the microcontroller
through its ports.
• By developing a suitable program (Embedded C
or Assembly) the data is processed and
controlled.
• For this purpose keil or Ride or IAR ARM
Embedded workbench C compilers can be used.
• Once the program is debugged, and found error
free, it can be dumped into the microcontroller flash
memory using ISP.
• Now, your microcontroller chip acts as an
Learn by Doing
Excel Thru Experimentation
Lead by Example
Acquire skills and get employed
Update skills and stay employed