lesson 2 intro to the up or uc

33
Microprocessor Systems & Applications

Upload: illingworth1000

Post on 03-Dec-2015

219 views

Category:

Documents


0 download

DESCRIPTION

MCU introduction

TRANSCRIPT

Microprocessor

Systems &

Applications

Unit 59: Microprocessor Systems & Applications

Learning outcomes

On completion of this unit a learner should be able

to:

1. Know how microprocessor-based systems can be

applied

2. Understand the architecture and operation of a

microprocessor system

3. Understand decimal, binary and hexadecimal

number systems, instructions and subroutines

4. Be able to use a microprocessor development

system to prepare and run a program.

Unit 59: Microprocessor Systems & Applications

Learning Objectives:

Explain the difference between a

Microprocessor & a Microcontroller

Microprocessor & Microcontrollers

• Microprocessors & Microcontrollers form the “brains”

behind many of the electronic devices we use every

day and which drives industrial growth.

• To understand the difference between the two

devices, we need to look at their applications and the

requirements of those.

• Broadly speaking, microprocessors will power

devices that need to run a number of software

applications concurrently, whereas a microcontroller

will power a device that has a specific control

function.

Processor Performance• The speed of a computer's processor chip is known as its clock

speed and is measured in Giga hertz (GHz), with the fastest

processors currently running at up to 4.7 GHz.

• However today, CPU performance is now determined by more

than just raw clock speed, the architecture of a processor is the

most important factor to determine its performance.

• In most situations, multi-core processors are far more powerful

than traditional single core processors. This is because they

can carry out several tasks at the same time. Single core

processors can only achieve this by constantly switching

between tasks.

• This means that multi-core processors can run at lower speeds

than single-core processors and yet be far more powerful.

• For example a 2.4 GHz quad core i5 processor is more

powerful than a 3 GHz Pentium processor, which only has a

single processor chip.

Processor Architecture• Microprocessor & microcontroller architecture dictates it’s

performance and it’s input / output capabilities. The architecture

also determines the complexity and skills required to program

the system.

Processor Performance• How are the processor chips made?

https://www.youtube.com/watch?v=qm67wbB5GmI

Microprocessor or Microcontroller?

What is a Microprocessor?• A microprocessor - also known as a CPU or central

processing unit - is a complete computation engine

that is fabricated on a single chip.

• The first commercial microprocessor was the Intel

4004, introduced in 1971. The 4004 was not very

powerful - all it could do was add and subtract, and

it could only do that 4 bits at a time. But it was

amazing that everything was on one chip.

• Prior to the 4004, engineers built computers either

from collections of chips or from discrete

components (transistors wired one at a time).

• The 4004 powered one of the first portable

electronic calculators.

What is a Microprocessor?• The first microprocessor to make it into a home

computer was the Intel 8080, a complete 8-bit

computer on one chip, introduced in 1974.

• The first microprocessor to make a real splash in

the market was the Intel 8088, introduced in 1982

and incorporated into the IBM PC.

• The PC market moved from the 8088 to the 80286

to the 80386 to the 80486 to the Pentium to the

Pentium II to the Pentium III to the Pentium 4.

• All of these microprocessors are made by Intel and

all of them are improvements on the basic design of

the 8088. The Pentium 4 could execute any piece of

code that ran on the original 8088, but it does it

about 5,000 times faster.

Inside a Computer?

Microprocessor-based systems have separate memory modules, and input / output

controllers (incl. video etc). They will also have an Operating System (OS) to manage

all of the software and hardware on the computer. These all need to access your

computer's central processing unit (CPU), memory, and storage. The operating system

coordinates all of this to make sure each program gets what it needs.

A

motherboard

being

manufactured

What is a Microprocessor?• Intel therefore dominates the general microprocessor

market, the ones we see in our laptops, desktops, and

servers, but this is not the case for microcontrollers,

as we will see.

• Data Width is the width

of the ALU.

• An 8-bit ALU can add /

subtract / multiply / etc.

two 8-bit numbers,

while a 32-bit ALU can

manipulate 32-bit

