1. Trang chủ
  2. » Cao đẳng - Đại học

getting started with msp430

28 1,9K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 28
Dung lượng 80,07 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Information About Cautions and Warningsiii Read This First Preface Read This First About This Manual This document describes the procedures for how to get started using theMSP430 control

Trang 1

Getting Started With the

MSP430 Microcontroller

User’s Guide

SLAU028

Trang 2

TI warrants performance of its semiconductor products to the specifications applicable at the time of sale in accordance with TI’s standard warranty Testing and other quality control techniques are utilized to the extent

TI deems necessary to support this warranty Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements.

CERTAIN APPLICATIONS USING SEMICONDUCTOR PRODUCTS MAY INVOLVE POTENTIAL RISKS OF DEATH, PERSONAL INJURY, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE (“CRITICAL APPLICATIONS”) TI SEMICONDUCTOR PRODUCTS ARE NOT DESIGNED, AUTHORIZED, OR WARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS INCLUSION OF TI PRODUCTS IN SUCH APPLICATIONS IS UNDERSTOOD TO

BE FULLY AT THE CUSTOMER’S RISK.

In order to minimize risks associated with the customer’s applications, adequate design and operating safeguards must be provided by the customer to minimize inherent or procedural hazards.

TI assumes no liability for applications assistance or customer product design TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of TI covering or relating to any combination, machine, or process in which such semiconductor products or services might be or are used TI’s publication of information regarding any third party’s products or services does not constitute TI’s approval, warranty or endorsement thereof.

Copyright  1999, Texas Instruments Incorporated

Trang 3

Information About Cautions and Warnings

iii Read This First

Preface Read This First

About This Manual

This document describes the procedures for how to get started using theMSP430 controller, hardware, and simulator It looks at code and explains running out of RAM, debugging with HyperTerminal, and programming theMSP430 EPROM

The manual assumes that you have set up the Windows operating ment and that you are familiar with the basic terminology and procedures forusing Microsoft Windows To set up Windows or review basic Windows infor-mation, see your Windows documentation

environ-How to Use This Manual

This document contains the following chapters:

Chapter 1 Getting Started With the MSP430 ControllerChapter 2 Getting Started With the Hardware

Chapter 3 Using the SimulatorChapter 4 The MSP430 CodeChapter 5 Running Out of RAM and Debugging with HyperTerminalChapter 6 Programming the MSP430 EPROM

Information About Cautions and Warnings

This book may contain cautions and warnings

This is an example of a caution statement.

A caution statement describes a situation that could potentially damage your software or equipment.

This is an example of a warning statement.

A warning statement describes a situation that could potentially cause harm to you.

Trang 4

Related Documentation From Texas Instruments

The information in a caution or a warning is provided for your protection.Please read each caution and warning carefully

Related Documentation From Texas Instruments

MSP430 Family Architecture Guide and Module Library, 1996, SLAUE10BMSP430 Application Report, 1998, SLAAE10CData Sheet MSP430x11x, 1999, SLAS196AData Sheet MSP430x31x, 1999, SLAS165CData Sheet MSP430x32x, 1999, SLAS219Data Sheet MSP430x33x, 1998, SLAS163MSP430 Family STK/EVK Manual, (releasing) 1999, SLAS191MSP430 Simulation Manual, (releasing) 1999, SLAA055MSP430 LCD–Editor Manual, (releasing) 1999, SLAU027MSP430 Family Software User’s Guide 1994, SLAUE11MSP430 Family Assembly Language Tools User’s Guide, 1994, SLAUE12MSP430 Family Programming Adapter Manual, (releasing) 1999, SLAU026

Trang 5

Running Title—Attribute Reference

v Chapter Title—Attribute Reference

3 Using the Simulator 3-1

4 The MSP430 Code 4-1

5 Running Out of RAM and Debugging with HyperTerminal 5-1

6 Programming the MSP430 ROM 6-1

