Lab 2 Microprocessor MPC430F2274 MSP-430 Architecture.

Slides:



Advertisements
Similar presentations
Homework Reading Machine Projects Labs
Advertisements

Computer Architecture
Chapter 3 Basic Input/Output
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
I/O Unit.
Processor System Architecture
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
1 中斷 Interrupt. 2 謂何需要 Interrupt I/O  Busy/wait I/O is very inefficient. CPU can ’ t do other work while testing device. Hard to do simultaneous I/O.
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
Interfacing. This Week In DIG II  Basic communications terminology  Communications protocols  Microprocessor interfacing: I/O addressing  Port and.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: internal fault (e.g.. divide by.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Hardware/software Interfacing. Page 2 Interrupt handling and using internal timer Two way for processor to accept external input: Waiting for input: Processor.
© 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. CPUs Input and output. Supervisor mode, exceptions, traps. Co-processors. 1.
Computer Organization and Assembly language
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
Group 7 Jhonathan Briceño Reginal Etienne Christian Kruger Felix Martinez Dane Minott Immer S Rivera Ander Sahonero.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Programming & Development of Mobile & Embedded Systems Lin Zhong ELEC424, Fall 2010.
1 © Unitec New Zealand Embedded Hardware ETEC 6416 Date: - 10 Aug,2011.
Input / Output CS 537 – Introduction to Operating Systems.
Interrupts. 2 Definition: An electrical signal sent to the CPU (at any time) to alert it to the occurrence of some event that needs its attention Purpose:
C.S. Choy95 COMPUTER ORGANIZATION Logic Design Skill to design digital components JAVA Language Skill to program a computer Computer Organization Skill.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
CPUs Input and output. Supervisor mode, exceptions, traps. Co-processors.
MICROPROCESSOR INPUT/OUTPUT
© 2000 Morgan Kaufman Overheads for Computers as Components CPUs zInput and output mechanisms zInterrupts zMemory management unit (MMU) zCache mechanism.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Top Level View of Computer Function and Interconnection.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
© 2000 Morgan Kaufman Overheads for Computers as Components CPUs zInput and output. zSupervisor mode, exceptions, traps. zCo-processors.
80386DX functional Block Diagram PIN Description Register set Flags Physical address space Data types.
Computer Organization CDA 3103 Dr. Hassan Foroosh Dept. of Computer Science UCF © Copyright Hassan Foroosh 2002.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
IT3002 Computer Architecture
© 2000 Morgan Kaufman Overheads for Computers as Components CPUs zInput and output. zSupervisor mode, exceptions, traps. zCo-processors.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Group 1 chapter 3 Alex Francisco Mario Palomino Mohammed Ur-Rehman Maria Lopez.
بسم الله الرحمن الرحيم MEMORY AND I/O.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Transmitter Interrupts Review of Receiver Interrupts How to Handle Transmitter Interrupts? Critical Regions Text: Tanenbaum
Computer Architecture Furkan Rabee
Lecture 2 Interrupts.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Lecture 3 Memory.
UNIT – Microcontroller.
I/O Interface and Interrupt Systems
Dr. Michael Nasief Lecture 2
E3165 DIGITAL ELECTRONIC SYSTEM
Overheads for Computers as Components 2nd ed.
COMPUTER PERIPHERALS AND INTERFACES
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
CNET 315 Microprocessor & Assembly Language
Chapter 13: I/O Systems.
Presentation transcript:

Lab 2 Microprocessor MPC430F2274

MSP-430 Architecture

Types of memory ROM (read-only memory, non-volatile): –Mask-programmable: programmed by manufactory and not by user, can not be modified –Flash programmable: can be modified, all the memory is flashed and programmed again RAM (random access memory for writes): –DRAM(dynamic): each bit of data requires separate capacitor and transistor of the integrated circuit, dynamic since must be refreshed periodically otherwise info fades. –SRAM(static): does not need refresh, each bit requires six transistors

MSP-430 Memory Map

Bits, Bytes and Words in memory

Flash / ROM RAM See file “lnk430F2274.xcl” for more details about the memory map.

Memories MPC430 – 2274 has the following memory size: Flash: 32 KB RAM: 1KB

Peripherals Are connected to CPU through data, control and address buses using instruction set. Consist of: 1.Clock system – used by CPU and peripherals. 2.Brownout – provides internal reset signal during power off/on. 3.Digital four 8-bit I/O ports: Any combination of input, output and interrupt condition is possible. Read/write to port control registers are supported by all instructions.

4.Watchdog timer: Primary function is to perform system reset after a software problem occurs. If the selected time interval is expired, a systems reset is generated. If watchdog function is not needed in the application, it can perform secondary function: can be configured as interval timer and can generate interrupts after certain time interval.

5.Timer_a3, Timer_b3: 16 bit timer/counter with three capture/compare registers. Interrupts may be generated from counter overflow condition and from each of the capture/compare registers. 6.

7. 8.

Peripherals

See msp430x22x4.h file

See msp430x22x4.h file

CPU

RISC vs. CISC Complex instruction set computer (CISC): –many addressing modes; –many operations. Reduced instruction set computer (RISC): –load/store; –pipelinable instructions.

For code efficiency, it is better to use CISC. RISC processor designed for speed and not for code size efficiency. CISC designed for code size efficiency since connects to slow devices. Compressed instruction set is stored.

CPU block diagram

Buses The system interconnect using Memory Address Bus (MAB) and Memory Data Bus (MDB)

RISC 16-bit CPU

Exercise 1 Learn the instruction set, the addressing modes and special registers. Write the Fibonacci program that we saw in C language in the class, using assembler code. All relevant documents are on the website.

Interrupt I/O Busy/wait is very inefficient. –CPU can’t do other work while testing device. –Hard to do simultaneous I/O. Interrupts allow a device to change the flow of control in the CPU – allow parallelism. –Causes subroutine call to handle device.

Interrupt interface CPU status reg data reg mechanism PC intr request intr ack data/address IR

Interrupt behavior Based on subroutine call mechanism. Interrupt forces next instruction to be a subroutine call to a predetermined location. –Return address is saved to resume executing foreground program.

Interrupt physical interface CPU and device are connected by CPU bus. CPU and device handshake: –device asserts interrupt request; –CPU asserts interrupt acknowledge when it can handle the interrupt.

Example: character I/O handlers /* interrupt handlers */ void input_handler() { global_achar = peek(IN_DATA);// get char global_gotchar = TRUE;// signal to main poke(IN_STATUS,0); // reset status } void output_handler() { //nothing to do } Example: read from input and write on output

Example: interrupt-driven main program main() { while (TRUE) { if (global_gotchar) { poke(OUT_DATA,global_achar); poke(OUT_STATUS,1); global_gotchar = FALSE; } Still no foreground job is executed!

© 2000 Morgan Kaufman Overheads for Computers as Components Example: interrupt I/O with buffers Queue for characters: headtail headtail a

Buffer-based input handler void input_handler() { char achar; if (full_buffer()) error = 1; else { achar = peek(IN_DATA); add_char(achar); } poke(IN_STATUS,0); if (nchars == 1) //buffer was empty until //this interrupt, no //output is waiting { poke(OUT_DATA,remove_char(); poke(OUT_STATUS,1); } }

Buffer-based output handler void output_handler() { char achar; if (!empty_buffer()) { poke(OUT_DATA,remove_char(); poke(OUT_STATUS,1); }//turn on device }

I/O sequence diagram :foreground:input:output:queue empty a b bc c foreground job is executed!

Debugging interrupt code What if you forget to change registers? –Foreground program can exhibit mysterious bugs. –Bugs will be hard to repeat---depend on interrupt timing. Interrupt never occurs in the middle of instruction execution, but before it or after it.

Priorities and vectors Two mechanisms allow us to make interrupts more specific: –Priorities determine what interrupt gets CPU first. –Vectors determine what code is called for each type of interrupt. Mechanisms are orthogonal: most CPUs provide both.

Prioritized interrupts CPU device 1device 2device n L1 L2.. Ln interrupt acknowledge If all devices ask interrupt simultaneously, only the highest priority receives it

Interrupt prioritization Masking: interrupt with priority lower than current priority is not recognized until pending interrupt is complete. Non-maskable interrupt (NMI): highest- priority, never masked. –Often used for power-down.

Example: Prioritized I/O :interrupts:foreground:A:A:B:B:C:C B A,B C A

© 2000 Morgan Kaufman Interrupt vectors Allow different devices to be handled by different code. Interrupt vector table: handler 0 handler 1 handler 2 handler 3 Interrupt vector table head

Interrupt vector acquisition :CPU:device Receive interrupt request Receive ack receive vector Activity on the bus

Generic interrupt mechanism intr? N Y Assume priority selection is handled before this point. N ignore Y ack vector? Y Y N timeout? Y bus error call table[vector] intr priority > current priority? continue execution

Interrupts

Maskable interrupts Caused by peripherals with interrupt capability including watchdog. Each interrupt source can be enabled/disabled by the correspondent bit in the status register.

Non-Maskable Interrupt There is no need to mask the interrupt. The interrupt is reseted automatically and then set again.

Interrupt Nesting

Interrupt vector table