Embedded Software 1 - ECE Student Information by hcj

VIEWS: 0 PAGES: 38

									Embedded Software 1

   Dr. Richard Conway
          BM025
  Richard.conway@ul.ie
           Aims & Objectives
The aim  of the module is to provide an
 introduction to embedded processor systems and
 applications. The main objectives are to provide
 the student with an overview of the architecture of
 a simple microprocessor, to explain the operating
 principles and provide a functional understanding
 of assembly language.
                               Syllabus
   Describe what an embedded system          Detail assembler directives and the
    is. Detail application areas and           program translation
    examples.                                  process. Review the build and load
   Introduce a simple microprocessor          process for embedded application
    architecture – Registers, buses, and       programs. Introduce simulation
    memory organization and how it is          tools and debugging techniques.
    used in embedded applications.             Introduce the monitor program and
    Describe memory and I/O devices.           how to use it to test applications
    Explain memory and I/O accesses.           using target hardware.
   Detail instruction machine formats,       Describe how to
    and instruction decoding. Introduce        control/communicate with I/O
    instruction sets, addressing modes,        devices through polling and
    data move instructions, arithmetic         interrupts. Interrupt service
    instruction, stack operation and           routines, interrupt priority,
    usage, Program flow control                multiple interrupts, nesting.
    instructions, sub routines and            Use practical programming
    loops.                                     examples to illustrate concepts.
          Module Evaluation
 Final Exam      60% written exam
 Term Work       20% lab
                 20% midterm
 Lab starts week 4
 Repeat Exam 100% written exam
               Module Information
Recommended Text.
   “The 8051 Microcontroller”, 3rd Edition.I. Scott
    MacKenzie, 1999

   Available in Bookshop and Library (long term loan)

 8052   tutorial available on
    http://www.8052.com
                Embedded System
 Computing    systems widely used today
    PCs,  laptops, Palm pilot, Servers
    Easily identifiable as computing systems
    Can easily change the operation
        Add programs/applications
        Add hardware resources

 Embedded     System
    Microwave,   mobile phone, EMU in car, digital camera, etc…
    Computing system that is embedded within a device/system
    May not be obvious from the outside
    Often fixed in operation
    Volume of sales in billions
               Basic components of a
                 computing system
 All   computing systems (big or small) contain
     CPU   – brains of the system. Executes instructions
     Memory – storage. Stores program (instructions) and data
     Input/Output – Interaction with outside world

 Communication        achieved with buses
     Groups    of signals to carry the data, address and control info

                CPU            Memory         I/O



  External                                             Control
  System Bus                                           Address
                                                       Data
                      Buses
A bus   is a collection of signals (wires) that are
 collectively referred to by a common name that
 identifies their common purpose
  Example   is the address bus. Could consist of 16
   individual wires.
Rather than drawall the signals, a wider shape is
 used on schematics
                          Address Bus
 The numberof address lines that a CPU has determines the
 amount of memory that can be used with the CPU*
    16 address lines allow 65536 (or 64K) unique address locations.
    For n address lines, there are 2n unique address locations

 In CPU    systems, the CPU supplies the address
    This   could be the address of a memory location or an I/O device
                  CPU               Memory              I/O



   External                                                       Control
   System Bus                                                     Address
                                                                  Data

 * This is without consideration of paging and memory management (MM) techniques
                           Data Bus
 The data  bus is used to            For example,   an 8 bit
  transfer data between                processor has internal
     Memory   and CPU                 registers of size 8 bits and
     I/O devices and CPU              would have an 8 bit data bus
     I/O devices and Memory          Clearly a bigger data bus
 The transfer  can be either          means that more data can
  way, so the data bus is a bi-        transferred, but this is at the
  directional bus                      cost of more pins and wider
 Data bus size is normally a          memories
  multiple of 8 bits (byte) and is        High  end systems usually have
                                           wide data buses that reduce the
  usually the same size or less            bottleneck between CPU and
  than the size of the CPU’s               memory
  internal registers.
                                  Data Bus
 Databus contains data on its
 wires!
    This    could be actually represent
          Instructions
          Data Values
                > Integers, Characters,
                  Floating point values, etc…
            Addresses
                > An instruction may contain
                  an address
                > E.g. JUMP 459
                   Control Bus
