BCSE305L
Embedded Systems
Module:1
Introduction
Overview of Embedded Systems, Design
challenges, Embedded processor technology,
Hardware Design, Micro-controller architecture -
8051, PIC, and ARM.
SYSTEM
A system is a way of working,
organizing or doing one or many tasks
according to a fixed plan, program or set of
rules.
A system is also an arrangement in
which all its units assemble and work
together according to the plan or program.
SYSTEM EXAMPLES
WATCH
It is a time display SYSTEM
Parts: Hardware, Needles, Battery, Dial,
Chassis and Strap
Rules
1.All needles move clockwise only
2.A thin needle rotates every second
3.A long needle rotates every minute
4.A short needle rotates every hour
5.All needles return to the original position after 12 hours
SYSTEM EXAMPLES
WASHING MACHINE
It is an automatic clothes washing SYSTEM
Parts: Status display panel, Switches & Dials, Motor,
Power supply & control unit, Inner water level sensor and
solenoid valve.
Rules
1.Wash by spinning
2.Rinse
3.Drying
4.Wash over by blinking
5.Each step display the process stage
6.In case interruption, execute only the remaining
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);
}
Definitions of Embedded Systems
• It is any device that includes a programmable computer but is
not itself intended to be a general purpose computer
•Embedded Systems are electronic systems that contains a
microprocessor or microcontroller ,but we do not think them as
computers-the computer is hidden or embedded in the system.
•An embedded system is a microcontroller-based, software-
driven, reliable, real time control system, autonomous,
or human- or network-interactive, operating on diverse physical
variables and in diverse environments, and sold into a
competitive and cost-conscious market.
•An embedded system is a system that has software embedded
into computer-hardware, which makes a system dedicated for
an application or specific part of an application or product or
part of a larger system.
• An embedded system is one that has dedicated purpose
software embedded in computer hardware.
•It is a dedicated computer based system for an application or
product. It maybe an independent system or a part of large
system. Its software usually embeds into a ROM (Read Only
Memory)
GENERAL PURPOSE vs EMBEDDED
SYSTEM
Characteristics
• Single Functioned
• Tightly Constrained
a) Cost
b)Size
c)Power
• Real Time and Reactive
• Complex Algorithms
• User Interface
ACQUIRE ANALYSE BEHAVE
• I/P-Sensors,switches
• Process-programs(analyse process using
microcontrollers or processors)
• O/P -Actuators,Displays,Alarms,Indicators
Examples
• Microwave oven
• Washing Machine
• Pace Maker
• DVD Player
• LCD Projector
• Aircraft
• Automation
• Vending Machine
Architecture
S/W
FPGA and ASIC
Memory
Components
CPU Actuators
A/D D/A
Sensors
Human i/f Diagnostics
Power,Cooling
Implementing Embedded system
• Hardware
Processing Element
Peripherals
a)i/p and o/p devices H/W
b)Interfacing Sensors and Actuators S/W
c)I/f Protocols Partioning
Memory Of
Bus Tasks
• Software
System Software
Application
PROCESSOR
• A Processor is the heart of the Embedded System.
• For an embedded system designer knowledge of
microprocessor and microcontroller is a must.
VARIOUS PROCESSOR
1. General Purpose processor (GPP)
Microprocessor
Microcontroller
2.Digital Signal Processor
3. Application Specific System Processor (ASSP)
COMPUTER HARDWARE
A Microprocessor
A Large Memory
(Primary and Secondary)
(RAM, ROM and caches)
Input Units
(Keyboard, Mouse, Scanner, etc.)
Output Units
(Monitor, printer, etc.)
Networking Units
(Ethernet Card, Drivers, etc.)
I/O Units
(Modem, Fax cum Modem, etc.)
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 embedded system may not need an RTOS.
EMBEDDED SYSTEM HARDWARE
EMBEDDED SYSTEM CONSTRAINTS
An embedded system is software designed to keep
in view three constraints:
– Available system memory
– Available processor speed
– The need to limit the power dissipation
What makes embedded systems different?
• Real-time operation
• size
• cost
• time
• reliability
• safety
• security
EMBEDDED SYSTEM -
CLASSIFICATIONS
EMBEDDED SYSTEM
GENERATION
COMPLEXITY & PERFORMANCE
EXECUTION BEHAVIOUR
TRIGGERING
• SED ON GENERATION
Fourth Generation:
– - advent of SOC, reconfigurable &
multicore processors
– - high performance, tight integration and
miniaturization µP
– - High performance RTOS for functioning
– Ex: smart phone, PDA etc.,
PROCESSOR
• A Processor is the heart of the Embedded
System.
• For an embedded system designer
knowledge of microprocessor and
microcontroller is a must.
Two Essential Units: Operations
Control Unit (CU), Fetch
Execution Unit (EU) Execute
30
MEMORY ARCHITECTURE:
− Harvard Memory Architecture: When a microcontroller
has a dissimilar memory address space for program &
data memory
Ex: 8051, PIC, AVR based microcontroller families
− Von-Neumann Architecture: When a microcontroller has
a common memory address space for program & data
memory
Ex: Motorola 68k
HARVARD VS VON-NEUMANN
• Complex Instruction Set Architecture (CISC) :
The CISC approach attempts to minimize the
number of instructions per program,
sacrificing the number of cycles per
instruction.
• Reduced Instruction Set Architecture (RISC):
RISC does the opposite, reducing the cycles
per instruction at the cost of the number of
instructions per program
Instruction Set Architecture
• CISC – Complex Instruction Set Computer
• RISC – Reduced Instruction Set Computer
RISC & CISC Architecture-example
Let's say we want to find the product of two numbers - one
stored in location 1:3 and another stored in location 4:2 and
store back the result to 1:3
CISC Approach:
MUL 1:3, 4:2
RISC Approach:
LOAD A, 1:3
LOAD B, 4:2
PROD A, B
STORE 1:3, A
RISC VS CISC – Comparison
Embedded System Design Life Cycle
Product Specification Phase
• Sales and Marketing Department take the
lead, R&D are not allowed(in general).
• Costumer Research Tour
• Common Vision of the Product
• Development Tools required to design the
product.
Tool Based Design Process – Mann’s
Model
Hardware / Software Partitioning
• Which Position in H/W and which in S/W.
• FPU (H/W) faster, Floating Point (S/W) slower.
• Laser Printer Algorithm
• Choice of CPU impacts the partitioning decision
Iteration and Implementation
• H/W and S/W team stop communication
• The Design can be extended in H/W or S/W
according to convenience.
• Evaluation using test code.
Detailed H/W and S/W design
• Getting the H/W and S/W done for the next
phase
H/W and S/W Integration
• Process of debugging and discovering.
• Discovering – If the S/W team understood the
H/W description.
• Big Endian/Little Endian problem
Debugging in Embedded System
• Three Requirements
Product Testing and Release
• Who does the testing? Not the designer
Maintenance and Upgrading
• Most of the embedded products are
maintained and upgraded.
EMBEDDED SYSTEM DESIGN PROCESS
Top–down -
bottom–up -
From
Start with
description of
components
the system to
to build a
concrete
system.
details.
Ref. “Computers as components: principles of embedded
computing system design” by Wayne Wolf
EMBEDDED SYSTEM DESIGN PROCESS
The major goals of the design to be considered are :
Manufacturing cost
Performance
Power consumption
Tasks which need to be performed at each step,
analyze the design at each step - meet
specification
refine the design - add details
verify the design - system goals
EMBEDDED SYSTEM DESIGN PROCESS
REQUIREMENTS
Informal descriptions gathered from the customer are known
as requirements
Requirements are refined into a specification to begin the
designing of the system architecture
Can be functional or non-functional requirements
Functional: Needed output as a function of input
Non-functional: performance, cost, physical size, weight,
and power consumption
EMBEDDED SYSTEM DESIGN PROCESS
REQUIREMENTS – EXAMPLE (GPS Navigation System)
Product Name GPS Navigation System
Purpose Consumer grade moving map for driving use
Inputs Power button two control button
Outputs Back-lit LCD Display 400x600
Functions Uses 5-receiver GPS system; three user-selectable
resolutions; always displays current latitude and longitude
Performance Updates screen within 0.25 seconds upon movement
Power 100mW
Cost 30 USD
Size And Weight 2” x 6” and 250 grams
EMBEDDED SYSTEM DESIGN PROCESS
SPECIFICATION
Requirements gathered is refined into a specification.
Specification serves as the contract between the customers
and the architects.
Specification is essential to create working systems with a
minimum of designer effort.
Specific, understandable and accurately reflect the customer’s
requirements.
EMBEDDED SYSTEM DESIGN PROCESS
SPECIFICATION - EXAMPLE (GPS Navigation System)
Specification would include details for several components:
Data received from the GPS satellite
Map data
User interface
Operations that must be performed to satisfy customer
requests
Background actions
EMBEDDED SYSTEM DESIGN PROCESS
ARCHITECTURE
The specification describes only the functions of the system
Implementation of the system is described by the Architecture
The architecture is a plan for the overall structure of the system.
It will be used later to design the components
The system block diagram may be refined into two block
diagrams - hardware and software
EMBEDDED SYSTEM DESIGN PROCESS
ARCHITECTURE - EXAMPLE (GPS Navigation System)
CPU
FRAME
BUFFER GPS
DISPLA
RECEIV
Y
MEMO ER
RY
PANEL
BUS I/O
SYSTEM DESIGN - HARDWARE
EMBEDDED SYSTEM DESIGN PROCESS
ARCHITECTURE - EXAMPLE (GPS Navigation System)
DATABA RENDERE
SE PIXELS
R
SEARCH
USER
POSITI
INTERFA TIMER
ON
CE
SYSTEM DESIGN - SOFTWARE
EMBEDDED SYSTEM DESIGN PROCESS
HARDWARE AND SOFTWARE COMPONENTS
The architectural description specify what components we need
The component design effort builds those components in
conformance to the architecture and specification
Includes both hardware and software modules
Some of the components will be ready-made (example :CPU,
memory chips)
EMBEDDED SYSTEM DESIGN PROCESS
HARDWARE AND SOFTWARE COMPONENTS - EXAMPLE
In the moving map, GPS receiver is a predesigned standard
hardware component.
Topographic software is a standard software module which uses
standard routines to access the database.
Printed circuit board are the components which needs to be
designed.
When creating these embedded software modules, ensure the
system runs properly in real time and that it does not take up
more memory space than allowed.
EMBEDDED SYSTEM DESIGN PROCESS
SYSTEM INTEGRATION
After the components are built, they are integrated
Bugs are typically found during the system integration
By debugging a few modules at a time, simple bugs can be
discovered
By fixing the simple bugs early, more complex bugs can be
discovered
Appropriate debugging facilities during design which can help
to ease system integration problems.
Automatic Chocolate Vending
Machine
Automatic Chocolate Vending
Machine
Components
Automatic Chocolate Vending
Machine
Functions
Automatic Chocolate Vending
Machine
Hardware
Automatic Chocolate Vending
Machine
Software
8051 ARCHITECTURE
FEATURES
8-bit CPU
4K bytes on-chip program memory (ROM)
128 bytes on-chip data memory (RAM)
32 I/O pins arranged as four 8-bit ports (P0 - P3)
32 general purpose registers each of 8-bit
Special Function Registers (SFRs) of 128 bytes
16-bit Program Counter
8-bit Processor Status Word (PSW) & Stack Pointer
Two 16-bit timer/counters : T0 and T1
Two external and three internal vectored interrupts
One full duplex serial I/O (UART)
PIN DIAGRAM
8051 Architecture
74
The ARM processor, like all RISC processors, uses a load-store architecture.
This means it has two instruction types for transferring data in and out of the
processor.
Load instructions copy data from memory to registers in the core, and
conversely the store instructions copy data from registers to memory.
There are no data processing instructions that directly manipulate data in
memory. Thus, data processing is carried out solely in registers.
Load and store instructions use the ALU to generate an address to be held in
the address register and broadcast on the Address bus.
Data enters the processor core through the data bus and the data may be an
instruction to execute or a data item.
ARM Architecture
Address register: It store the 32-bit memory address from which the
data/instruction to be accessed.
Incrementer: It increments the memory address so as to point to the next
instruction when required.
Data in and Data out registers: It is used as a buffer to store the 32-bit data
when read/write operation is performed from/into the memory
Instruction decoder and control unit:
The instruction decoder translates instructions before they are executed.
The operation in the processor is managed and controlled with the help of
signals generated to different components in the system from the control
unit.
Register bank:
Data items are placed in the register bank - a storage unit made up of 32-
bit registers.
Also it is used in arithmetic operations, intermediate variable storage,
temporary address storage.
ALU:
This unit performs the various arithmetic and logical operations on two
32-bits inputs.
The primary input comes from the register file using A bus, whereas the
other input comes from the barrel shifter using the B bus.
After passing through the ALU unit, the result is written back to the
register file using the ALU bus.
Status registers flags are modified by the ALU outputs.
Barrel shifter:
This is the unique and powerful feature of the ARM
processor which has the ability to shift the 32-bit binary
pattern in one of the source registers left or right by a
specific number of positions before it enters the ALU.
This shift increases the power and flexibility of many data
processing operations and it is useful for loading constants
into a register to achieve fast multiply/division by a power
of 2.
Multiply register:
This unit performs the operation known as multiply-
accumulate (MAC), a fundamental operation in many
computing devices, especially in Digital Signal
Processing (DSP) application.
MAC unit operates in two stages, firstly it computes the
product of given numbers and forward the result for the
second stage operation i.e. addition/accumulate.
Any operation’s result can be written back to the register
bank, or if the instruction needs memory access, the result
is sent to the address register.
Registers
• General Purpose registers hold either data or address
• All registers are of 32 bits
• In user mode 16 data registers and 2 status registers
are visible
• Data registers: r0 to r15
– Three registers r13, r14, r15 perform special functions
– r13: stack pointer
– r14: link register ( where return address is put whenever a
subroutine is called)
– r15: program counter
REGISTERS
• The ARM processor has three registers assigned to a
particular task or special function: r13, r14, and r15.
• Register r13 is traditionally used as the stack pointer
(sp) and stores the head of the stack in the current
processor mode.
• Register r14 is called the link register (lr) and is where
the core puts the return address whenever it calls a
subroutine.
• Register r15 is the program counter (pc) and contains
the address of the next instruction to be fetched by the
processor.
Registers
• Depending upon context, registers r13 and r14
can also be used as GPR
• Any instruction which use r0 can as well be
used with any other GPR (r1-r13)
• In addition, there are two status registers
– CPSR: current program status register
– SPSR: saved program status register
Registers
PIC Architecture
• Peripheral Interface Controller (PIC) is
microcontroller developed by Microchip,
PIC microcontroller is fast and easy to
implement program when we compare
other microcontrollers like 8051.
• The ease of programming and easy to
interfacing with other peripherals PIC
became successful microcontroller.
Memory of the PIC is divided into 3 types of memories:
• Program Memory - A memory that contains the
program(which we had written), after we've burned it. As a
reminder, Program Counter executes commands stored in
the program memory, one after the other.
• Data Memory – This is RAM memory type, which
contains a special registers like SFR (Special Function
Register) and GPR (General Purpose Register). The
variables that we store in the Data Memory during the
program are deleted after we turn of the micro.
• These two memories have separated data buses, which
makes the access to each one of them very easy.
• Data EEPROM (Electrically Erasable Programmable
Read-Only Memory) - A memory that allows storing the
variables as a result of burning the written program.
• Each one of them has a different role.
• Program Memory and Data Memory two memories that
are needed to build a program, and Data EEPROM is
used to save data after the microcontroller is turn off.
• Program Memory and Data EEPROM they are non-
volatile memories, which store the information even after
the power is turn off. These memories called Flash Or
EEPROM.
• In contrast, Data Memory does not save the information
because it needs power in order to maintain the
information stored in the chip.
RAM
RAM (Random Access Memory) which is a volatile memory
used for storing the data temporarily in its registers.
RAM memory is divided in to Banks, in each banks we
have number of registers.
The RAM registers is divided into 2 types. They are
General purpose registers (GPR) and Special purpose
registers (SPR).
Three important SFRs:
1.Status Register: Changes the bank
2.Port Register: Assigns logic values 0 or 1 to the ports
3.TRIS Register: Data direction register for input and output
Architecture
CPU
• CPU is not different from other microcontrollers CPU.
• PIC microcontroller CPU consists of Arithmetic logic unit
(ALU), memory unit (MU), control unit (CU), Accumulator
etc.
• RISC has very few instructions (approx. ~ 35) which are
used in the program.
• Length of the instruction is small and fixed and takes
same amount of time for processing.
• As the instruction is small it will take less time to process
another words CPU will be fast.
• Compiler need not be complex and debugging will be
very easy in the programmer point of view.
I/O Ports
• Port A: It is a 16-bit port, which can be used as an input
or output port based on the status of the TRISA register.
• Port B: It is an 8-bit port, which can be used as both an
input and output port.
• Port C: It is an 8-bit port whose operation (input or
output) is determined by the status of the TRISC
register.
• Port D: It is an 8-bit port, which apart from being an I/O
port, acts as a slave port for connection to the
microprocessor bus.
• Port E: It is a 3-bit port that serves the additional
function of the control signals to the A/D converter.
Timers
PIC microcontrollers consist of 3 timers, out
of which the Timer 0 and Timer 2 are 8-bit
timers and the Time-1 is a 16-bit timer,
which can also be used as a counter.
A/D Converter
The PIC Microcontroller consists of 8-
channels, 10-bit Analog to Digital Converter.
The operation of the A/D converter is
controlled by these special function
registers: ADCON0 and ADCON1.
Oscillators
• Oscillatorsare used for timing generation. PIC
microcontrollers consist of external oscillators like
crystals or RC oscillators. In the case of crystal
oscillators, the crystal is connected between two
oscillator pins, and the value of the capacitor connected
to each pin determines the mode of operation of the
oscillator. The different modes are low-power mode,
crystal mode, and the high- speed mode. In the case of
RC oscillators, the value of the Resistor and Capacitor
determines the clock frequency. The clock frequency
ranges from 30 kHz to 4 MHz.
CCP Module
A CCP module works in the following three modes:
• Capture Mode: This mode captures the time of arrival of
a signal, or in other words, captures the value of the
Timer when the CCP pin goes high.
• Compare Mode: It acts as an analog comparator that
generates an output when the timer value reaches a
certain reference value.
• PWM Mode: It provides pulse width modulated output
with a 10-bit resolution and programmable duty cycle.
• Watchdog timer that resets the microcontroller in case of
any software malfunction.
PIC Microcontroller Advantages
• Interfacing of an analog device is easy
without extra circuitry.
• When compared to other microcontrollers,
power consumption is very low, and
programming is very easy.
• It is consistent and faulty of PIC
percentage is very low. Using RISC
architecture the performance is high-
speed.
Thank You