lect 3                                                       4/19/2025
Introduction to Microcontroller
             Why do we need to learn Micro-
                processors/controllers?
         • The microprocessor is the core of computer
           systems.
         • Nowadays many communication, digital
           entertainment, portable devices, are controlled
           by them.
         • A designer should know what types of
           components he needs, ways to reduce
           production costs and product reliable.
                                                                    1
lect 3                                                                                    4/19/2025
                                  Different aspects of
                              a micro-processor/controller
              • Hardware :Interface to the real world
              • Software :order how to deal with inputs
          Evolution of Microprocessor-based
                       Systems
         • First came transistors
         • Integrated circuits
             • SSI (Small-Scale Integration) to ULSI
             • Very Large Scale Integration circuits (VLSI)
         • 1- Microprocessors (MPU)
             • Microcomputers (with CPU being a microprocessor)
             • Components: Memory, CPU, Peripherals (I/O)
             • Example: Personal computers
         • 2- Microcontroller (MCU)
             • Microcomputers (with CPU being a microprocessor)
             • Many special function peripheral are integrated on a single circuit
             • Types: General Purpose or Embedded System (with special functionalities)
                                                                                                 2
lect 3                                                                      4/19/2025
                                       The Computer
         • What is a computer?
             • A programmable electronic device that can store, retrieve,
               and process data.
             • A machine that manipulates data according to a list of
               instructions.
         • Classification of Computers (power and price)
              •   Personal computers
              •   Mainframes
              •   Supercomputers
              •   Dedicated controllers – Embedded controllers
                               Personal Computers
         • Any general-purpose computer
             • intended to be operated directly by an end user
         • Range from small microcomputers that work with 4-bit words
           to PCs working with 32-bit words or more
         • They contain a processor – known by different names:
             • Microprocessor – built using Very-Large-Scale Integration
               technology; the entire circuit is on a single chip
             • Central Processing Unit (CPU)
             • Microprocessor Unit (MPU) – similar to CPU
         http://en.wikipedia.org/wiki/Personal_computer
                                                                                   3
lect 3                                                                     4/19/2025
                                      Mainframes
         • Massive amounts of memory
         • Use large data words…64 bits or more
         • Mostly used for military defense and large business
           data processing
         • Examples: IBM 4381, Honeywell DPS8
                                 Supercomputers
         • Fastest and most powerful mainframes
              • Contain multiple processors (CPUs)
              • Used for scientific applications, and number crunching
              • Now have teraflops performance
                    • FLoating Point Operations Per Second (FLOPS)
         • Examples of special-purpose supercomputers:
              •   Belle, Deep Blue, and Hydra, for playing chess
              •   Reconfigurable computing machines or parts of machines
              •   GRAPE, for astrophysics and molecular dynamics
              •   Deep Crack, for breaking the DES cipher
              •   MDGRAPE-3, for protein structure computation
         http://en.wikipedia.org/wiki/Supercomputer
                                                                                  4
lect 3                                         4/19/2025
           Microprocessor-Based Systems
         • Central Processing Unit (CPU)
         • Memory
         • Input/Output (I/O) circuitry
         • Buses
             – Address bus
             – Data bus
             – Control bus
                 Microprocessor based system
                                                      5
lect 3                                                4/19/2025
                        Microprocessor based system
         MPU
                  GP-
           CLK            Reg
                  CPU
         CPU
         Arithmetic
                        Register
           Logic
                         Arrays
            Unit
               Control Unit
          Microprocessor-Based System with Buses:
             Address, Data, and Control Signals
                                                             6
lect 3                                                                                            4/19/2025
                     Microprocessor-based Systems
                                      Microprocessor
         • The microprocessor (MPU) is a computing and logic
           device that executes binary instructions in a sequence
           stored in memory.
         • Characteristics:
            •   General purpose central processor unit (CPU)
            •   Binary
            •   Register-based
            •   Clock-driven
            •   Programmable
                   Microprocessor-based Systems
                                       Microprocessor
         • Microprocessor is the “brains” of the computer
            •   its job is to fetch instructions, decode them, and then execute them
            •   8/16/32/etc –bit (how it moves the data)
         • contains:
           ALU performs computing tasks – manipulates the data/ performs numerical and logical
           computations
           Registers are used for temp. storage
           Control unit is used for timing and other controlling functions – contains a program
           counter (next instruction’s address and status register)
         System software: A group of programs that monitors the functions of the entire system
                                                                                                         7