6.1 Programming on the STK/EVK 6-26.1.1 Programming a Blank OTP or EPROM 6-26.1.2 Resetting the STK Monitor Code to a Specified Program 6-26.1.3 Resetting the EVK Monitor Code to a Specified Program 6-46.2 Programming on Another Target Board 6-7

Trang 6

Running Title—Attribute Reference

Acknowledgement

Many thanks to Richard Baker, Mark Buccini, Brian Merritt, John Morgan andDale Wellborn for their support with this user’s guide

Trang 7

1-1 Getting Started With the MSP430 Controller

Getting Started With the MSP430 Controller

This user’s guide is intended as an easy-to-use guide for the MSP430 family.The designer should use this manual with the references cited throughout thedocument This is not intended to be a standalone document for the MSP430family

The documentation for the MSP430 family is written for use with any MSP430family members The manuals contain sections and pinouts for future growth

of the product line Refer to the datasheet that corresponds to the MSP430family member being used to be sure of the correct pinout, number of ADCchannels, number of LCD segments, and peripheral set

This manual will show how to assemble source files from within the assembler.These files will then be run on the simulator to demonstrate the correctoperation; then the files will be downloaded to the target hardware and run.This manual refers to HyperTerminal and monitor programs TheHyperTerminal program was written by Hilgraeve and is included withMicrosoft Windows The monitor program, RS-232 software written by TexasInstruments, allows the HyperTerminal program to communicate anddownload files to the MSP430 parts

1.1 Getting Started 1–2

Chapter 1

Trang 8

3) Install the software by running setup.exe on the Development Tools Disk

1 and following the instructions

4) Start the simulator by double clicking on the Simulation Environment icon.5) Follow the steps outlined in the Simulation Environment and LCD–EditorManual in Chapter 3 that explain how to open, configure, and build a proj-ect file To enable the LCD simulation environment click on Options/LCDsetup, then be sure that the filename c:\adt430\dt430\examples\demo.lcd

is in the window, unless another file is desired Click on ok then go to theWindow/LCD button and click on LCD

6) After you have completed debugging the program using the simulator, besure to go to Options/Project/Assembler (See the Options Menu in theSimulation Environment and LCD-Editor Manual) and be sure that theGenerate Text Object file box is checked Generate a *.txt file by using theProject/Rebuild All button

7) The program may then be either tested using HyperTerminal to download and run out of RAM or programmed directly in the EPROM ofthe part using the MSP430 programing adapter and executed Forinstructions on using HyperTerminal, refer to the Starter Kit/Evaluation KitManual

Once the OTP (one time programmable) has had the programdownloaded to the ROM, it may not be programmed again

8) There are three ways to program the MSP430 EPROM parts

1) To program the MSP430 EPROM, click on the Programming Adaptericon for the EVK or follow the instructions given in the StarterKit/Evaluation Kit Manual for the STK in the Chapter The IdentificationBit Pattern AA55h Programming Adapter instructions are located inthe MSP430 Family Programming Adapter Manual

2) Using the serial port Refer to STK/EVK Manual3) Using third party vendor tools

Trang 9

Getting Started

1-3 Getting Started With the MSP430 Controller

Note:

The programmer can use third party vendor tools to debug and program theMSP430 parts Refer to the TI MSP430 website for a complete list of thesevendors and links to their website This website also contains software andapplication reports that are downloadable at

http://www.ti.com/sc/msp430

Trang 11

2-1 Getting Started With the Hardware

Getting Started With the Hardware

Refer to the Starter Kit/Evaluation Kit Manual appendix, Difference BetweenSTK and EVK The included table shows what the differences are between thekits

2.1 The LCD 2–2 2.2 The EPROM Versus OTP Devices 2–2 2.3 Connecting the Hardware 2–2

Chapter 2

Trang 12

The LCD

2.1 The LCD

If no LCD is needed for the application, this step may be omitted The LCD willnot be installed when you receive your EVK board so that the board can beused with another vendor’s LCD The user must solder the LCD in place.Solder the LCD so that it hangs over the PC board, not hanging off of the PCboard as shown in the Starter Kit/Evaluation Kit Manual in the sectionSTK/EVK Connectors Use spacers placed on the backside of the LCD whilesoldering it onto the board

