Você está na página 1de 15

A Microprocessor-based system

The block diagram of a microprocessor-based system:

>>Inorderforthemicroprocessortofunctionasaprogrammable
device, it must work in a complete system comprising of three
components : microprocessor, memory and input/output. This
system is called microprocessorbased system or microcomputer
system. These three components will work together or interact
witheachothertoperformagiventask.
SystemBuses
>>The three components of the microcomputer system is
connectedbythreebusses,alsoknownassystembus.
>>These busses is used to transfer information (data) internally
andexternallytothemicroprocessor.
AddressBus

>>It carries the address of a unique memory or input/output


(I/O) device
>>The address bus is unidirectional, over which the
microprocessor sends an address code to the memory or
input/output. The size (width) of the address bus is specified by
thenumberofbitsitcanhandle.

>>The more bits there are in the address bus, the more memory
locations a microprocessor can access. A 16 bit address bus is
capableofaddressing65,536(64K)addresses.
DataBus
>>Thedatabus carries data stored in memory (or an I/O device)

to the CPU or from the CPU to the memory (or I/O device)
>> The data bus is bidirectional, on which data or instruction
codes are transferred into the microprocessor or on which the
result of an operation or computation is sent out from the
microprocessortothememoryorinput/output.
>>Depending on the particular microprocessor, the data bus can
handle8bitor16bitdata.
ControlBus

>>a collection of control signals that coordinate and synchronize


the whole system
>>The control bus is used by the microprocessor to send out or
receive timing and control signals in order to coordinate and
regulateitsoperationandtocommunicatewithotherdevices,i.e.
memoryorinput/output.

CPU
>> Microprocessor is also called Central Processing Unit (CPU)
since it is the functional centre of the computer system and it is
usedtoprocessdata.
>>Microprocessor:
A multipurpose, programmable logic device (IC) that reads
binaryinstructionsfromastoragedevicecalledmemory,accepts
binary data as input and processes data according to those
instructions,andprovideresultsasoutput.
(A multipurpose device: it can be used to perform various
sophisticated computing tasks or functions, as well as simple
tasks.
A programmable device: it can be instructed to perform given
taskswithinitscapability.)
>> Microprocessor is designed to understand and execute many
binaryinstructions.

Memory
>>The memory in a computer system stores the data and instructions of
the programs.
>>Memory is the term used to the various storage devices in
which are used to store the programs and data for the
microprocessor.
>>Thesestoragedevicesaremadeofsemiconductordevices,and
alsoknownasPrimaryStorageDevices.

Input/Output
>>The input/output unit allows the microprocessor to
communicatewiththeoutsideworld,eithertoreceiveortosend
data.
>>Most of the time, the input/output unit will also act as an
interfaceforthemicroprocessor,thatistoconvertthedataintoa
suitableformatforthemicroprocessor.
>>Datacanbeintheformofparallel(8bit)orserialformat(single
line).
>>Input devices are devices that input data or send data to the
computer. Input devices are such as keyboard, punched card
readers,sensors,switches,etc.

>>Outputdevicesaredevicesthatoutputdataorperformvarious
operations under the control of the CPU. Output devices are
LEDs, 7segment display unit, speaker, CRT, printer, digital
speedometer,fuelinjectors,etc.

Inside The Microprocessor


>>Internally, the microprocessor is made up of 3 main units.

The Arithmetic/Logic Unit (ALU)


The Control Unit.
Register Array
>>Microprocessor:
A multipurpose, programmable logic device (IC) that reads
binaryinstructionsfromastoragedevicecalledmemory,accepts
binary data as input and processes data according to those
instructions,andprovideresultsasoutput.
(A multipurpose device: it can be used to perform various
sophisticated computing tasks or functions, as well as simple
tasks.

A programmable device: it can be instructed to perform given


taskswithinitscapability.)
>> Microprocessor is designed to understand and execute many
binaryinstructions.
>> Microprocessor is also called Central Processing Unit (CPU)
since it is the functional centre of the computer system and it is
usedtoprocessdata.