numbers.

• An 8-bit ALU would

have to execute four

instructions to add two

32-bit numbers, while a

32-bit ALU can do it in

one instruction.

Inside a MicroprocessorArithmetic & Logic Unit (ALU)

The part of the central processing unit that deals

with operations such as addition, subtraction, and

multiplication of integers and Boolean operations.

It receives control signals from the control unit

telling it to carry out these operations.

Control Unit (CU)

This controls the movement of instructions in and

out of the processor, and also controls the

operation of the ALU. It consists of a decoder,

control logic circuits, and a clock to ensure

everything happens at the correct time. It is also

responsible for performing the instruction

execution cycle.

Register Array

This is a small amount of internal memory. All

processors include some common registers used

for specific functions, namely the program

counter, instruction register, accumulator, memory

address register and stack pointer.

microprocessor

Inside a Microprocessor

System Bus

This is comprised of the control bus, data bus

and address bus. It is used for connections

between the processor, memory and peripherals,

and transferal of data between the various parts.

Memory

The memory is not an actual part of the CPU

itself, and is instead housed elsewhere on the

motherboard.

However, it is here that the program being

executed is stored, and as such is a crucial part of

the overall structure involved in program

execution.

microprocessor

Inside a MicroprocessorMany different types of registers are common between most

microprocessor designs. These are:

Program Counter (PC)

This register is used to hold the memory address of the next instruction

that has to executed in a program. This is to ensure the CPU knows at all

times where it has reached, that is able to resume following an execution

at the correct point, and that the program is executed correctly.

Instruction Register (IR)

This is used to hold the current instruction in the processor while it is

being decoded and executed, in order for the speed of the whole

execution process to be reduced. This is because the time needed to

access the instruction register is much less than continual checking of the

memory location itself.

Accumulator (A, or ACC)

The accumulator is used to hold the result of operations performed by the

arithmetic and logic unit, as covered in the section on the ALU.

Inside a MicroprocessorMany different types of registers are common between most

microprocessor designs. These are:

Memory Address Register (MAR)

Used for storage of memory addresses, usually the addresses involved in

the instructions held in the instruction register. The control unit then

checks this register when needing to know which memory address to

check or obtain data from.

Memory Buffer Register (MBR)

When an instruction or data is obtained from the memory, it is first placed

in the memory buffer register.

Flag register / status flags

The flag register is designed to contain all the appropriate 1-bit status

flags, which are changed as a result of operations involving the ALU.

Other general purpose registers

These registers have no specific purpose, but are generally used for the

quick storage of pieces of data that are required later in the program

execution.

Microprocessor MemoryMicroprocessor memory is connected externally to the processor via the Address,

Data, and Control buses. Memory suffers from the dichotomy that it can be either

large or it can be fast. As memory becomes larger, it becomes slower, and vice-versa.

Because of this trade-off, computer systems typically have a hierarchy of memory

types, where faster (and smaller) memories are closer to the processor, and slower

(but larger) memories are further from the processor.

Random Access Memory (RAM), also known as main memory, is a volatile storage

that holds data for the processor. Unlike HDD storage, RAM typically only has a

capacity of a few gigabytes. There are two primary forms of RAM, and many variants

on these.• Static RAM (SRAM) is a type of memory storage that uses 6 transistors to store data. These transistors

store data so long as power is supplied to the RAM and do not need to be refreshed. SRAM is typically

used in processor caches because of its faster speed, but not in main memory because it takes up more

space.

• Dynamic RAM (DRAM) is smaller than SRAM, and therefore can store more data in a smaller area. DRAM

tends to be slower than SRAM. Many modern types of Main Memory are based on DRAM design because

of the high memory densities. Because DRAM is simpler than SRAM, it is typically cheaper to produce.

Cache is memory that is smaller and faster than main memory and resides closer to

the processor (or on the chip). RAM runs on the system bus clock, but Cache typically

runs on the processor speed which can be 10 times faster or more.

Microprocessor Memory

20

Address Space

Microprocessor or Microcontroller?

Embedded, Everywhere

