0% found this document useful (0 votes)
33 views52 pages

Introduction To Embedded Systems S2024

The document outlines a course on Embedded Systems at Taif University, covering hardware and firmware architecture, microcontrollers, and their applications, including IoT. It details course objectives, learning outcomes, required textbooks, and assessment methods. Key topics include interfacing, real-time systems, and various embedded system applications in fields like medical, automotive, and consumer electronics.

Uploaded by

gweer078878
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views52 pages

Introduction To Embedded Systems S2024

The document outlines a course on Embedded Systems at Taif University, covering hardware and firmware architecture, microcontrollers, and their applications, including IoT. It details course objectives, learning outcomes, required textbooks, and assessment methods. Key topics include interfacing, real-time systems, and various embedded system applications in fields like medical, automotive, and consumer electronics.

Uploaded by

gweer078878
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Taif University

Department of Computer Engineering


EMBEDDED SYSTEMS
Spring 2025
Lecture- 1

Introduction

1
Course Description

This course introduces students to the fundamentals


of the hardware and firmware architecture of
embedded systems and their applications. It includes
a comprehensive overview of the PIC and AVR
microcontrollers, their architecture, interfacing,
programming, and usage. In addition, the course
provides students with an insight of embedded
systems, real-time operating systems, development
boards, sensors and actuators, embedded systems in
real time, and embedded systems applications (IoT).

2
Course Main Objective(s):

1. Understand embedded systems and their architecture.

2. Understand the architecture and interfacing of


microprocessor/microcontroller in embedded systems.

3. Use common microcontrollers in embedded systems.

3
Course Learning Outcomes (CLOs)
1 Knowledge and Understanding
1.1 Describe the basics and architecture of an embedded K1
system.
1.2 Describe the basics and architecture of common K1
microcontrollers.

2 Skills:
2.1 Design embedded systems and real-time systems to S1
solve real life engineering problems.

2.2 Experiment microcontrollers in embedded systems. S3

4
- Embedded System Design: A Unified
Hardware/Software Introduction- Frank Vahid and
Tony Givargis, John Wiley & Sons; ISBN: 0471386782.
2002
Required Textbooks
- Microcontroller Theory and Applications with the
PIC18F, M. Rafiquzzaman, Wiley; 2nd edition
(January 11, 2018), ISBN-10 : 1119448417, ISBN-13
: 978-1119448419
- Edward Ashford Lee, Sanjit Arunkumar Seshia `
Introduction to -Embedded Systems - A Cyber-
Physical Systems Approach` Publisher: UC Berkeley
Essential 1st Edition 2013
References - Exploring Arduino “Tools and Techniques for
Materials Engineering Wizardrye” by Jeremy Blum 2019, ISBN
1119405351 Ed John Wiley and Sons.

5
Course Topics
1. Introduction and Overview of Embedded Systems and
MicroControllers
2.
Interfacing: Interrupts - Communication and protocols
3.
Embedded System memory and peripherals
4.
PIC Microcontrollers
5.
Midterm-exam
6.
AVR MicroControllers
7.
Development boards – Arduino
8.
Sensors and Actuators
9.
Real-time Embedded Systems - Operating Systems and Design
10.
Wireless and Internet Embedded Systems: IoT (If time permits)
6
Assessment & Grading Policy
Assessment timing Percentage of Total
No Assessment Activities *
(in week no) Assessment Score

1. Lab Exam 14 15%


2. Midterm Exam 7 20%
3. Assignments Continues 5%
4. Quizzes Continues 10%
5. Project 15 10%
6. Final Exam 16 40%
7
Embedded Systems 503432-3

This course integrates both


software and hardware
knowledge

8
Embedded System Definitions

•An embedded system is a special-purpose


system in which the computer is
completely encapsulated by or dedicated
to the device or system it controls.

•An embedded systems is a combination of


hardware and software which together
form a component of a larger machine.

Source: www.computeruser.com/resources/dictionary

9
Introduction to Embedded Systems
➢ An embedded system is designed to run on
its own without human intervention, and may
be required to respond to events in real time.

➢ An embedded system very often is physically


built-in to the device it is controlling.

➢ The software written for embedded systems


is often called firmware, and is stored in read-
only memory or Flash memory chips rather
than a disk drive.
10
Introduction to Embedded Systems
• Since the system is dedicated to specific
tasks, design engineers can optimize it,
reducing the size and cost of the product.

• Typical Embedded Systems are designed to


observe (through sensors) and control
something (through actuators).
E.g. air condition senses room temperature and
maintains it at set temperature via thermostat.
11
Introduction to Embedded Systems

12
Embedded System’s General Block Diagram
Software

Microcontroller
in some systems

PROCESSOR
MEMORY

Peripherals:
Application-specific logic
• Timers
• A/D and D/A conversion
•I/O Interfacing

EMBEDDED SYSTEM
Main Components of Embedded Systems
• Analog Components
• Sensors, Actuators, Controllers, …
• Digital Components
Hardware
• Processor, Coprocessors
• Memories
• Controllers, Buses
• Application Specific Integrated Circuits (ASIC)
• Converters – A2D, D2A, …

• Software Software
• Application Programs
• Exception Handlers
14
Embedded Systems Processors

➢ Microprocessors are usually used for PCs.

➢ For embedded systems: Embedded


processors or Microcontrollers:
▪ Often with lower clock speeds
▪ Integrated with memory and I/O devices e.g. A/D
D/A PWM CAN
▪ Higher environmental specs

15
Types of Embedded Processors
➢ Computational micros (32- or 64-bit datapaths)
• CPU of workstations, PCs, or high-end portable devices (PDAs)
• x86, PA-RISC, PowerPC, SPARC, etc.
➢ Embedded general purpose micros (32-bit datapaths)
• Designed for a wide range of embedded applications
• Often scaled-down version of computational micros
• ARM, PowerPC, MIPS, x86, 68K, etc.
➢ Microcontrollers (4-, 8-, or 16-bit datapaths)
• Integrate processing unit, memory, I/O buses, and peripherals
• Often low-cost, high-volume devices
➢ Domain-specific processors (datapath size varies greatly)
• Designed for a particular application domain
• Digital signal processors, multimedia processors, graphics
processors, network processors, security processors, etc.
Slide credit - Mike Schulte
16
Microcontroller
❑Processor – Instruction Set + memory + accelerators
❑Memory
❖ Non-Volatile
oROM
oEPROM, EEPROM, Flash
❖ Volatile
oRAM (DRAM, SRAM)
❑Peripherals: Timers, A/D, Comparators, ..etc.
❑Interfaces
❖ H/W: Ports
❖ S/W: Device Driver
❖ Parallel, Serial, Analog, Time
❑I/O
• Memory-mapped vs. I/O-instructions (I/O-mapped)
Some 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 system’s
environment
• Must compute certain results in real-time without delay
Slide credit Vahid/Givargis, Embedded Systems Design: A Unified Hardware/Software Introduction, 2000
18
Real-Time Consideration

•Correct operation of real-time systems


means:
•Working correctly (functionally correct)
•Producing outputs in time!
•i.e. correct result at the right time

19
An Embedded System Example
• Digital Camera
Digital camera chip
CCD

CCD preprocessor Pixel coprocessor D2A


A2D

lens

JPEG codec Microcontroller Multiplier/Accum

DMA controller Display ctrl

Memory controller ISA bus interface UART LCD ctrl

• Single-functioned -- always a digital camera


• Tightly-constrained -- Low cost, low power, small, fast
• Reactive and real-time -- only to a small extent
Embedded systems from real life
Mobile Phones and Base Stations
• Multiprocessor
• 8-bit/32-bit for UI; DSP for signals
• 32-bit in IR port; 32-bit in Bluetooth
• 8-100 MB of memory
• All custom chips

• Massive signal processing


• Several processing tasks per connected call
• Based on DSPs
• Standard or custom
• 100s of processors
Embedded systems from real life
• Multiple processors • Multiple networks
Cars • Up to 100 • Body, engine, telematics, media,
safety
• Networked
together ◼ Functions by embedded
processing:
◼ Large diversity in processor
❑ ABS: Anti-lock braking
types:
systems
❑ 8-bit – door locks, lights, etc.
❑ ESP: Electronic stability
❑ 16-bit – most functions
control
❑ 32-bit – engine control,
❑ Airbags
airbags
❑ Efficient automatic

gearboxes
❑ Theft prevention with smart

keys
❑ Blind-angle alert systems

❑ ... etc ...


Application Areas
• Medical Systems • Automobiles
• pace maker, patient • engine management, trip
monitoring systems, injection computer, cruise control,
systems, intensive care units, immobilizer, car alarm,

• airbag, ABS, ESP, …
• Office Equipment
• printer, copier, fax, … • Building Systems
• Tools • elevator, heater, air
• multimeter, oscilloscope, line conditioning, lighting, key
tester, GPS, … card entries, locks, alarm
systems, …
• Banking
• ATMs, statement printers, … • Agriculture
• Transportation • feeding systems, milking
• (Planes/Trains/[Automobiles] systems, …
and Boats) • Space
• radar, traffic lights, signaling • satellite systems, …
systems, …
A “short” list of Embedded Systems
• Auto focus cameras • Network cards
• ATMs • Pagers
• Avionic systems • PDAs
• Automatic transmission • Photocopiers
• Battery Chargers • Portable Video games
• Camcorders • Pont of Sales terminals
• Cell phones • Printers
• Cordless Phones • Scanners
• Digital Cameras • Satellite phones
• DVD players • Teleconferencing systems
• Electronic Toys/Games • Televisions
• Fax machines • Set-top boxes
• Medical Equipment • VCR’s
• Microwave ovens • Video phones
• Modems • Washers and dryers
and many more ….
Types of Embedded Systems

Slide credit P Koopman, CMU 25


Embedded Systems Architecture:
Harvard vs Von-Neumann
• There are two computer architectures, which are different in the
way of accessing memories: von Neumann Architecture (also
names “ Princeton Architecture”) and Harvard Architecture.

Organization of program and data memory


Harvard vs Von-Neumann
Harvard Architecture

address
Program
Memory
data PE
(Processing Element)
address
Data
data
Memory

Von-Neumann Architecture

address
PE
Read/Write (Processing Element)
Memory data

27
Harvard vs Von-Neumann
Harvard: Von Neumann:
• Two memories with two Buses • Content of the memory if organized
allow parallel access to data and all installed memory can be
access and instructions. used.
• Control unit for two buses is • One bus is simpler for the control
more complicated and more unit design
expensive. • Computer with one bus is cheaper.
• Program can’t write itself. • Error in a program can rewrite
• Both memories can use instruction and crash program
different sizes. execution.
• Development of a complicated • Development of the Control Unit is
Control Unit needs more time. cheaper and faster.
• Data and instruction is accessed in
• Free data memory can’t be
the same way.
used for instruction and vice-
versa. • One Bus ( for Data, instruction and
devices) is a bottleneck. 28
Harvard vs Von-Neumann

➢ Harvard architecture is used primary for


small embedded computers and signal
processing (DSP).

➢ Von-Neumann is better for desktop


computers, laptops, workstations and high
performance computers.

29
Embedded system functionality aspects
➢ Processing
• Transformation of data
• Implemented using processors

➢ Storage
• Retention of data
• Implemented using memory

➢ Communication
• Transfer of data between processors and memories
• Implemented using buses
• Called interfacing
30
Processing
Microcontrollers vs. Microprocessors

➢ Microprocessor
▪ CPU (on single chip)

➢ Microcontroller
▪ CPU
▪ RAM + ROM
▪ I/O
▪ Timers
▪ Other devises such as Analog-to-digital converter.

31
Overview of Microcontrollers

• Basically, a microcontroller is a device which integrates a


number of the components of a microprocessor system onto a
single microchip.
32
Microcontroller Benefits and Limitations

▪ Benefits
➢Typically low-power/low-cost
➢Easily programmable

▪ Limitations
➢Small storage space (registers, memory)
➢Restricted instruction set
➢Not typically used for high performance

33
Microcontroller Packaging and Appearance

From left to right: PIC 12F508, PIC 16F84A, PIC


16C72, Motorola 68HC05B16, PIC 16F877,
Motorola 68000
Dr. Sarhan 34
Microcontroller Programming

•Programming can be done in several languages,


such as Assembly, C and BASIC.

•Assembly belongs to lower level languages that


is programmed slowly, but takes up the least
amount of space in memory and gives the best
results.

•Programs in C language is easier , but executes


slower than assembly programs.
35
List of Common Microcontrollers
1 Altera
2 Analog Devices 19 Nuvoton Technology
3 Atmel 20 Panasonic
4 Cypress Semiconductor 21 Parallax
5 Maxim Integrated 22 Rabbit
Semiconductor
6 ELAN Microelectronics Corp. 23 Renesas Electronics
7 EPSON Semiconductor 24 Rockwell
8 Freescale Semiconductor 25 Silicon Laboratories
9 Fujitsu 26 Silicon Motion
10 Holtek 27 Sony
11 Hyperstone 28 Spansion
12 Infineon 29 STMicroelectronics
13 Intel 30 Texas Instruments
31 Toshiba
14 Lattice Semiconductor 32 Ubicom
15 Microchip Technology 33 Xemics
16 National Semiconductor 34 Xilinx
17 NEC 35 XMOS
18 NXP Semiconductors 36 ZiLOG

36
Microcontroller choice parameters
• Number of I/O pins (Analog/Digital)
• Amount of program and data memories
• Speed
• Timer Resources
• Interrupt control
• Robustness
• Error recovery – watchdog timers
• Power
• I/O expansion
• Math support.
37
Storage
• What is a memory?
• Artifact that stores bits
• Storage fabric and access logic
• Write-ability
• Manner and speed a memory can be written
• Storage-permanence
• ability of memory to hold stored bits after they
are written
• Many different types of memories
• Flash, SRAM, DRAM, etc.
• Common to compose memories
38
38
Communication
➢ What is a bus?
• An artifact that transfers bits
• Wires, air, or fiber and interface logic

➢ Associated with a bus, we have:


• Connectivity scheme
oSerial Communication
oParallel Communication
oWireless Communication
• Protocol
oPorts
oTiming Diagrams
oRead and write cycles
• Arbitration scheme, error detection/correction,
DMA, etc.
39
39
Peripherals in Embedded Systems
• In addition to the processor and memory, most
embedded systems contain a handful of other
hardware devices.

• Some of these devices are specific to each


embedded system’s application domain, while
others—such as timers/counters and serial
ports—are useful in a wide variety of systems.
Peripherals in Embedded Systems

• The most commonly used devices are often


included within the same chip as the
processor and are called internal, or on-chip,
peripherals.

• Hardware devices that reside outside the


processor chip are, therefore, said to be
external peripherals.
Peripherals in Embedded Systems

• An embedded processor interacts with a


peripheral device through a set of control and
status registers.

• These registers are part of the peripheral


hardware, and their locations, size, and
individual meanings are features of the
peripheral.

42
Peripherals in Embedded Systems

Some common internal (on-chip) peripherals:


▪ Timers
▪ Watchdog timers
▪ Serial communications: UART (RS-232C), SPI,
I2C, CAN.
▪ Tri-state digital I/O pins
▪ ADC
▪ PWM
Peripherals in Embedded Systems

Some common external peripherals:

• LCD, keyboard controllers, A/D converters,


network interface chips.

44
Timers
The timer module, which is strictly speaking a counter
module, is an important part of every microcontroller,
Peripherals in Embedded Systems

and most controllers provide one or more timers with 8


and/or 16 bit resolution.
Timers are used for a variety of tasks ranging from
simple delays over measurement of periods to
waveform generation.

The most basic use of the timer is in its function as a


counter, but timers generally also allow the user to
timestamp external events, to trigger interrupts after a
certain number of clock cycles, and even to generate
pulse-width modulated signals for motor control. 45
Counters

• Counter: like a timer, but counts pulses


Peripherals in Embedded Systems

on a general input signal rather than


clock
• e.g., count cars passing over a sensor
• Can often configure device as either a timer or
counter

46
46
Watchdog Timer
• The watchdog timer, also sometimes called COP
(computer operates properly), is used to monitor
Peripherals in Embedded Systems

software execution. The basic idea behind this timer


is that once it has been enabled ,it starts counting
down.
• When the count value reaches zero, a reset is
triggered, thus reinitializing the controller and
restarting the program.
• To avoid this controller reset, the software must
reset the watchdog before its count reaches zero.
• Must reset timer every X time unit, else timer
generates a signal
• Common use: detect failure, self-reset.
47
47
Pulse Width Modulator (PWM)

• Generates pulses with specific


Peripherals in Embedded Systems

high/low times
• Duty cycle: % time high
• Square wave: 50% duty cycle
• Common use: control average
voltage to electric device
• Simpler than DC-DC converter or digital-analog
converter
• Applications: DC motor speed, dimmer lights.

48
48
UART
• UART: Universal Asynchronous
Receiver Transmitter:
Peripherals in Embedded Systems

• Takes parallel data and transmits serially


• Receives serial data and converts to
parallel
• Parity: extra bit for simple error checking
• Start bit, stop bit
• Baud rate
• Signal changes per second
• Bit rate, sometimes different

49
49
LCD

• Liquid Crystal Display


Peripherals in Embedded Systems

• N rows by M columns
• Controller build into the
LCD module
• Simple microprocessor
interface using ports
• Software controlled

50
50
Keypad
N1
Peripherals in Embedded Systems

N2
N3 k_pressed
N4

M1
M2
M3
M4 4
key_code key_code

keypad controller

51
N=4, M=4

51
52
Peripherals in Embedded Systems
ADC

ADC Block Diagram

You might also like