You are on page 1of 24

Embedded Systems Design

0403334

Embedded Systems Design

Dr. Bassel Soudan

Embedded Systems Overview

Computing systems are everywhere

Most of us think of desktop computers

PCs
Laptops
Mainframes
Servers

But theres another type of computing system


Far more common...

Embedded Systems Design

Dr. Bassel Soudan

Embedded Systems Overview

Embedded computing systems:


Computing systems embedded within electronic
devices.
Hard to define. Nearly any computing system
other than a desktop computer.
Billions of units produced yearly, versus millions of
desktop units.
Perhaps 50 per household and per automobile.

Embedded Systems Design

Dr. Bassel Soudan

Common Characteristics of Embedded Systems

Single-functioned
Executes a single program, repeatedly.

Tightly-constrained
Low cost, low power, small, fast, etc.

Reactive and real-time


Continually reacts to changes in the systems
environment.
Must compute certain results in real-time without
delay.

Embedded Systems Design

Dr. Bassel Soudan

Design Constraints

Limited Power.
Most embedded systems operate within battery operated
equipment.

Limited Memory.
An embedded system is constrained to a finite and small
amount of memory.

Real-Time.
Most embedded systems are used in a control function.
They are expected to sense the real-time status of the
system in which they are housed and produce real-time
responses.

Embedded Systems Design

Dr. Bassel Soudan

Definition of Embedded System

An embedded system is a microprocessor-based


system that is built to control a function or range
of functions and is not designed to be
programmed by the end user.
The user may make choices concerning the
functionality of the system but cannot change the
functionality of the system by adding/replacing
software.
Can you program your refrigerator?
May be sooner than you think.

Embedded Systems Design

Dr. Bassel Soudan

Advantages of Microprocessor-based

Replacement of discrete logic-based circuits.


Provide functional upgrades.
Provide easy maintenance upgrades.
Improve mechanical performance.
Protection of intellectual property (IP).
Replacement of analog circuits.

Embedded Systems Design

Dr. Bassel Soudan

Elements of an Embedded System

Processor
Memory
Provide storage for the software and data.

Peripherals
Software

Initialization and Configuration.


Operating System.
The application software.
Error handling.
Debug and maintenance support.

Embedded Systems Design

Dr. Bassel Soudan

Embedded System Microcontroller

Embedded systems are mainly intended to


provide control over the behavior of the system
into which they are housed.
Therefore, it is customary to talk about an
embedded controller rather than an embedded
processor.
It does process information but mainly for the
purpose of control.

When all hardware required to run the application


is provided on one chip, it is referred to as an
embedded microcontroller or in short
microcontroller.

Embedded Systems Design

Dr. Bassel Soudan

What is a Microcontroller ?

A microcontroller is a single chip microprocessor


system which contains:

A processor core.
Data and program memory.
Serial and parallel I/O.
Timers.
External and internal interrupt handling
mechanism.

all integrated into a single chip.


Embedded Systems Design

Dr. Bassel Soudan

10

Block Diagram of a Microprocessor

A microprocessor consists of an ALU to perform


arithmetic and logic manipulations, registers, and a
control unit.

In addition,
its has some
interfaces to
the outside
world in the
form of busses.

What is missing?
Memory and the peripherals.

Embedded Systems Design

Dr. Bassel Soudan

11

Block Diagram of a Microcomputer

Too much.
For the limited applications intended, this system has too
much of everything.
Meaning too expensive.

Embedded Systems Design

Dr. Bassel Soudan

12

How do we Define Expensive?

Money.
The system requires parts that cost too much money.

Size.
All of the additional functionality requires space.

Chip area or board space.

Power.
We will need power to run all of these chips and devices.

Heat.
Power = heat.
Operating inside another system may not afford us good
heat dissipation.

Efficiency.
Are we really utilizing all of these features and
functionalities?

Embedded Systems Design

Dr. Bassel Soudan

13

Block Diagram of a Microcontroller

It is the specialized circuitry compared to the


microprocessor that makes the microcontroller
such a unique device.

The microcontroller
operates on data that
is fed in through its
serial or parallel input
ports controlled by
the software stored
in the on-chip
memory.

Embedded Systems Design

Dr. Bassel Soudan

14

Special Features of the Microcontroller

All of the additional functions built into the microcontroller


would normally require additional circuitry external to the
microprocessor.
I/O Ports.
Memory.

Some of these functions would normally be implemented


in software.
Counters, timers.

We can include them in the microcontroller chip after


removing some of the un-necessary functions.
Floating point functions.
Specialized multimedia instructions.

Embedded Systems Design

Dr. Bassel Soudan

15

Memory Considerations

When a PC executes an application, pieces of


the application are read from disk and stored into
an allocated section of the memory.
As more of the program is needed, additional
pieces of the software are loaded into the memory.