These signals are used to control the transfer of
 data between memory, I/O and the CPU
The 2 most basic are
   Read  signal (1 wire)
   Write signal (1 wire)

Both areoutputs from the CPU
Other control signals include
   Reset,   interrupt and direct memory access
                           Bus cycles
 Transfer of    data occurs between
    Processor and memory
    Processor and I/O
    Memory and I/O (DMA)

 Bus   cycles are used to perform these transfers
             Cover in lecture
    Most   common types are
         Memory    read
         Memory write
         I./O read
         I/O write

 Buscycles are concerned with the synchronisation of the
 data transfer
                 Bus cycle example
                  CPU                  Memory     I/O



  External                                              Control
  System Bus                                            Address
                                                        Data

 Memory   Read bus cycle
    CPU outputs address
    CPU activates read signal
    Memory responds with data on data bus
    CPU reads data and deactivates read signal
            CPU
 Intelintroduced the first
  widely used
  microprocessor in 1971,
  the 8080
 A computing system
  could be built using the
  microprocessor, memory
  devices and I/O devices
  on a printed circuit board
              CPU
                                           Register file

                                                                     Control
                                                                     Unit

                                               ALU


 Brains   of the system                 Data S ection            C ontrol
    Controls   what operations          S ection

     happen
    Performs operations on data
                                        CPU     has 2 main parts
                                           Control        unit
 CPUunderstands a finite
                                                  Controls  and sequences
 number of instructions                             themicrosteps in the fetch-
    Actual instructions are defined                decode-execute cycle of
     by the instruction set for the                 each instruction.
     CPU                                   Datapath         section
    Example instruction                          Consists  of the register file
           ADD R1,R2,R3                            (group of registers) and the
                                                    Arithmetic Logic Unit (ALU)
Lecture 2
                                       CPU
 Datapath section is most
 important section
    Register  file, which is a group of
                                                 Instruction
                                                Register (IR)
     registers, some of which have
     general purpose use and some                                 Register File
     may have specific usage
                                           From Data
                                           bus

    Arithmetic Logic Unit (ALU),
     which is logic that performs
     operations on data, e.g.
     addition, multiplication, logical                          Program Counter
                                                                                                     To
                                                                                                     Data
     OR, etc.                                                    Register (PC)                       bus
                                                                                               ALU
 The Program  Counter (PC)
                                                                                  To Address
                                                                                  bus

 register always stores the
 address of the next instruction
 to be fetched from memory.
                                    CPU
 An instruction read from
  memory is stored in the
  instruction register (IR)                    Instruction
                                              Register (IR)

  register
     The control unit decodes the       From Data
                                                                Register File

     instruction to determine what       bus

     the instruction is and what to do
     to execute the instruction
 Afterthe instruction is                                                                          To
  executed, the same steps are
                                                              Program Counter                      Data
                                                               Register (PC)                       bus

  repeated, I.e                                                                 To Address
                                                                                bus
                                                                                             ALU

                     A series of instructions that
     Fetch
                     are combined to perform a
     Decode         task form a program. As
     Execute        such the CPU operates under
                     the control of a program
         Example operation of CPU
Memory                                                    CPU

                                          INC R0
                                 Instruction    Decode
            Data bus            Register (IR)
                                  371
                                                  Register File
               Fetch       From Data
                           bus



   371
            Address bus
                                                       98
                                                       97                            To
                                                Program Counter                      Data
                                                 Register (PC)                       bus
                                                                               ALU
             Read Signal                                          To Address
                                                                  bus

            Write Signal
                                                   Execute
                          Memory
Programs and data are stored in memory
Types of computer memory include
  Semiconductor,        considered primary
      Common       classification is ROM (non-volatile) and RAM
       (volatile)
  Magnetic    and optical, considered secondary