lect 3                                                                            4/19/2025
                      Microprocessor-based Systems
                                          Memory
              Memory is a group of registers
                    16 register – address: 0-15 – in binary:
                      0-1111; Address lines: A0-A3
              Serves two major purposes
                    storing the binary codes for the sequence of
                     instructions specified by programs (program)
                    storing binary data that the computer needs
                     to execute instructions (data)
                      Microprocessor-based Systems
                                          Memory
         Memory Types
               • R/W: Read/Write Memory; also called RAM
                 •   It is volatile (losses information as power is removed)
                 •   Write means the processor can store information
                 •   Read means the processor can receive information from the
                     memory
                 •   Acts like a Blackboard!
               • ROM: Read-Only memory;
                 •   It is typically non-volatile (permanent) – can be erasable
                 •   It is similar to a Page from your textbook
                                                                                         8
lect 3                                                  4/19/2025
                    Microprocessor-based Systems
                             Input/Output (I/O) Ports
          The way the computer communicates with the
           outside world devices
          Peripherals are connected to I/O ports
            Peripherals are I/O devices
                 Input devices
                 Output devices
            Examples
                   Printers and modems,
                    keyboard and mouse
                   scanner
                   Universal Serial Bus (USB)
                    Microprocessor-based Systems
                             Input/Output (I/O) Ports
                                                               9
lect 3                                                                                          4/19/2025
                       Microprocessor-based Systems
                                           System- Buses
         • The three components – MPU, memory, and I/O – are connected by a group of
           wires called the BUS
         • Address bus
                consists of 16, 20, 24, or 32 parallel signal lines (wires) - unidirectional
                these lines contain the address of the memory location to read or written
         • Control bus
             • consists of 4 to 10 (or more) parallel signal lines
             • CPU sends signals along these lines to memory and to I/O ports
                 • examples: Memory Read, Memory Write, I/O Read, I/O Write
         • Data bus
             •   consists of 8,16, or 32 parallel signal lines
             •   bi-directional
             •   only one device at a time can have its outputs enabled,
             •   this requires the devices to have three-state output
                                                Address bus
           • CPU reads/writes data from the memory by addressing a specific
             location; outputs the location of the data on the address buss; memory
             uses the address to access the proper data
           • Each I/O device (such as monitor, keypad, etc) has a unique address as
             well (or a range of addresses); when accessing a I/O device, CPU places
             its address on the address bus. Each device will detect if it is its own
             address and act accordingly
           • Devices always receive data from the CPU; CPU never reads the address
             buss (it is never addressed)
                                                                                                      10
lect 3                                                                                   4/19/2025
                                          Data bus
         • When the CPU reads data from memory, it first outputs the address on the
           address bus, then the memory outputs the data onto the data bus; the CPU
           reads the data from data bus
         • When writing data onto the memory, the CPU outputs first the address on the
           address bus, then outputs the data onto the output bus; memory then reads
           and stores the data at the proper location
         • The process to read/write to a I/O device is similar
                                       Control bus
              • Address and data buses consist of n lines, which combine to transmit
                one n bit value; control bus is a collection of individual control
                signals
              • These signals indicate whether the data is to be read into or written
                out the CPU, whether the CPU is accessing memory or an IO device,
                and whether the I/O device or memory is ready for the data transfer
              • This bus is mostly a collection of unidirectional signals
                                                                                               11
lect 3                                          4/19/2025
         Expanded Microprocessor-Based System
         •   Note the directions
             of:
              • address bus
              • Data bus
              • Control signals
         •   What is the width of
             the:
              • address bus?
              • Data bus?
                                                      12