1 intro to micro

Upload: alex-cao

Post on 07-Apr-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 1 Intro to Micro

    1/18

    CoE

    115

    Lectur

    e1

    IntroductiontoM

    icroController

  • 8/3/2019 1 Intro to Micro

    2/18

    Z8

    0Microprocessor-based

    System

  • 8/3/2019 1 Intro to Micro

    3/18

    Microcontroller

  • 8/3/2019 1 Intro to Micro

    4/18

    Micro-C

    vsMic

    ro-P(pinouts)

  • 8/3/2019 1 Intro to Micro

    5/18

    Microcontroller

  • 8/3/2019 1 Intro to Micro

    6/18

    ProcessorA

    rchitecture

    TheRISCarc

    hitecture

    s

    imple,hard-

    wiredinstruc

    tionswhichoftentake

    o

    nlyoneora

    fewclockcy

    clestoexecute.

    s

    mallandfixedcodesize

    withcomparativelyfew

    instructionsa

    ndfewaddressingmode

    s.

    e

    xecutionofinstructionsisveryfast,b

    utthe

    instructionse

    tisrathersimple.

  • 8/3/2019 1 Intro to Micro

    7/18

    ProcessorA

    rchitecture

    TheCISCarc

    hitecture

    c

    haracterized

    byitscomp

    lexmicrocod

    ed

    instructionsw

    hichtakemanyclockcyclesto

    e

    xecute.

    o

    ftenhasala

    rgeandvariablecodesizeandoffers

    m

    anypowerfulinstruction

    sandaddressingmodes

    .

    I

    ncomparisontoRISC,C

    ISCtakeslongerto

    e

    xecuteitsin

    structions,buttheinstruc

    tionsetis

    m

    orepowerful.

  • 8/3/2019 1 Intro to Micro

    8/18

    8

    Microco

    ntrollerCompone

    nts

    Mem

    ory

    E

    achmemory

    locationhas

    a

    specificadd

    ress

    W

    emustsupplyan

    a

    ddresstoaccessthe

    correspondinglocation

    R

    /Wallowsustoselect

    readingorwriting

    V

    arioustypes

    ofmemory

    fordifferentfu

    nctionsand

    speeds

    Mem

    orylocation0

    Mem

    orylocation1

    Mem

    orylocationn-1

    Mem

    orylocationn-2

    address

    data

    r/w

  • 8/3/2019 1 Intro to Micro

    9/18

    9

    Microco

    ntrollerCompone

    nts

    Mem

    ory

    ReadOnlyMem

    ory-Memorythatcanonlyberead

    Holdstheprogra

    mcodeforamic

    roprocessorused

    inan

    embeddedsyste

    mwherethecodeisalwaysthesa

    meandis

    executedeverytimethesystemisswitchedon

    ComputerBIOS,boot-upinformation

    O

    thertypesofR

    eadOnlyMem

    ory

    ErasableProgra

    mmableReadOn

    lyMemory(EPROM)Similarto

    ROMbutcanbe

    erased(exposur

    etoultravioletlight)and

    reprogrammed

    ElectricallyEras

    ableProgrammab

    leReadOnlyMe

    mory

    (EEPROM)morecommonthatEPROMbecause

    itcanbe

    erasedbythem

    icroprocessor

    FlashMemory,F

    erroelectricRAM

    (FRAM),MagneticRandom

    AccessMemory

    (MRAM)

  • 8/3/2019 1 Intro to Micro

    10/18

    10

    Microco

    ntrollerCompone

    nts

    Mem

    ory

    Ra

    ndomAccessMe

    moryusedtostoredynamicdata

    when

    processorisrunning

    Holdsprogramcodeanddataduringexecution

    Canbeaccessesinanyrandomorde

    runliketakesord

    isks

    So

    metypesofRAM

    StaticRAM(SRAM

    )Usestransistorstostorebits,fastSRAMisusedfor

    cache

    DynamicRAM(DR

    AM)Usescapac

    itorstostorebits,m

    ustberefreshed,

    smallerandcheap

    erthanSRAM

    FastPageMode(FPM),ExtendedDa

    taOut(EDO)

    SynchrounousD

    RAM(SDRAM)intr

    oducedin1997andreplacedmost

    DRAMincompu

    tersby2000

    DoubleDataRa

    te(DDRSDRAM)u

    sesbothclockedges

    foundtodayin

    mostcomputers

    DirectRambusDRAM(RDRAM)so

    mewhatofaflop

  • 8/3/2019 1 Intro to Micro

    11/18

    11

    M

    icrocontrollerComponentsCPU

    Smartpart

    Processesinstru

    ctionsanddata

    Allthepartsofa

    microprocessor

    Registersfast

    memoryusedto

    st

    oreoperandsandother

    in

    formation

    Conditionregister

    positive/negativeresult

    Exceptionregist

    eroverflow

    condition

    Loopcountregister

    Load-storearchitecture

    R

    egister0

    R

    egister1

    Re

    gistern-1

    da

    ta

    address

    r/w

    CPU

    ALU

    in

    st

  • 8/3/2019 1 Intro to Micro

    12/18

    ProcessorCore

  • 8/3/2019 1 Intro to Micro

    13/18

    13

    Microcon

    trollerCo

    mponen

    tsI/O

    C

    onnection

    totheouts

    ideworld

    E

    xamples

    AnalogtoD

    igitalConve

    rter

    TemperatureSensor

    Display

    CommunicationsCircuit

  • 8/3/2019 1 Intro to Micro

    14/18

    14

    M

    icrocontrollerComponentsBUS

    G

    roupofwiresusedtotra

    nsportinform

    ation

    C

    PUtoMemo

    ry

    Addressbus

    Databus

    C

    PUtoI/O

    Portmapped

    I/Ousedwh

    enaddressspaceislimited,

    specialinstru

    ctionsareneededforI/O

    Memorymap

    pedI/OI/Olookslikememorylocations,

    easiertouse

    andcommoninReducedIns

    tructionSet

    Computing(R

    ISC)

  • 8/3/2019 1 Intro to Micro

    15/18

    15

    Mach

    ine-leve

    lExecu

    tion

    Mach

    ineinstruction

    :

    Abundleofbin

    arybitswithcerta

    informats

    Onlyasksfors

    impleoperations

    Assembly:textualnotationsofm

    achineprogram

    Exam

    ple:

    c=a+b;

    Mach

    ineexecution:

    r1mem(a

    )

    r2mem(b

    )

    r3ADDr

    1,r2

    mem(c)r

    3

  • 8/3/2019 1 Intro to Micro

    16/18

    16

    Mach

    ine-LevelExecu

    tion

    Data

    In

    struction

    Stack

    I/O

    address

    mem

    ory

    CPUF

    etchinst Store

    Load

  • 8/3/2019 1 Intro to Micro

    17/18

    17

    Majo

    rInstructionTypes

    Arithmetican

    dlogic:Add,subtract,multiply,

    divide;and,

    or,not,xor

    Dat

    amoveme

    nt:transfe

    rdatabetw

    een

    registersand/ormemories

    Control:Bran

    chesandjumps

  • 8/3/2019 1 Intro to Micro

    18/18

    18

    Proc

    essorPerformance

    CPUTime

    =#Cycle

    sCycleTime

    =#InstructionsC

    PICycleTime

    CPI:Cyclesperinstructio

    n