CPU communicates directly with semiconductor
 memory.
                  Main Memory
 RAM




   Random   Access Memory that can be read
    from and written to. Contents are volatile, so
    contents are lost when power removed
   This type of memory is fast. Memories for
    computers are rated by their capacity in
    bytes.
 ROM
   Read  Only Memory can only be read from.
    Contents are non-volatile, so contents are
    NOT lost when power is removed
   Also fast access
     Abstract view of memory

Addresses
        n
       2

Number of bits
at each address

       m
                Microcontroller
 A device  similar to the       Original  8051 had an 8-bit
  microprocessor is a             CPU, 4K program memory,
  microcontroller                 128 bytes of RAM and I/O
 Early example is the Intel      functions (ports, timers and
  8748 microcontroller            serial transmission support) all
 The key difference is the       on a single chip!
  integration of memory and
  basic I/O functions on a
  single chip and low cost
 The 8051 introduced in 1980
Examples of microcontroller
           uses
Fully working 8051 system!
                          Micrcontroller
 Many   other companies that produce other microcontollers
    Microchip,   Motorola, Atmel, Philips, Hitachi, etc …
    Differ in internal architecture, instruction set, speed, size of on-chip
     memories, package sizes, I/O support, power consumption, register size,
     cost
 Companies       other than Intel make 8051 devices
    Philips,   Atmel,Cover in lectureCygnal, etc…
                      Analog Devices,
 Despitebeing over 25 years old, the 8051 microcontroller is still
 widely used! This is due to it’s proven track record and a wide
 knowledge base
    Unlikepersonal computing where increased throughput is constantly
    required, there are still many embedded (not all) that require a low cost
    and simple microcontroller
                           Microcontroller vs
                            Microprocessor
               Microprocessor                                          Microcontroller
Microprocessor is a single chip CPU and requires        Microcontroller is a single chip with CPU, memory
many additional devices to form working system          (small amount) and I/O

Medium to high cost for system                          Low cost for system
Application is in microcomputer systems, with           Application is in embedded system with fixed
operation system and application software.              programs and low component count (also fixed).
Software and hardware can be easily upgraded            Typically control oriented application
Instruction set and internal architecture focused for   Instruction set and internal architecture focused on
processing intensive operations and can support         control of I/O and efficient use of on-chip resources.
many addressing modes (CISC machines) and               This can include bit instructions.
support of operating systems (OS).
Small amount of ROM relative to amount of RAM           Large amount of ROM relativeto small amount of
and secondary memory. E.g. 128K ROM, 512M               RAM and usually no secondary memory. E.g. 32K
RAM and 80 G Harddisk                                   ROM, 4K RAM
Appendix Week 1
  




Ad from 1970s for 8080
Pentium
General Purpose Computing
          System
                      Magnetic Disks

   Types
        Hard disks
        Floppy disks
        Zip disks
   Provide long term storage (non-volatile).
        A hard disk cannot normally be removed and is
         fixed internally in the computer.
        A floppy disk and zip disk can be removed or
         inserted as needed.
   Disks store data using magnetic media.
   Accessing data on these disks is much slower
    than RAM.
   Also known as secondary storage
             Other types of Storage
   Optical Disks
       CD-ROM and DVD


   Flash Memory Drives
       Uses Flash
        Semiconductor
        Technology
           Memory sticks
Exercises Week 1
                        Exercises
1.      What are the basic components of a computing
        system?
2.      With respect to a computing system, what is a bus?
3.      Describe the 3 buses that are used in a computing
        system.
4.      Using Figure 1., detail the steps that are involved in a
        memory write bus cycle
                  CPU        Memory        I/O               Figure 1.


     External                                      Control
     System Bus                                    Address
                                                   Data
                   Exercises
5.    What is CPU an acronym for?
6.    What are the main sections of a CPU?
7.    What is the purpose of the PC register?
8.    What is the purpose of the IR register?
9.    Fill in the missing word. The CPU operates by
      repeatedly performing ________, decode and
      execute operations.
10.   What is a non-volatile memory?
                           Exercises
11.    What is an ALU?
12.    List 5 examples of embedded systems
      1.   In the home
      2.   In University
      3.   In a car
13.    What are the differences between a
       microcontroller and a microprocessor?
14.    How many components (approximately) are
       needed for a simple working microcontroller
       system

								
To top