ece_362_week-1-a

Upload: doubleagent93

Post on 03-Jun-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 ECE_362_Week-1-a

    1/39

    ECE-362Microprocessor Systems and

    Interfacing

    Dr. Abdelrahman Abdelazim

    1

  • 8/12/2019 ECE_362_Week-1-a

    2/39

    Module 1 MicrocontrollerProgramming Techniques

    2

  • 8/12/2019 ECE_362_Week-1-a

    3/39

    Module 1

    Learning Outcome: An ability to program a

    microcontroller to perform various tasks

    A. Microcontroller Architecture and Programming

    Model

    B. Microcontroller Instruction Set Overview

    C. Assembly Language Programming Techniques

    Control Structures

    3

  • 8/12/2019 ECE_362_Week-1-a

    4/39

    Module 1

    D. Assembly Language Programming Techniques

    Control Structure Applications

    E. Assembly Language Programming Techniques

    Parameter Passing

    4

  • 8/12/2019 ECE_362_Week-1-a

    5/39

    Module 1-A

    Microcontroller Architecture

    and Programming Model

    5

  • 8/12/2019 ECE_362_Week-1-a

    6/39

    Reading Assignment: Lecture Note

    Week 1

    Learning Objectives:

    List differences in world views regarding the

    role of microprocessors

    Define characteristics that distinguish

    microprocessors

    Describe the PIC16F87XA architecture andprogramming model

    6

  • 8/12/2019 ECE_362_Week-1-a

    7/39

    Reading Assignment: Lecture Note

    Week 1

    Learning Objectives:

    List differences in world views regarding the

    role of microprocessors

    Define characteristics that distinguish

    microprocessors

    Describe the PIC16F87XA architecture andprogramming model

    7

  • 8/12/2019 ECE_362_Week-1-a

    8/39

    Outline

    Characteristics that distinguish

    microprocessors

    Taxonomy of microprocessors from an

    application viewpoint

    Basic architecture of the PIC16F877A

    Instruction formats and data types of thePIC16F877A

    8

  • 8/12/2019 ECE_362_Week-1-a

    9/39

    Introduction

    Two basic world views regarding the role of

    microprocessors are applicable

    general-purpose view :a microprocessor is an integral part

    of a machine that runs shrink-wrapped software (or onwhich user-programmed applications can be shrink-

    wrapped software (or on which user-programmed

    applications can be developed and run)user

    programmable

    embedded view : a microprocessor is a basic digital system

    building block that can be used to build intelligent

    productsnon-user-programmable

    9

  • 8/12/2019 ECE_362_Week-1-a

    10/39

    Introduction

    Why this distinction is important:

    different architectural/organizational characteristics of

    microprocessors can make them more/less suited

    for a given application the goodness or badness of a particular

    microprocessor can only be evaluated in the

    context of the intended application

    10

  • 8/12/2019 ECE_362_Week-1-a

    11/39

    Microprocessor Control Systems

    Digital control systems are designed to allow a particular set of logical

    operations to be carried out. Digital electronic circuits, using logic gates,

    can be used to control many devices.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    12/39

    Hardwired Systems

    Systems using logic gates are simple to design and are cheap and

    easy to assemble in circuits. Individual chips can be interconnected to

    provide complex control functions.

    For example, D-type latches on their own are limited in their

    capabilities, but with other identical chips can be made to produce

    binary counters, shift registers and latches.

    This type of circuit is known as Hardwired.

    Hardwired systems can be made either by using individual components

    (Integrated Circuits or ICs) on a Printed Circuit Board (PCB) or

    produced directly in a customised IC.

    Drawback is that once a system is designed and manufactured, it

    cannot be changed without redesigning the hardware used.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    13/39

  • 8/12/2019 ECE_362_Week-1-a

    14/39

    Microprocessor Control Systems

    Consider a customer buying a cup of coffee from a vending machine.

    The customer pays, chooses the type of drink and places an empty cup

    underneath the dispenser.

    The machine detects the cup and fills itwith coffee, dispensing the exact amount

    to fill the cup. This ensures that the cup is

    not overfilled and that deliberate attempts

    to fill larger cups are prevented.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    15/39

    Hardwired & Software Controlled System

    Consider that the manufacturer of the vending machine has decided

    that the cup size being used is too small. All the vending machines

    need to be updated to use the new size cups.

    If a hardwired design had been used,

    replacement or modification of the

    hardware in each machine would be

    required. This would be expensive.

    If the machines are software controlled,

    the software could simply be replaced or

    modified at minimal cost.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    16/39

    Hardwired & Software Controlled System

    Below is a list of advantages and disadvantages of hardwired systems:

    Simple to make, quickly and cheaply.

    Hardwired systems cannot easily be upgraded or modified without

    changing components.

    Relatively easy to understand and gives a predicable output.

    Hardwired systems usually have faster speeds of operation than

    software controlled systems.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    17/39

    Hardwired & Software Controlled System

    Below is a list of advantages and disadvantages of software controlled

    systems:

    Versatile and can be used in a number of different applications.

    Function can be modified by changing its program code in situ.

    Can be more expensive to produce than hardwired systems

    for simple projects.

    Can contain errors (bugs) which cause unpredictable results.

    Require greater amounts of testing due to the added complexity

    of the system.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    18/39

    1

    A) Speed is slower than software systems

    B) Expensive to make

    C) Difficult to change function

    D) Slow to assemble

    Which of the following is a disadvantage of hardwired systems?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    19/39

    2

    A) Versatile

    B) Less expensive to produce than hardwired systems

    C) Does not require extensive testing

    D) Works reliably first time

    Which of the following is an advantage of software based control

    systems?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    20/39

    Structure of a Microprocessor System

    This diagram represents a very simple microprocessor system.

    As you can see, this is similar to the simple Input - Process - Output

    system diagram:

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    21/39

    Next >

    Structure of a Microprocessor System

    Microprocessor systems have the ability to connect to several input and

    output devices at the same time.

    Inputs might include: mouse, keyboard, scanner.

    Outputs might include: screen, loudspeaker, printer.

    Some of these input and output devices are built into the system.

    Others have to be plugged in to the system. Where an input or output

    device is plugged in, it is accessed by the computer through a port.

    Some devices that are plugged into computers are both inputs and

    outputs: a modem for example both transmits and receives data.

    There are several different types of port. Some transmit data serially

    while others transmit data in parallel, for example, RS232 (serial),

    Centronics (parallel), USB (Serial).

  • 8/12/2019 ECE_362_Week-1-a

    22/39

    Next >

    Structure of a Microprocessor System

    The processor connects to several input and output ports, as well

    as memory, at the same time.

    This requires a more complex connection system.

    The processor needs to be able to select which sub-system it needs to

    talk to, decide whether it is sending or receiving, and then send or

    receive data.

  • 8/12/2019 ECE_362_Week-1-a

    23/39

    Structure of a Microprocessor System

    The connection system

    uses three buses.

    The address busgoes

    from the CPU to the

    memory and input / outputports.

    Each sub-system that the

    CPU connects to has a unique address.

    The CPU sends the address on the

    address bus to identify the subsystem it

    needs to connect to.

    The control busdetermines whether the data is to be sent or received.

    The data can then be transmitted along the data bus.

    Next >

    A bus is just one or more conductors connecting the sub-systems

    together.

  • 8/12/2019 ECE_362_Week-1-a

    24/39

    3

    A) Address bus

    B) Serial Port

    C) Control bus

    D) Data bus

    Which connection system carries the signal that determines whether data

    is to be written to or read from, memory?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    25/39

    Single Chip Microprocessor Systems

    A microcontroller is a single IC

    containing a central processing

    unit, memory, input / output ports

    and internal clock.

    Microcontrollers provide a one-

    chip design instead of requiring

    several separate components.

    Microcontrollers are used in

    domestic appliances, automobiles,electronic locks, security devices,

    smart cards, timers, and serial

    communication.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    26/39

  • 8/12/2019 ECE_362_Week-1-a

    27/39

    4

    A) Peripheral Intelligent Connector

    B) Peripheral Interface Connector

    C) Peripheral Interface Controller

    D) Peripheral Intelligent Connector

    What do the initials PIC stand for?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    28/39

    5

    A) 2000 - 2003

    B) 1997 - 2000

    C) 1995 - 1997

    D) 1990 - 1995

    Approximately, when did PIC use increase dramatically?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    29/39

    Microprocessor Architectures

    Two types of architectures used in modern processors. Von Neumann

    architecture used in the Z80 to the modern Pentium chips.

    PIC devices use the Harvard architecture. Differs from the Von

    Neumann type by having separate memories for program code and

    data, so can be accessed independently and simultaneously.

    Von Neumann system stores data and program code together in one

    memory space. Disadvantage of only allowing the CPU to access

    either data or the program memory at any one time.

    Advantage of the Harvard architecture is that it reduces the time

    taken to retrieve the instructions, and so is more efficient.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    30/39

    6

    A) Z80

    B) Harvard

    C) Von Neumann

    D) Pentium

    What is the name of the architecture used in PICs?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    31/39

    7

    A) Harvard

    B) Von Neumann

    C) Z80

    D) Pentium

    Which architecture system stores program code and memory

    code in different locations?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    32/39

    8

    A) Von Neumann

    B) Pentium

    C) Z80

    D) Harvard

    Which is the more efficient architecture for microcontrollers?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    33/39

    Instruction Sets

    Language used by the microcontroller is

    divided into a number of instructions.

    The Instruction Setdetermines

    what functions the microcontroller

    can perform and how instructions

    need to be written.

    This list of instructions is called

    the instruction set.

    Architecture of microcontrollers

    may be further classified into the

    types of instruction sets they use.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    34/39

    9

    A) A notice

    B) An instruction

    C) A message

    D) A function

    In order to get a microcontroller to do something, what must

    we give it?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    35/39

    Instruction Sets

    CISC (Complex Instruction Set Computer)

    Microcontrollers and microprocessor systems which use CISC systems,

    have a large quantity of very detailed instructions.

    RISC (Reduced Instruction Set Computer)

    A reduced instruction set is made up of a small number of key

    instructions. PICs use this type of instruction set and have about 35

    instructions.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    36/39

    10

    CISCs have a large number of detailed instructions. Is

    this true or false?

    Answer True or False.

    Question

  • 8/12/2019 ECE_362_Week-1-a

    37/39

    11

    Approximately how many instructions can a PIC chip

    programmed using RISC understand?

    Question

  • 8/12/2019 ECE_362_Week-1-a

    38/39

    Social and Economical Benefits

    Microcontrollers have many advantages over microcomputers, primarily

    because of the reduction in external components. This provides the

    following benefits:

    Reduction in costs - smaller number of components required.

    Increased system reliability - fewer components mean a smallerlikelihood of the system failing.

    Reduced power consumption - fewer components mean less powerrequired for the system.

    Program Code can be upgraded, in situ, - programs can be written tothe PIC while in a system.

    Reduced Electromagnetic emissions - having fewer componentsreduces the electromagnetic emissions produced by a device.

    Size - the small size of a microcontroller enables it to be usedin small devices.

    Next >

  • 8/12/2019 ECE_362_Week-1-a

    39/39

    12

    A) Increased reliability

    B) Reduced costs

    C) Increased portability

    D) Reduced number of components

    A microcontroller has one main advantage over a

    microcomputer, which gives rise to many benefits. What is

    it?

    Question