2.2 The EPROM versus OTP Devices

The STK kits include an OTP device that has been soldered onto the board.The EVK kits come with two UV erasable EPROM devices A monitor programhas already been downloaded into one of the EPROM devices (indicated by

a label covering the window) and the OTP device The second EPROM device

is blank The EPROM device that contains the monitor code should be placed

so the notched corner of the EPROM is located in the notched corner of thesocket

If the EPROM containing the monitor code is accidentally erased, themonitor program needs to be reloaded Refer to the StarterKit/Evaluation Kit Manual in the section Program the Monitor Softwareinto an Erased EPROM

2.3 Connecting the Hardware

The STK and EVK kits each come with the necessary cabling to interface to

a computer Connect the RS-232 ribbon cable to the COM port of the computer(noting which COM port is being used) and the other end to the EVK/STKboard To change the COM port being used, refer to the STK/EVK manual

Trang 13

3-1 Using the Simulator

Using the Simulator

Each STK/EVK kit comes with the necessary diskettes containing the softwarefor the simulator The EVK kit includes an additional diskette that contains soft-ware for the programming adapter Refer to the Starter Kit/Evaluation KitManual’s Installing the Software chapter and the Simulation Environment andLCD Editor Manual Installation chapter for information on installing this soft-ware

Note:

Only the EVK comes with the LCD-editor software

Once the software has been installed, double click on the SimulationEnvironment icon To begin to use the simulator, choose a project Refer to theMSP430 Simulation Environment and LCD-Editor Manual Getting Startedchapter for more detailed instructions on using the simulator The MSP430LCD editor allows users to create custom LCDs The software contains the filedemo LCD configured to match the LCD that is supplied with the EVK/STKkits Enable the LCD simulation environment by going to Options/LCD setup

Be sure that the file name c:\adt430\dt430\examples\demo.lcd is in the box(unless there is another *.lcd file required that matches the LCD of choice).After clicking ok, go to the Window/LCD button and click LCD An LCD windowappears on the desktop

Chapter 3

Trang 15

4-1 The MSP430 Code

The MSP430 Code

MSP430 STK/EVK kits contain several programs, and more code may beobtained from either the MSP430 website or the MSP430 Family ApplicationReport Book All code should contain at a minimum:

- A memory mapping section

- A setup or initialization section

- The main body of code

- An interrupt vector table

The STK/EVK boards are memory mapped differently between the family ofparts and the simulator Refer to a datasheet for the program memory map for

a specific MSP430 device An example for the MSP430x325 family is shownbelow

Int Vector

16 kB OPT

512B RAM 16b Per.

8b Per.

SFR

FFFFh FFE0h FFDFh

C000h

03FFh 0200h 01FFh 0100h 00FFh 0010h 000Fh 0000h

MSP430P/E325

Int Vector

16 kB EPROM

512B RAM 16b Per 8b Per SFR

FFFFh FFE0h FFDFh

03FFh 0200h 01FFh 0100h 00FFh 0010h 000Fh 0000h

Trang 16

; SYSTEM DEFINITIONS FOR 320 STK/EVK

;––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

RAM_orig set 00200h ; RAM start

EPROM_orig set 0C000h ; 32x EPROM start

.if SIM = 1 This is the memory map for the STK

I_vectors set 003FFh ; STK Interrupt vectors in RAM

Main equ RAM_orig+20h ; Program RAM start address

BTload equ 036h ; Load actual 1 second interrupt (036h)

.else

I_vectors set 0FFFFh ; Interrupt vectors in EPROM This is the memory map for the

simulator

Stack set 003DEh ; Stackpointer

Main equ EPROM_orig ; Program EPROM start

BTload equ 011h ; Load fast interrupt, NOT 1 sec.

.endif

; ************************************

