Lecture 7 cpu family

download Lecture 7 cpu family

of 31

Transcript of Lecture 7 cpu family

  • 7/29/2019 Lecture 7 cpu family

    1/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    ME 4447/6405

    Microprocessor Control of Manufacturing Systems

    and

    Introduction to Mechatronics

    Instructor: Professor Charles Ume

    Lecture #7

  • 7/29/2019 Lecture 7 cpu family

    2/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

  • 7/29/2019 Lecture 7 cpu family

    3/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    RAMRandom Access Memory

    Volatile loses contents after power off

    ROMRead Only Memory

    non-Volatile

    Contents must be programmed at the factory

    EPROMElectrically Programmable Read Only Memory

    non-Volatile

    Electrically programmable

    May be erasable with ultraviolet light if manufacturer included window in

    chip package

    Still considered Read Only Memory during normal program execution

    EEPROMElectrically Erasable Programmable Read Only Memory

    non-Volatile

    Electrical

    ly programmable and erasable (Note:Sometimes higher voltage than

    microcontroller voltage may be required)

    Slower to write to than RAM so still considered Read Only Memory duringnormal program execution

  • 7/29/2019 Lecture 7 cpu family

    4/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Product Designations found in literature is shown below:

  • 7/29/2019 Lecture 7 cpu family

    5/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Product Family Members as of 3/2008

  • 7/29/2019 Lecture 7 cpu family

    6/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

  • 7/29/2019 Lecture 7 cpu family

    7/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    MC9S12C-Familypackage options:

    48-pin Low-profile Quad Flat Package (LQFP)52-pin Low-profile Quad Flat Package80-pin quad flat package (QFP) (Shown)

  • 7/29/2019 Lecture 7 cpu family

    8/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405 MC9S12C-Family Block Diagram shows available subsystems

    Figure1-1. MC9S12C-Family

    Block Diagram

  • 7/29/2019 Lecture 7 cpu family

    9/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

  • 7/29/2019 Lecture 7 cpu family

    10/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Figure 6. Register and Control Bit Assignments (Programming Reference)

    .

    .

    .

    Excerpt of Detailed Register Map (Device User Guide)

  • 7/29/2019 Lecture 7 cpu family

    11/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    .

    .

    .

  • 7/29/2019 Lecture 7 cpu family

    12/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Excerpt of Detailed Register Map (Device User Guide)

  • 7/29/2019 Lecture 7 cpu family

    13/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

  • 7/29/2019 Lecture 7 cpu family

    14/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Hardware Mode Selection Summary (Reference Manual)

    MODA, MODB, & MODC may be writable in software after startup, see Reference

  • 7/29/2019 Lecture 7 cpu family

    15/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    In Single Chip mode, Ports A, B andE available as general purposeinput/output pins

    In Narrow Expanded Mode, Ports Aand B form 16-bit Address and 8-bit

    Data bus, Port E provides controlsignals for external devices

    In Wide Expanded mode, Ports Aand B form 16-bit Address and 16-bit Data bus, Port E provides control

    signals for external devices

    Hardware Mode External Connections

  • 7/29/2019 Lecture 7 cpu family

    16/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Note: Map depends onstate of ROMON andROMHM bits

  • 7/29/2019 Lecture 7 cpu family

    17/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

  • 7/29/2019 Lecture 7 cpu family

    18/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Axiom CML-12C32 Evaluation Board

    MC9S12C32Solderless Breadboard

    Serial Port

    External SRAM

    AddressDemultiplexer

    Power Jack

    MCU Port

    Reset

    Oscillator

  • 7/29/2019 Lecture 7 cpu family

    19/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Default Configuration:

    MODC = 1MODA = MODB = 0 Single Chip Mode

    MODA and MODB may be changed in software to permit use of Expanded Wide

    mode once after each reset

    Internal Flash Memory is available only if ROMON is enabledAt the rising edge of Reset, the state of pin PP[6]/KWP[6]/ROMCTL is

    latched to the ROMON bit.

    ROMCTL = 1 ROMON Enabled, Flash memory available

    ROMCTL = 0 ROMON Disable, Flash memory unavailable

    For operation in this class, ROMON will be Enabled, so do not pull PP[6] low onReset!

  • 7/29/2019 Lecture 7 cpu family

    20/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Axiom CML-C32

    Single chip modeROMON EnabledMON12 not in use

    MODA = 0MODB = 0

    Internal User RAMavailable:$0800-$0FFF

    User can put aprogram in Internal

    Flash$8000-$FEFF

    Ports A and Bavailable for use

  • 7/29/2019 Lecture 7 cpu family

    21/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Axiom CML-C32

    Single chip modeROMON EnabledMON12 in use

    MODA = 0MODB = 0

    Internal User RAMavailable:$0800-$0DFF

    User can put aprogram in Internal

    Flash $8000-$B7FFand Internal RAM

    Ports A and Bavailable for use

    MON12 islocated here

  • 7/29/2019 Lecture 7 cpu family

    22/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Axiom CML-C32

    Expanded Wide modeROMON EnabledMON12 not in use

    (CodeWarrior)MODA = 1MODB = 1

    Internal User RAMavailable:$0800-$0FFFExternal User RAMavailable:

    $0400-$07FF$1000-$7FFFUser can put aprogram in InternalFlash $8000-$FEFF

    Ports A and B NOT

    available for use

    A

    xiom CML C32

  • 7/29/2019 Lecture 7 cpu family

    23/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405Axiom CML-C32Expanded Wide modeROMON EnabledMON12 in use

    MODA = 1

    MODB = 1Internal User RAMavailable:$0800-$0DFFMon12 RAMInterrupt Vector:

    $0F8A 0FFFMonitor Utility JumpTable:$FF10-$FF67External User RAMavailable:

    $0400-$07FF$1000-$7FFFUser can put aprogram in InternalFlash $8000-$B7FFand RAM

    Ports A and B NOTavailable for use

    MON12 islocated hereMON12 islocated here

  • 7/29/2019 Lecture 7 cpu family

    24/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Interrupt Vector TableMon12 NOT in use

    Standard S12C32Interrupt Jump Table

    Each vector is 2bytes. User storesaddress of interruptservice routine inappropriate vector

    0x is same as $: It isused when writingprogram in C

  • 7/29/2019 Lecture 7 cpu family

    25/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Interrupt Vector TableMon12 NOT in use

    Standard S12C32Interrupt Jump Table

    Each vector is 2bytes. User storesaddress of interruptservice routine inappropriate vector

  • 7/29/2019 Lecture 7 cpu family

    26/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Standard S12C32 Interrupt Jump Table (MON12 not in use)

    The user can put the starting address of his/her subroutine

    Directly in the vector field of the interrupt he/she wants to

    Use.

    Example: If the user wants to use the IRQ interrupt, he/she

    can put the starting address of his/her subroutine directly in

    vector fields $FFF2 and $FFF3

  • 7/29/2019 Lecture 7 cpu family

    27/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Interrupt Vector TableMON12 in use

    Standard S12C32 Interrupt

    Vector Jump Table is notavailable with MON12

    MON12 supplies alternateInterrupt Jump Table

    Users interrupt service routine

    must be stored in $4000-$7FFF

    Monitor Interrupt Vector Table (CML-

    C32 Users Guide)

    I t t V t T bl

  • 7/29/2019 Lecture 7 cpu family

    28/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405Interrupt Vector TableMON12 in use

    Standard S12C32 InterruptVector Jump Table is notavailable with MON12

    MON12 supplies alternateInterrupt Jump Table

    Users interrupt service routine

    must be stored in $4000-$7FFF if

    Autostart is to be used

    Monitor Interrupt Vector Table (CML-

    C32 Users Guide)

    To use the vector table, the user again writes the address of the interrupt service

    routine to the location given in the table. For example, to use the IRQ interrupt to

    call an interrupt service routine located at address ISR_ADDR, the user writes

    the following code: MOVW #$0800, $0FF2 OR MOVW #ISR_ADDR,$0FF2

    LDD #$0800STD $0FF2

    During initialization MON12 writes $0000 to all vectors in the Monitor Interrupt

    vector Table to cause any unscheduled interrupt to cause a trap. Any nonzero

    value will cause the S12C32 to jump to the interrupt service routine located at

    that value.

  • 7/29/2019 Lecture 7 cpu family

    29/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    Relationship Between Standard S12C32 Interrupt Vectors

    and MON12 Interrupt Table Vectors

    When MON12 is in use, it configures the standard interrupt vector table

    and the user may not override these values. MON12 allocates memory for

    the Monitor Interrupt Table, located from $0F8A - $0FFF. During

    initialization, MON12 clears the contents of the Monitor Interrupt Table. If

    an interrupt occurs and the corresponding vector contains $0000, MON12perceives this as an error and restarts the monitor program, ending

    execution of user code.

    MON12 uses some interrupts to accomplish its tasks, hence uses those

    vector addresses. In addition, the standard interrupt table is located in FlashEEPROM and cannot be written to using MON12. When writing programs

    in C, a BDM cable is used to program the HCS12 and the standard

    interrupt table is used.

  • 7/29/2019 Lecture 7 cpu family

    30/31

    George W. Woodruff School of Mechanical Engineering, Georgia Tech

    ME4447/6405

    COMMAND Description

    BF Block Fill Memory with Data

    BR []. Display/Set Breakpoint

    CALL [] Execute Subroutine

    G [] Begin/continue execution of user program

    HELP Display Monitor Commands

    LOAD [P] Load S-Records into memory, P = Paged S2

    MD [] Memory Display Bytes

    MM [] Memory Modify Bytes (8 bit values)

    MW [] Memory Modify Words (16 bit values)

    MOVE

    [] Move a block of memory

    RD Display all CPU registers

    OFFSET[arg] Offset for download

    Proceed Proceed / Continue from Breakpoint

    RM [p,y,x,a,b,c,s] Modify CPU Register Contents

    STOPAT Trace until address

    T [] Trace Instructions

    Mon12 Commands

  • 7/29/2019 Lecture 7 cpu family

    31/31

    George W Woodruff School of Mechanical Engineering Georgia Tech

    ME4447/6405Several subroutines from Mon12 exist that are available for performing I/O tasks. Utility subroutinesavailable to the user are as follows: