Professional Documents
Culture Documents
Micro-controllers
Micro-processors
Micro-controllers
2
Micro-processors
A microprocessor is a computer processor which incorporates the functions of
a computer's Central Processing Unit (CPU) on a single integrated circuit (IC)
or at most a few integrated circuits.
The integration of a whole CPU onto a single chip or on a few chips greatly
reduced the cost of processing power, increasing efficiency.
3
Micro-controllers
A microcontroller (or MCU for MicroController Unit) is a small computer on a
single integrated circuit. In modern terminology, it is a System on a Chip (SoC).
Data Data
input processing output
Computer Hardware
Main Hardware Components of a Processing Unit:
Primary Memory
RAM Modules
9
Mainboard / Motherboard
In addition to the registers, a CPU also has cache memories which are
used to store the instructions that are used by the CPU repeatedly or the
instructions in the pipeline (next executable instructions). Usually the
higher the amount of the cache memory, the better the CPU performs.
But cache memories are very expensive.
13
Hardware vs. Software
There are two types of CPU architecture* in wide use today:
• RISC (Reduced Instruction Set Computer) – ARM (v5, v6, v7) CPUs are
RISC ones. They support fewer instructions (often simpler ones) and are
power saver. So they are used in smart phones, tablet computers, etc.
Examples are:
Intel/AMD x86 CPU + Windows OS (32 bit)
Intel x86_64/AMD64 CPU + Windows OS (64 bit)
Intel CPU + Linux
Intel CPU + Mac OS X
ARM CPU + Linux
ARM CPU + Android
ARM CPU + iOS
17
Computing Platform (Environment)
The basic knowledge of a suitable platform is necessary for a
programmer.
This 4 GB RAM limit are avoided by 64-bit CPUs and 64-bit OSs.
A 64-bit CPU/OS can keep track of 264 =18,446,744,073,709,551,616 byte (18
EB, i.e., 18 Giga GB) of RAM and 9 ZB (9 Giga TB) partition of HDD.
In order to avail the 64-bit computing advantages, one must have both 64-bit
CPU and 64-bit OS.
[32-bit CPUs cannot run 64-bit OSs and 32-bit OSs cannot run 64-bit
softwares even if the CPU is 64-bit.]
21
Kilobyte KB 10 1,024
2
Megabyte MB 20 1,048,576
2
Gigabyte GB 30 1,073,741,824
2
Terabyte TB 40 1,099,511,627,776
2
22
Primary Memory
Each bit of information (programming instructions/data) for
processing by the CPU is fetched from the RAM or stored back to
the RAM after/or during processing. Not only that, every devices
communicates to the CPU via its reserved area inside RAM
(allocated by the OS).
Computer Software
Hardware Abstraction
Layer (HAL)
Types of software
24
Hardware Abstraction Layer (HAL)
The core component of an OS is its ‘kernel’. Kernel consists of
hardware device drivers which control the hardware at their lowest level.
OSs also provide a set of API libraries/routines/framework to the user at a
higher level to use those hardware in an efficient way, thus increasing the
productivity of the programmer.
Software
Application Programs Systems Programs
Word processors Operating system.
Game programs Networking system.
Spreadsheets Programming
Data base systems language software.
Graphics programs Web site server.
Web browsers Data backup.
26
Microcontrollers
• Embedded Systems
– Operations managed behind the scenes by a
microcontroller
• Microcontroller (MCU)
– Integrated electronic computing device that
includes three major components on a single
chip
• Microprocessor (MPU)
• Memory
• I/O (Input/Output) ports
27
Microcontrollers
• Support Devices
– Timers
– A/D converter
– Serial I/O
• Common communication lines
– System Bus
28
CPU
29
Micro-controller
30
Microprocessor-Based Systems
31
Input/Output (I/O)
• Input Devices
– Switches and Keypads
– Provide binary information to the MPU
• Output devices
– LEDs and LCDs
– Receive binary information from the MPU
32
33
Microprocessor vs. Microcontroller
Microprocessor Microcontroller
• CPU is stand-alone, RAM, • CPU, RAM, ROM, I/O and timer
ROM, I/O, timer are separate are all on a single chip
• designer can decide on the • fixed amount of on-chip ROM,
amount of ROM, RAM and RAM, I/O ports
I/O ports.
• for applications in which cost,
• expensive power and space are critical
• versatility
• single-purpose (control-oriented)
• general-purpose
• Low processing power
• High processing power
• High power consumption • Low power consumption
• Instruction sets focus on • Bit-level operations
processing-intensive • Instruction sets focus on control
operations and bit-level operations
• Typically 32/64 – bit • Typically 8/16 bit
• Typically deep pipeline (5-20 • Typically single-cycle/two-stage
stages)
pipeline
34
system bus
I/O
(serial line, Disk Network
keyboard, Interface
mouse)
I/O custom
Interface ROM RAM logic
high-speed
interactions
Programmer
37
Arduino – An Introduction
Watchdog Timer
In many cases, embedded devices operate in total isolation
and are not accessible to an operator.
Manually resetting a device in this scenario when its software
“hangs” is not possible.
Watchdog Timer
To avoid a reset, an application must periodically reset the
watchdog timer before this interval elapses. This is also
known as “kicking the dog”.
Many processors and microcontrollers have built-in
watchdog circuitry available to the programmer.