A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

Microprocessors.
Microprocessors Typical microprocessor controlled devices: Camera, mobile phone, stereo, mp3 player, electronic toys… High-level microprocessor controlled.
Autumn 2012C.-S. Shieh, EC, KUAS, Taiwan1 The 8051 Family Microcontroller Chin-Shiuh Shieh Department of Electronic Engineering.
S04: MSP430 Microarchitecture
ARITHMETIC LOGIC SHIFT UNIT
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
Microprocessor and Microcontroller
Processor System Architecture
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
68HC11 Polling and Interrupts
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
Execution of an instruction
Overview Finite State Machines - Sequential circuits with inputs and outputs State Diagrams - An abstraction tool to visualize and analyze sequential circuits.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
ARM programmer’s model and assembler Embedded Systems Programming.
State Machines Used to Design Sequential Circuits.
Chapter 6 – MSP430 Micro-Architecture. BYU CS/ECEn 124Chapter 6 - MSP430 Micro-Architecture2 Concepts to Learn… Computer Architecture MSP430 Micro-Architecture.
Chapter 6 – MSP430 Micro-Architecture
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
1 © Unitec New Zealand Embedded Hardware ETEC 6416 Date: - 10 Aug,2011.
Atmega32 Architectural Overview
1 EKT 225 MICROCONTROLLER I CHAPTER 3 I/O PORT PROGRAMMING.
Machine Instruction Characteristics
MOBILE OPERATING ROBOT ON EMBEDDED SYSTEM
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Microcode Source: Digital Computer Electronics (Malvino and Brown)
Lecturers: Professor John Devlin Mr Robert Ross
Computer Organization - 1. INPUT PROCESS OUTPUT List different input devices Compare the use of voice recognition as opposed to the entry of data via.
Execution of an instruction
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
PHY 201 (Blum)1 Microcode Source: Digital Computer Electronics (Malvino and Brown)
The 8051 Microcontroller and Embedded Systems
IO Subsystem IV Ports and peripherals. IO Subsystem (1) All devices connected to the system buses, other than memory and CPU – Input and output ports.
Operating System 1 COMPUTER SYSTEM OVERVIEW Achmad Arwan, S.Kom.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
Electronic Analog Computer Dr. Amin Danial Asham by.
Addressing Modes1 Addressing modes are concerned with how the CPU accesses the operands used by its instructions.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
ECE 447 Fall 2009 Lecture 7: MSP430 Polling and Interrupts.
ECE Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer operation is of how the different parts of a computer system work together to perform a task.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
JUMP, LOOP, AND CALL INSTRUCTIONS
Chapter Microcontroller
CPE 323 Introduction to Embedded Computer Systems: The MSP430X Architecture Instructor: Dr Aleksandar Milenkovic.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ read/write and clock inputs Sequence of control signal combinations.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
CS4101 嵌入式系統概論 General Purpose IO
Fundamentals of Computer Engineering
ECE 3430 – Intro to Microcomputer Systems
Atmega32 Architectural Overview
Control Unit Lecture 6.
Chapter 4 The Von Neumann Model
UNIT – Microcontroller.
CS4101 嵌入式系統概論 General Purpose IO
Microcomputer Programming
Programming Boe-Bots (Part 1)
Instructions at the Lowest Level
The Processor and Machine Language
Introduction to Microprocessors and Microcontrollers
Morgan Kaufmann Publishers Computer Organization and Assembly Language
The Von Neumann Model Basic components Instruction processing
Program Execution.
Presentation transcript:

A Simple Tour of the MSP430

Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven high (logic 1) and extinguishes if the pin is driven low (logic 0). Input and output is memory mapped, which means that nothing unusual is needed to control output pins: We simply write in the normal way to the register that controls them. The complete program needs to carry out the following tasks: 1. Configure the microcontroller. 2. Set the relevant pins to be outputs by setting the appropriate bits of PxDIR. 3. Illuminate the LEDs by writing to PxOUT. 4. Keep the microcontroller busy in an infinite, empty loop.

Light LEDs in C

Assignment The basic instruction in assembly language is mov.w source, destination to move a word or mov.b for a byte. A single character denotes the mode in the operand. immediate, #: The value itself (word or byte) is given and stored in the word following the instruction. This is also known as a literal value. absolute, &: The address of a register in memory space is given and stored in the word following the instruction. register, R: This specifies one of the 16 registers in the CPU. The immediate mode is clearly useful only for the source but the other two can be used for either the source or destination, provided that it is possible to write to the destination—it is not in ROM, for instance.

Infinite Loop The flow of control is based on jump instructions, which can be either conditional or unconditional (always taken). You have no choice in assembly language. Normally the CPU executes instructions from memory one after the other. The program counter (PC) is automatically incremented so that it is ready to fetch the next instruction as soon as it is needed. This sequence is broken by a jump, which causes a new address to be loaded into in the PC.

Program Is Stored in Memory Generally the code should go into the flash ROM and variables should be allocated in RAM. We put the code in the most obvious location, which is at the start of the flash memory (low addresses). The Memory Organization section of the data sheet shows that the main flash memory has addresses 0xF000–FFFF. We therefore instruct the assembler to start storing the code at 0xF000.

Program Start In the MSP430, the address of the first instruction to be executed is stored at a specific location in flash memory, rather than the instruction itself. This address, called the reset vector, occupies the highest 2 bytes of the vector table at 0xFFFE:FFFF. It is set up as follows: 1. Put a label in front of the first instruction to be executed. 2. Use an directive to tell the assembler where the reset vector should be stored. It is at the same address in all current MSP430 devices. 3. This is followed by a DW Reset directive for “define word,” which tells the assembler to store the following word (2 bytes) in memory. This is the address of the first instruction to be executed and the assembler replaces the label with its numerical value.

Read Input from a Switch The pull-up resistor R pull holds the input at logic 1 (voltage VCC) while the button is up; closing the switch shorts the input to ground, logic 0 or VSS. The input is therefore active low, meaning that it goes low when the button is pressed. Most MCUs offer internal pull-ups to reduce the number of external components needed.

Read Input from a Switch A program can respond to inputs in two ways. ◦ Polling ◦ Interrupt Polling is simple but carries the overhead of regular checking, which is high if checks must be made frequently. An interrupt needs special hardware and requires tidying up so that normal operation can be resumed after the interrupt has been serviced.

Two Loops, One for Each State of the Button The LED is continually being switched on or off in the first version. The action is repeated continually. The LED is turned on or off only when necessary in the second version, just at the points when the button is pressed or released.