; STATUS REGISTER BITS

; ************************************ Defining a few of the registers and

C set 1H low power modes

WDTCTL .equ 120h ;WDT control register address

WDTPW equ 5A00h ;password for WDT control register access

WDTCL equ 8 ;bit position for WDT reset

WDTIFG .equ 1 ;bit position for WDT interrupt in SFR

WDTHOLD .equ 80h

;*************************************

;Timer definitions

;*************************************

BTCTL equ 040h ;Basic Timer

TCCTL equ 42h ;TC8 control register address

TCPLD equ 43h ;TC8 preload register address

TCDAT equ 44h ;TC8 counter address

P0_1IFG .equ 8 ;bitposition for TC8 interrupt in SFR

RXD .equ 1 ;bit position in TCCTL

TXD .equ 2 ;bit position in TCCTL

RXACT equ 4 ;bit position in TCCTL

ENCNT equ 8 ;bit position in TCCTL

TXE .equ 10h ;bit position in TCCTL

ISCTL equ 20h ;bit position in TCCTL

SSEL1 equ 40h ;bit position in TCCTL

SSEL0 equ 80h ;bit position in TCCTL

Trang 17

4-3 The MSP430 Code

An additional register definition file can be found on the MSP430 website Thisfile is called STD_DEF.asm and can be included in your code by using the in-clude statement The address in the source code must be correct, depending

on what MSP430 family member you are using

;

Loop BIS #LPM3,SR ; Enter LPM3

User’s Code Here

; ; Users routine with interrupts here

.sect ”I_Vectors”,I_vectors–31 ; From MSP430P325 Family of ports

.word RESET ; No source

.word Int_BT ; Basic Timer

.word RESET ; no source

.word RESET ; no source

.word RESET ; Timer Port

.word RESET ; EOC from ADC

.word RESET ; no source

.word RESET ; no source

.word RESET ; no source

.word RESET ; no source

.word RESET ; Watchdog/Timer, Timer mode

.word RESET ; no source

.word RESET ; Address of UART handler

.word RESET ; P0.0

.word RESET ; NMI, Osc fault

.word RESET ; POR, ext Reset, Watchdog

.sect”Int_Code”,User_End–22h

.word #0aa55h ; if aa55h then User_Start

.end ;

Trang 19

5-1 Running Out of RAM and Debugging with HyperTerminal

Running Out of RAM and Debugging with

HyperTerminal

Once a program works error free on the simulator, it is downloaded to the RAMvia HyperTerminal To download a file, create a *.txt file To create *.txt file usingthe simulator, go to Options/Project/Assembler (see the Options Menu in theSimulation Environment and LCD–Editor Manual) and be sure that theGenerate Text Object File box is checked Generate a *.txt file by using theProject/Rebuild All button

Prior to running HyperTerminal, connect the STK/EVK board to the COM port

of the computer Double click on the MSP430 Terminal icon MSP430 should

be displayed on the LCD of the STK/EVK board and MSP–EVK430x320 orMSP–STK430x320 should echo back to the HyperTerminal (the revision lettermay be B, C or higher) If neither event happens, ensure that the computer’sserial port is supplying enough current Perform the following steps to correctthis problem:

1) Check the cable connections

2) If you receive back an unreadable message, your computer is probablynot capable of supplying enough current for the MSP430 board Jumpertwo locations on the STK/EVK board down to 3 V Refer to the STK/EVKManual in the section labeled STK/EVK Target Connectors for the correctjumper configuration

3) If Step 2 does not work, attach a 9 V battery to the BAT+ and BAT– jumperholes located on the edge of the board (See the schematic in the StarterKit/Evaluation Kit Manual)

4) If neither Step 2 nor Step 3 works, ensure you have the correct version ofHyperTerminal HyperTerminal that comes with Windows ’98 is suspect.Download Windows ’95 HyperTerminal.exe and HyperTerminal.dll filesand retry this procedure

Chapter 5

Ngày đăng: 16/10/2014, 09:23

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN