0% found this document useful (0 votes)
19 views

Chapter 1

Uploaded by

maruchekole455
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Chapter 1

Uploaded by

maruchekole455
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 47

REAL TIME AND

EMBEDDED
SYSTEMS

CHAPTER ONE:
UNDERSTANDIN
G EMBEDDED
SYSTMES

BY: GEMMACHIS (MSc)


CCI
HU
CHAPTER CONTENTS
1. What is Embedded Systems
2. Some Examples of Embedded Systems
3. Some Computer Essentials
4. Microprocessors and Microcontrollers
5. Microchip and the PIC Microcontrollers
6. An Introduction to PIC Microcontrollers
using the baseline series
What is Embedded
 We are livingSystems?
in the world of
Embedded systems.
 You are surrounded with many
Embedded products and
your daily life largely depends
on the proper functioning of
these gadgets.
 Examples:
 Television, Radio, CD
player of your Living room,
washing machine or
Microwave Oven in your
kitchen, Card Readers,
Access controllers, Palm
devices of your workspace
enable you to do many of
your tasks very
Where can we find Embedded
Systems?
Embedded System Definition
 An embedded system is a special-purpose computer
system which resides inside the device or equipment it
manages or controls.
 They are devices used to control, monitor or assist the
operation of equipment, machinery or plant.
 “Embedded” reflects the fact that they are an integral
part of the system.
 In many cases, their “embeddedness” may be such that
their presence is far from obvious to the casual observer.

Institute of Electrical and Electronic Engineering


(IEEE)
Cont’d…
 An embedded system is a special-purpose computer
system designed to perform one or a few dedicated
functions, often with real-time computing constraints.
 It is usually embedded as part of a complete device
including hardware and mechanical parts.
 In contrast, a general-purpose computer, such as a
personal computer, can do many different tasks
depending on programming.
 Embedded systems control many of the common
devices in use today.

Wikipedia
Cont’d…

 A precise definition of embedded systems is not


easy. Simply stated, all computing systems other than
general purpose computer (with monitor, keyboard, etc.)
are embedded systems.
 An embedded system is a system that has software
embedded into hardware, which makes a system
dedicated for an application (s) or specific part of an
application or product or part of a larger system.
 It processes a fixed set of pre-programmed instructions
to control electromechanical equipment which may be
part of an even larger system (not a computer with
keyboard, display, etc).
Basic idea…
 If we take any engineering product that needs control,
and if a computer is incorporated within that product
to undertake the control, then we have an embedded
system.
 An embedded system can be defined as:
 A system whose principal function is not
computational, but which is controlled by a
computer embedded within it.
Some Examples of Embedded
Systems
a. The domestic refrigerator
b. A car door mechanism
c. The electronic ‘ping-pong’ game
d. The Derbot Autonomous Guided Vehicle
Some computer Essentials

 Elements of a computer
 Instruction sets
 The Complex Instruction Set Computer and
 The Reduced Instruction Set Computer
 Memory types
 Organizing memory
Elements of a Computer
Instruction Set – CISC and RISC

 A CISC has many instructions and considerable


sophistication.
 complexity  slow operation.
 One characteristic of the CISC approach is that
instructions have different levels of complexity.
 Simple ones can be expressed in a short
instruction code, say one byte of data, and
execute quickly.
 Complex ones may need several bytes of
code to define them and take a long time to
execute.
Instruction Set – CISC and RISC
 Another approach is the RISC – simple design
 to keep the CPU very simple and limited
instruction set.
 This leads to fast operation.
 RISC each instruction is contained within a
single binary word.
 That word must hold all information necessary,
including the instruction code, address or data
information
 RISC every instruction normally takes the same
amount of time to execute.
Memory Types

 Volatile
 This is memory that only works as long as it
is powered. It loses its stored value when
power is removed but can be used as
memory for temporary data storage. A
slightly more descriptive name is simply
‘data memory’. (RAM)
 Non-volatile
 This is memory that retains its stored value
even when power is removed.
 A more descriptive name is ‘program
memory’. (ROM)
Organizing Memory
Microprocessors and Microcontrollers

WHICH STATEMENT IS TRUE?


Statement Number 1:
“A microprocessor has a
microcontroller.”

Statement Number 2:
“A microcontroller has a
microprocessor.”
Microprocessors
 The first microprocessors appeared in the
1970s.
 CPU onto a single IC.
 Significant processing power was available at rather
low cost, in a comparatively small space.
 At first, memory and input/output interfacing,
were outside the microprocessor.
 Gradually, the microprocessor became more
self-contained.
 CPU was becoming more powerful and faster.
 Moved rapidly from 8-bit to 16- and 32-bit devices.
 The development of the microprocessor led very
directly to applications like the personal computer.
Microcontrollers

 People also saw another use for microprocessor,


and that was in control.
 Designers started putting microprocessors into
all sorts of products that had nothing to do with
computing.
 The need was not necessarily for high computational
power, huge quantities of memory, or very high
speed.
 A special category of microprocessor emerged that
was intended for control activities, not for crunching
big numbers.
 After a while this type of microprocessor gained
an identity of its own, and became called a
‘microcontroller’.
Cont’d…

What distinguishes a microcontroller from a


microprocessor?
Like a microprocessor, a microcontroller needs to be able to
compute, not necessarily with big numbers.
Primarily, it must have excellent input/output capability, for
example so that it can interface directly with the ins and
outs of the fridge or the car door.
Because many embedded systems are both size- and cost-
conscious, the microcontroller must be small, self-contained
and low cost.
The microcontroller may need to put up with the harsh
conditions of the industrial or motor car environment, and
be able to operate in extremes of temperature.
Cont’d…
Microcontroller vs Microprocessor
Comparison

CHARACTERISTICS PROCESSOR MICROCONTROLLER

APPLICATIONS GENERAL COMPUTING SPECIALIZED DEVICES

SPEED VERY FAST RELATIVELY SLOW

EXTERNAL PARTS MANY FEW

COST HIGH LOW

ENERGY USE MEDIUM TO HIGH VERY LOW TO LOW


ATMEL, MICROCHIP,
VENDORS INTEL, AMD TEXAS INTRUMENTS
Microcontroller Families
 There are thousands of different microcontroller types in the
world today, made by numerous different manufacturers.
 A manufacturer builds a microcontroller ‘family’ around a
fixed microprocessor core.
 Different family members are created by using the same
core, including with it different combinations of peripherals
and different memory sizes.
 To each core are added different combinations of peripherals
and memory size, to make a number of family members.
 Because the core is fixed for all members of one family, the
instruction set is fixed and users have little difficulty in
moving from one family member to another.
Cont’d…
Microcontroller Packaging
and Appearance
 Integrated circuits are made in a number of different forms,
usually using plastic or ceramic as the packaging material.
 Interconnection with the outside world is provided by the pins on
the package.
 What determines the size of particular microcontroller, is the
number of interconnection pins provided on the IC and their
spacing.
 A microcontroller is usually input-/output-intensive so it is
reasonable then to assume that a good number of pins will be
used for input/output.
 Example:
Motorola 68000
 64-pin Microcontroller
 Its package is a dual-in-line package (DIP)
Cont’d…
Different types of packaging options
are:
Examples
Microchip and PIC Microcontroller
 Originally  a design of General Instruments (GI)
 It was intended for simple control applications
 PIC – Peripheral Interface Controller
 In the late 1970s General Instruments produced the PIC
1650 and 1655 processors
 Trademark characteristics:
 Simplicity, stand-alone, high speed and low cost
 General Instruments sold off its semiconductor division to a group
of venture capitalists
 1990s – range of available PIC grew
 Microchip made their development tools simple and low-cost or
free.
 It stayed for a long while firmly entrenched in the 8-bit world.
 It has only been in the past few years that they have branched out beyond
PIC 8-bit microcontrollers today

 There are hundreds of different devices, offered in


different packages, for different applications.
 Some characteristics that all of these have in common
are:
 All 8-bit PIC microcontrollers are low-cost, self-contained,
pipelined, RISC, use the Harvard structure, have a single
accumulator (the Working, or W, register), with a fixed
reset vector.
Cont’d…
 Today, Microchip offer 8-bit microcontrollers with four different
prefixes, 10-, 12-, 16-, and 18-
 For example 10F200, or 18F242.
 We shall call each of these a ‘Series’, for example ‘12 Series’, ’16
Series’, ‘18 Series’.
 A 17 Series has been discontinued; a few are still sold, but most will
only be found in legacy systems.
 Each Series is identified by the first two digits of the device code.
 The alphabetic character that follows gives some indication of the
technology used.
 The ‘C’ insert implies CMOS technology, where CMOS stands for
Complementary Metal Oxide Semiconductor, and the leading
semiconductor technology for implementing low-power logic systems.
Cont’d…
 The ‘F’ insert indicates incorporation of Flash memory
technology (still using CMOS as the core technology).
 An ‘A’ after the number indicates a technological
upgrade on the first issue device.
 An ‘X’ indicates that a certain digit can take a number of
values, the one taken being unimportant to the overall
number quoted.
 For example,
 the 16C84 was the first of its kind.
 It was later reissued as the 16F84, incorporating Flash
memory technology.
 It was then reissued as the 16F84A, with certain further
technological upgrades.
Cont’d…
 We can categorize them into three distinct groups.
Using Microchip terminology, we shall refer to
each of these groups as ‘families’.
The baseline family of PIC
microcontrollers
 The baseline PIC microcontroller family represents the most direct
descendant of the General Instruments ancestors, and displays
the core features of the original PIC design.
 The first Microchip baseline microcontrollers were coded 16C5X,
following the General Instruments 1650 and 1655 numbering
 With only a two-level stack and no interrupts, there are real limits to
the program and hardware complexity that can be developed.
 Baseline devices are ideal for really tiny applications, being
packaged in small ICs.
 Despite their small size and simple architecture, baseline
microcontrollers carry some interesting peripherals, including
analog-to-digital converters and EEPROM (Electrically Erasable
Programmable Read-Only Memory) data memory.
The PIC mid-range family
 The mid-range family contains several simple but important
developments, when compared to the baseline devices.
 Interrupts (albeit with a single interrupt vector) are
introduced and the stack size is increased.
 The instruction set is a slight extension of the baseline set.
 The introduction of interrupts allows interfacing both with
more sophisticated peripherals and with larger numbers of
peripherals.
 Mid-range devices include all of the 16 Series except those
coded 16C5XX or 16F5XX, and some of the 12 Series.
 A very wide range has been developed, with many different
peripherals and technical enhancements.
 The larger devices, with multiple peripherals and significant
on-chip memory, are both powerful and versatile.
The High Performance Family
 In this family Microchip has come to grips with some of the
issues of sophisticated processors.
 The instruction set is significantly increased, now to 75
instructions, and is designed to facilitate use of the C
programming language.
 In certain versions there is also an ‘extended’ instruction
set, with a further small set of instructions.
 There are two interrupt vectors, which can be prioritized.
 The high-performance family is made up of 18 and above
Series microcontrollers.
 It is a powerful family and new members are continuously
being added to the range.
An Introduction to PIC
Microcontrollers using the
Baseline Series
 The pin connection diagram of the PIC 12F508/509 is shown in Figure
below.
 The only difference between the 508 and 509 is that the latter has
slightly larger program and data memories.
The architecture of the
12F508/509
Cont’d…
 The CPU, enclosed in a dotted line bottom right, is made up essentially
of the ALU, the Working register (W Reg) and the Status register. This
register carries a number of bits that give information on the outcome of
the instruction most recently carried out.

 A multiplexer (MUX) selects from two sources which data is presented


to the ALU.

 The data memory is just 25 bytes for the 508 or 41 for the 509. Notice
that Microchip call the RAM memory locations ‘file registers’ or
elsewhere just ‘registers’.

 Program memory appears top left, with 512 12-bit words for the
12F508 or 1024 for the 509.
Cont’d…
 A distinctive feature of the PIC architecture is that it is Harvard structure.
 We should therefore be able to find two address buses (one for program
memory, and the other for data memory and all peripherals) and two data
buses (again, one for program memory, and one for data memory and
peripherals).
 The easiest to find is the data bus for data memory and peripherals.
 This is simply labeled ‘data bus’ and is seen to the right of the diagram. It
is 8-bit, and primarily serves the data memory, the General-Purpose
Input/Output (GPIO) and the ‘Timer 0’ peripheral.
 The address bus for data memory is labeled ‘RAM Addr’ and feeds into
the RAM data memory.
 It is derived from the address multiplexer (‘Addr MUX’), which selects the
address from one of two sources.
Cont’d…
 The program address bus arises from the Program
Counter and goes only to the program memory, as
shown.
 It is 12-bit, and hence can address 212 memory
locations, or 4096 locations.
 As the program memory itself is given as only 512 or
1024 words, we recognize that the address bus is larger
than necessary for this memory size.
 Coming from the program memory we see the 12-bit
‘Program bus’.
 This carries the instruction words from the memory to
the ‘Instruction register’.
Cont’d…
 This microcontroller has only two on-chip peripheral devices,
a Timer (‘Timer 0’) and the General-Purpose
Input/Output port, with pins GP0 to GP5.
 The IC pins themselves appear in the block diagram as
squares with crosses inside.
 Each of these pins is dual or triple function, so each has a
second function identified in the diagram.
 Towards the bottom left of the diagram are a number of
functions relating to the clock oscillator, power
supply and reset.
 Power supply and ground are connected via pins VDD and
VSS respectively.
Cont’d…
 A ‘Power-on Reset’ function detects when power is applied and
holds the microcontroller in a Reset condition while the power
supply stabilizes.
 The MCLR input can be used to place the CPU in a Reset
condition and to force the program to start again.
 An internal clock oscillator (‘Internal RC OSC’) is provided so
that no external pins whatsoever need be committed to this
function.
 External oscillator connections can, however, be made, using
input/output pins GP4 and GP5.
 The oscillator signal is conditioned for use through the
microcontroller in the ‘Timing Generation’ unit.
 The ‘Watchdog Timer’ is a safety feature, used to force a reset
in the processor if it crashes.
~~~~ END OF CHAPTER 1
~~~~

You might also like