In a microcontroller there is no disk to read from.


On-chip ROM space is the maximum size of the
application that can be executed.

Embedded Systems Design

Dr. Bassel Soudan

16

Additional Programming Considerations

In a standard computer, there is a complicated


operating system that handles all low-level
operations.
Things like reading from interfacing to the different
devices, and allocating memory.

For an embedded system, the application stored


in the ROM of the microcontroller is the only
software that will execute.
Therefore, all low-level code and device interfaces
necessary to execute the application have to be
included.

Embedded Systems Design

Dr. Bassel Soudan

17

Example of a PC program

This code simply calls


the operating system
that will print the
message stored at the
location Msg and
returns execution to
the operating system.
To execute this
program in a
microcontroller, this
code would be
considerably longer...

Embedded Systems Design

MAIN:
mov AH, 9

; Program start

lds DX, Msg

; Print message

int 021h

mov AH, 04Ch

; End the program

xor AL, AL

; with a return code

int 21h

; of 0

Msg db Hello World, 00Dh, 00Ah, 0

Dr. Bassel Soudan

18

Example of a microcontroller program

Because the display


subroutine including
its initialization has
to be written.
The software has
also to know where
the device is
connected to and to
make sure that the
device is connected
properly.

LCD_INIT proc
setb B_LCDONOFF

; LCD Display On

clr B_LCDCURSOR

; Cursor Off

clr B_LCDBLINK

; No Blinking
;

call IO_LCDEN_LO

; Clear LCD Enable

call l?p1

; Send Init Byte

call l?p1

; Send Init Byte, Again

call l?p1

; Send Init Byte, Again

call l?p1

; Send Init Byte, Again

call LCD_DMOD

; Set Display Mode

call LCD_CLEAR

; Clear Display

call LCD_WAIT

; Wait For Display To Finish

mov a,#00000110b

; Entry Mode, Increase With No Shifting

call LCD_IOC

; Strobe Data To Display

mov D_LCDPOS,#000h

; Set Initial Cursor To 0

ret

; Return To Caller
;

l?p1 mov a,#00110000b

; Function Set, 8 Bits, 1 Line, 5 x 7 Dots

call LCD_IOC

; Strobe Data To LCD Display

mov r3,#0ffh

; R3 = ff

mov r2,#0ffh

; R2 = ff

l?p2 djnz r3,l?p2

; Loop

djnz r2,l?p2

; Waste More Than 4.1 Ms

ret

; Return To Caller

endproc

Embedded Systems Design

Dr. Bassel Soudan

19

Microcontroller vs. Microprocessor

Microprocessor (P):
Designed to perform as a CPU in a microcomputer
system.
The instruction set is arranged to allow code and
large amounts of data to be moved between the
P and the external memory and registers.
Operations on not less than four bits.

Microcontroller (C):
Designed to operate with minimum of external
circuitry.
Simple instruction set (255 instructions).
Operations possible on single bits !

Embedded Systems Design

Dr. Bassel Soudan

20

Where are microcontrollers used ?

Microcontrollers are typically used where


processing power is not critical.
It is estimated that on average a middle-class
household has a minimum of 35 microcontrollers
in it.
About 34 % of microcontroller applications are in
office automation such as laser printers, fax
machines, intelligent telephones and so forth.
Another 33 % of microcontrollers are used in
consumer electronic goods such as CD players
and hi-fi equipment.
The remaining 33 % are used in the
communications and automotive market.

Embedded Systems Design

Dr. Bassel Soudan

21

Evolution of microcontrollers

Microcontroller evolved from a board-level design to a


single chip in the mid-1970's. As the process of
miniaturization continued, all of the components needed
for a controller were built right onto one chip.
In the mid-1980s embedded systems migrated from the
single chip to microcontrollers embedded into a larger
ASIC (Application Specific Integrated Circuit) design.

Embedded Systems Design

Dr. Bassel Soudan

22

Advantages of using microcontrollers

Fast and effective


The architecture correlates closely with the problem being
solved (control systems).

Low cost / Low power


High level of system integration within one component.
Only a handful of components needed to create a working
system.

Compatibility
Opcodes and binaries are the SAME for all 80x51 variants.

Multi-sourced
Over 12 manufacturers, hundreds of varieties.

Constant improvements
Improvements in silicon/design increase speed and power
annually.

Embedded Systems Design

Dr. Bassel Soudan

23

Why Not Use a Microprocessor?

Processors vary in their customization for the


problem at hand.

Desired
functionality

General-purpose
processor
Embedded Systems Design

total = 0
for i = 1 to N loop
total += M[i]
end loop

Application-specific
processor
Dr. Bassel Soudan

Single-purpose
processor

24

You might also like