Microprocessor Notes 1

Embed Size (px)

Citation preview

  • 8/20/2019 Microprocessor Notes 1

    1/15

     

    A Microprocessor-based systemThe block diagram of a microprocessor-based system:

    >>In order for the microprocessor to function as a programmable 

    device,  it must work  in  a  complete  system  comprising  of  three 

    components  :  microprocessor,  memory  and  input/output.  This 

    system  is  called microprocessor‐ based  system or microcomputer 

    system.  These  three  components  will work  together  or  interact 

    with each other to perform a given task. 

    System Buses 

    >>The  three  components  of  the  microcomputer  system  is 

    connected  by three  busses, also known as system  bus. 

    >>These  busses  is  used  to  transfer  information  (data)  internally 

    and externally to the microprocessor. 

    Address Bus 

    >>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 

    the number of  bits it can handle. 

  • 8/20/2019 Microprocessor Notes 1

    2/15

    >>The more  bits  there are  in  the address  bus,  the more memory 

    locations  a microprocessor  can  access. A  16  bit  address  bus  is 

    capable of addressing 65,536 (64K) addresses. 

    Data Bus 

    >> The data  bus 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  ʹbi‐directional  ́, 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 

    microprocessor to the memory or input/ output. 

    >>Depending on  the particular microprocessor,  the data  bus  can 

    handle 8  bit or 16  bit data. 

    Control Bus 

    >>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 

    regulate its operation and to communicate with other devices, i.e. 

    memory or input/output. 

  • 8/20/2019 Microprocessor Notes 1

    3/15

     

    CPU 

    >> Microprocessor  is  also  called Central Processing Unit  (CPU) 

    since  it  is  the  functional centre of  the computer  system and  it  is 

    used to process data. 

    >> Microprocessor: A  multipurpose ,  programmable  logic  device  (IC)  that  reads 

    binary instructions from a storage device called memory , accepts 

     binary  data  as  input  and  processes  data  according  to  those 

    instructions, and provide results as output. 

    (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 

    tasks within its capability.) 

    >> Microprocessor  is designed  to understand  and  execute many 

     binary instructions. 

  • 8/20/2019 Microprocessor Notes 1

    4/15

    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. 

    >>These storage devices are made of semiconductor devices, and 

    also known as Primary Storage Devices. 

    Input/Output >>The  input/output  unit  allows  the  microprocessor  to 

    communicate with the outside world, either to receive or to send 

    data. 

    >>Most  of  the  time,  the  input/output  unit  will  also  act  as  an 

    interface for the microprocessor, that is to convert the data into a 

    suitable format for the microprocessor. 

    >>Data can

      be

     in

     the

     form

     of

     parallel

     (8

      bit)

     or

     serial

     format

     (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. 

  • 8/20/2019 Microprocessor Notes 1

    5/15

    >>Output devices are devices that output data or perform various 

    operations  under  the  control  of  the  CPU.  Output  devices  are 

    LEDs,  7‐segment  display  unit,  speaker,  CRT,  printer,  digital 

    speedometer, fuel

     injectors,

     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 

    binary instructions from a storage device called memory , accepts 

     binary  data  as  input  and  processes  data  according  to  those 

    instructions, and

     provide

     results

     as

     output.

     

    (A  multipurpose  device:  it  can   be  used  to  perform  various 

    sophisticated  computing  tasks  or  functions,  as  well  as  simple 

    tasks. 

  • 8/20/2019 Microprocessor Notes 1

    6/15

    A  programmable  device:  it  can  be  instructed  to  perform  given 

    tasks within its capability.) 

    >> Microprocessor  is designed  to understand  and  execute many 

     binary instructions.

     

    >> Microprocessor  is  also  called Central Processing Unit  (CPU) 

    since  it  is  the  functional centre of  the computer  system and  it  is 

    used to process data. 

    Block diagram of a typical CPU  

                Register Section >>An array of registers for holding data while it is being

    manipulated.

  • 8/20/2019 Microprocessor Notes 1

    7/15

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

    to temporarily store data or program codes until they  are sent to 

    the ALU or to the control section or to memory. 

    >>The number

     of

     registers

     are

     different

     for

     any

     particular

     

    CPU,and  the  more  >>register  a  CPU  have  will  result  in  easier 

    programming tasks. 

    Arithmetic and Logic Unit (ALU) 

    >>This section, under the control of control section carries out the 

    actual  processing  of  data ,  normally  describe  as  data 

    manipulation.  This  consists  largely  of  arithmetic  operations 

    (ADDition,  SUBtraction,  INCrementing, DECrementing  etc)  and logical operations (ANDing, ORing, XORing, NOTing etc). 

    >>The ALU carries out these operations in the following manner :‐

    >>stores data fetched from memory or I/O in the registers 

    >>fetches this data as needed from the registers and/or from 

    relevant accumulators 

    >>send  this data  either  to  its  arithmetic  circuitry  or  logical 

    circuitry, where necessary, where the necessary arithmetic or logical operations are carried out 

    >>send  results  of  its  arithmetic  or  logical  operation  to 

    relevant accumulator, to the memory, or to the I/O 

    interfaces. 

    Control Unit 

    >>The  control  section/unit  is  the part of  the microcomputer  that 

    controls its  basic operations. It is made up of the control signal generating circuitry (clock) and the command (instruction) 

    decoder. 

    >>The  control  section  fetches pre‐programmed  instructions  from 

    memory  (op‐code  fetch cycle) as needed and  temporarily  stores 

  • 8/20/2019 Microprocessor Notes 1

    8/15

    them  in  the  command  register  (also  known  as  Instruction 

    Register IR). 

    >>These  instructions are  then decoded  by  the operation decoder 

    (decode cycle) ,

     which

     sends

     control

     signals

     to

     the

     relevant

     

    parts  of  the  microcomputer  system  (via  the  system   busses)  to 

    cause them to carry out the required operation (execute cycle) 

    >>The  timing with which  these  control  signals  are  generated  is 

    determined  by the clock. The number of T‐states tells the 

    time taken for the CPU to execute that particular instruction. 

    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.

    >>The major

     types

     of

     operations

     controlled

      by

     the

     control

     signals:

     

    >>  sending  of data  from  one part  of  the microcomputer  to 

    another (read or write cycle) 

    >>inputting  and  outputting  of  data  to/from  the 

    microcomputer (I/O read or write cycle) 

    >>Arithmetic and Logic calculations. 

    >>Halting of computer instructions. 

    >>Jumping to

     another

     instruction

     during

     running

     (execution)

     

    of a program. 

  • 8/20/2019 Microprocessor Notes 1

    9/15

    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.

  • 8/20/2019 Microprocessor Notes 1

    10/15

    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 anycomputer.

    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 inword 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  

    Let’s expand the picture a bit. 

    Microcontroller

  • 8/20/2019 Microprocessor Notes 1

    11/15

      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 expandedmultiplexed 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 peripheralfunctions (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

  • 8/20/2019 Microprocessor Notes 1

    12/15

    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 typesThe  semiconductor  memory  is  of  2  types  that  is  Read  Only 

    Memory  (ROM)  and  Read  Write  Memory  (RWM).  RWM  is 

    popularly known as Random Access Memory (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)

  • 8/20/2019 Microprocessor Notes 1

    13/15

    >>The registers inside the microprocessor –Read OnlyMemory (ROM)

    >>used to store information that does not change. –It is used to store programs and data that need not to  be altered, 

    i.e.  permanent  storage. Programs  and data  stored  in ROMs  can 

    only  be read  by the CPU. 

    >>Special equipment  is used to write programs and data  into the 

    ROMs and is called  EPROM Programmer. 

    >>The monitor program is normally stored in the ROM. 

    >>Monitor  program  is  actually  the  ‘resource  manager’  of  the 

    microcomputer system, similar to DOS or Windows in a personal 

    computer. 

    >>An example of a EPROM chip is the 2764 (8K X 8). 

    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 

    any time, i.e. temporary storage. 

    >>The information stored in RAM or RWM can  be easily read and 

    altered  by the CPU. 

    >>The contents (data or programs) stored  is  lost  if power supply 

    to this chip is turned off. An example of a RWM chip is the CMOS 

    6116 (2K

     X

     8).

     

  • 8/20/2019 Microprocessor Notes 1

    14/15

    Memory Map and AddressesThe memory map is a picture representation of the

    address range and shows where the different memorychips 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

  • 8/20/2019 Microprocessor Notes 1

    15/15

    results either in memory or produces it on an

    output device. 

    The three cycle instruction executionmodel 

     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.