Block diagram of a typical CPU

RegisterSection
>>An array of registers for holding data while it is being
manipulated.

>>The register section/array consists completely of circuitry used


totemporarilystoredataorprogramcodesuntiltheyaresentto
theALUortothecontrolsectionortomemory.
>>The number of registers are different for any particular
CPU,and the more >>register a CPU have will result in easier
programmingtasks.
ArithmeticandLogicUnit(ALU)
>>Thissection,underthecontrolofcontrolsectioncarriesoutthe
actual processing of data, normally describe as data
manipulation. This consists largely of arithmetic operations
(ADDition, SUBtraction, INCrementing, DECrementing etc) and
logicaloperations(ANDing,ORing,XORing,NOTingetc).
>>TheALUcarriesouttheseoperationsinthefollowingmanner:
>>storesdatafetchedfrommemoryorI/Ointheregisters
>>fetchesthisdataasneededfromtheregistersand/orfrom
relevantaccumulators
>>send this data either to its arithmetic circuitry or logical
circuitry,wherenecessary,wherethenecessary
arithmeticorlogicaloperationsarecarriedout
>>send results of its arithmetic or logical operation to
relevantaccumulator,tothememory,ortotheI/O
interfaces.
ControlUnit
>>The control section/unit is the part of the microcomputer that
controlsitsbasicoperations.Itismadeupofthecontrol
signalgeneratingcircuitry(clock)andthecommand(instruction)
decoder.
>>The control section fetches preprogrammed instructions from
memory (opcode fetch cycle) as needed and temporarily stores

them in the command register (also known as Instruction


RegisterIR).
>>These instructions are then decoded by the operation decoder
(decodecycle),whichsendscontrolsignalstotherelevant
parts of the microcomputer system (via the system busses) to
causethemtocarryouttherequiredoperation(executecycle)
>>The timing with which these control signals are generated is
determinedbytheclock.ThenumberofTstatestellsthe
timetakenfortheCPUtoexecutethatparticularinstruction.
CPU structure
The main functions are
>>data transfer
>>arithmetic and logic operations
>>decision making (instructional flow control)
>>The register array consists of at least one accumulator, program counter
and stack pointer.
>>The control unit controls all the operations in a CPU and basically it
puts the CPU in one of the fetch and execution phases.
>>Themajortypesofoperationscontrolledbythecontrolsignals:
>> sending of data from one part of the microcomputer to
another(readorwritecycle)
>>inputting and outputting of data to/from the
microcomputer(I/Oreadorwritecycle)
>>ArithmeticandLogiccalculations.
>>Haltingofcomputerinstructions.
>>Jumpingtoanotherinstructionduringrunning(execution)
ofaprogram.

Operation of the CPU

Fetch cycle (phase):


The CPU puts the address of the instruction to be executed on
the address bus. The address information comes from the program
counter (PC) maintained by the control unit.
The control bus holds the information for reading the memory
location and the data bus holds the instruction from the memory which is
stored into the instruction register (IR)
PC is updated to point to the next instruction.
Execute cycle (phase):
Instruction in the IR is decoded
The required data transfer and the required logical and
arithmetic operation are performed
The result is written back either to one of the registers or
memory or I/O device
Common operations performed in ALU :
addition, subtraction,
logical AND, OR, XOR, NOT
increment, decrement, shift, clear, etc.

Microcomputer
CPU on a single IC microprocessor (P).
The terms CPU, P and MPU (microprocessor unit) are
synonymous
CPU is the combination of the ALU and control unit of any
computer.
When the CPU is a single IC; it is called a P and is also referred
to as the MPU.
When the MPU is connected to memory and I/O, the arrangement
becomes a MICROCOMPUTER.
Many different MPUs are produced by many different IC vendors (e.g.,
Intel, Motorola, Texas Instruments, Zilog, National Semiconductors,
etc.).
Major differences are in
word size,
the number and types of instructions that can be performed,
the types of external control signals available,
the amount of memory that can be addressed.