22

Embedded, Everywhere - Fitbit

23

Embedded, Everywhere – WattVision on Kickstarter

24

25

MEMS Accelerometers:

Rapidly falling price and power

[Analog Devices, 2009]ADXL345

10 µA @ 10 Hz @ 6 bits

25 µA @ 25 Hz

[ST Microelectronics, annc. 2009]

O(mA)

26

Energy harvesting and storage:

Small doesn’t mean powerless…

Thermoelectric Ambient

Energy Harvester [PNNL]

Shock Energy Harvesting

CEDRAT Technologies

Electrostatic Energy

Harvester [ICL]

Thin-film batteries

RF [Intel]

Piezoelectric

[Holst/IMEC]

Clare Solar Cell

27

Lots of manufacturers ship ARM products

What is a Microcontroller?A microcontroller is effectively a “micro computer”.

Whereas a microprocessor is just the CPU.

A microcontroller-based system is typically referred to as

an “Embedded system” and is characterised by the

following:

• Has a microprocessor unit

• Is application specific

• Has no operating system

• Is real-time

• Is an integrated device

• Has fixed I/O and is not expandable

• Memory management is a concern

• The system is likely to be low-power, mobile, small and needs

to be cost-competitive.

What is a Microcontroller

Microprocessor Microcontroller

• Microprocessor assimilates the function

of a central processing unit (CPU) on to

a single integrated circuit (IC).

• Microcontroller can be considered as a

small computer which has a processor

and some other components in order to

make it a computer.

• Microprocessors are mainly used in

designing general purpose systems

from small to large and complex

systems like super computers.

• Microcontrollers are used in

automatically controlled devices.

• Microprocessors are basic components

of personal computers.

• Microcontrollers are generally used in

embedded systems

• Computational capacity of

microprocessor is very high. Hence can

perform complex tasks.

• Less computational capacity when

compared to microprocessors. Usually

used for simpler tasks.

• A microprocessor based system can

perform numerous tasks.

• A microcontroller based system can

perform single or very few tasks.

• Microprocessors have integrated Math

Coprocessor. Complex mathematical

calculations which involve floating point

can be performed with great ease.

• Microcontrollers do not have math

coprocessors. They use software to

perform floating point calculations which

slows down the device.

Comparing a P with a C

Microprocessor Microcontroller

• The main task of microprocessor is to

perform the instruction cycle repeatedly.

This includes fetch, decode and

execute.

• In addition to performing the tasks of

fetch, decode and execute, a

microcontroller also controls its

environment based on the output of the

instruction cycle.

• In order to build or design a system

(computer), a microprocessor has to be

connected externally to some other

components like Memory (RAM and

ROM) and Input / Output ports.

• The IC of a microcontroller has memory

(both RAM and ROM) integrated on it

along with some other components like I

/ O devices and timers.

• The overall cost of a system built using

a microprocessor is high. This is

because of the requirement of external

components.

• Cost of a system built using a

microcontroller is less as all the

components are readily available.

• Generally power consumption and

dissipation is high because of the

external devices. Hence it requires

external cooling system.

• Power consumption is less.

• The clock frequency is very high usually

in the order of Giga Hertz.

• Clock frequency is less usually in the

order of Mega Hertz.

Comparing a P with a C

Microprocessor Microcontroller• Instruction throughput is given higher

priority than interrupt latency.

• In contrast, microcontrollers are

designed to optimize interrupt latency.

• Have few bit manipulation instructions

• Bit manipulation is powerful and widely

used feature in microcontrollers. They

have numerous bit manipulation

instructions.

• Generally microprocessors are not used

in real time systems as they are

severely dependent on several other

components.

• Microcontrollers are used to handle real

time tasks as they are single

programmed, self sufficient and task

oriented devices.

Comparing a P with a C

It is clear that a microprocessor cannot replace a microcontroller

and vice versa. Both pieces of technology have their unique way

of usage in applications.

Unit 59: Microprocessor Systems & Applications

Learning outcome 1:

Explain the difference between a

Microprocessor & a Microcontroller