Organization of a microprocessor-based system

Lets expand the picture a bit

Microcontroller

A microcontroller unit (MCU) contains an MPU, memory, and


I/O circuitry on a single chip.
Such a chip can perform control operations without the need for
any external circuitry.
e.g. Motorola MC68HC11 (also a microprocessor in the expanded
multiplexed mode) e.g.
Intel 8051
Microprocessors vs microcontrollers
Microprocessor
>>Microprocessors: high performance, general purpose brains for PCs
and workstations
>>Instruction decode and control, arithmetic/logic operations, registers,
timing, external control
>>Includes memory management unit, lots of cache
>>Performance is the most important feature (cost is important, but
secondary)
>>Used mainly in desktop machines
Microcontroller
>>Microcontrollers: devices with high levels of integration for
embedded control
>>Microprocessor functions plus on-chip memory and peripheral
functions (e.g. ports, timers)
>>Integrated RAM and ROM, no cache
>>Includes lots of peripherals
>>Used mainly in embedded applications and often involves real-time
control
>>Important features include: low cost, low power consumption, number
of integrated peripherals, interrupt response time, amount of RAM and
ROM

The block diagram of a microcontroller

Memory
>>The memory in a computer system stores the data and instructions of
the programs.
>>Memory stores information such as instructions and data in binary
format (0 and 1). It provides this information to the microprocessor
whenever it is needed.

Main memory types


The semiconductor memory is of 2 types that is Read Only
Memory (ROM) and Read Write Memory (RWM). RWM is
popularlyknownasRandomAccessMemory(RAM):
ROM (read-only memory)
>>programmed permanently at the factory, cannot be altered
EPROM (erasable programmable ROM)
>>nonvolatile, written electrically but erased optically
EEPROM (electrically ROM)
>>nonvolatile, both written and erased electrically
RAM (random-access memory)
(RWM read and write memory

ROM (read-only memory)

>>The registers inside the microprocessor Read Only


Memory (ROM)
>>used to store information that does not change.
Itisusedtostoreprogramsanddatathatneednottobealtered,
i.e. permanent storage. Programs and data stored in ROMs can
onlybereadbytheCPU.
>>Specialequipmentisusedtowriteprogramsanddataintothe
ROMsandiscalledEPROMProgrammer.
>>ThemonitorprogramisnormallystoredintheROM.
>>Monitor program is actually the resource manager of the
microcomputersystem,similartoDOSorWindowsinapersonal
computer.
>>AnexampleofaEPROMchipisthe2764(8KX8).

Random Access Memory (RAM)


(also known as Read/Write Memory(RWM)).
>>used to store information supplied by the user. such as
programs and data.
It is used to store user programs and data, and can be altered at
anytime,i.e.temporarystorage.
>>TheinformationstoredinRAMorRWMcanbeeasilyreadand
alteredbytheCPU.
>>Thecontents (data or programs) stored is lost if power supply
tothischipisturnedoff.AnexampleofaRWMchipistheCMOS
6116(2KX8).

Memory Map and Addresses


The memory map is a picture representation of the
address range and shows where the different memory
chips are located within the address range.

To execute a program:
>>the user enters its instructions in binary
format into the memory.
>>The microprocessor then reads these
instructions and whatever data is needed from
memory, executes the instructions and places the

results either in memory or produces it on an


output device.

The three cycle instruction execution


model
Fetch, Decode and Execute Cycles
>>To use the right names for the cycles:The
microprocessor fetches each instruction,decodesit,
Then executes it.
>>To execute a program, the
microprocessor
reads each instruction from memory, interprets
it, then executes it.
>>This sequence is continued until all instructions
are performed.

Você também pode gostar