MSP430x4xx Family
User’s Guide
2007 Mixed Signal Products
SLAU056G
About This Manual
Related Documentation From T exas Instruments
Preface
Read This First
This manual discusses modules and peripherals of the MSP430x4xx family of
devices. Each discussion presents the module or peripheral in a general
sense. Not all features and functions of all modules or peripherals are present
on all devices. In addition, modules or peripherals may differ in their exact
implementation between device families, or may not be fully implemented on
an individual device or device family.
Pin functions, internal signal connections and operational parameters differ
from device to device. The user should consult the device-specific data sheet
for these details.
Related Documentation From Texas Instruments
For related documentation see the web site http://www.ti.com/msp430.
FCC Warning
This equipment is intended for use in a laboratory test environment only. It
generates, uses, and can radiate radio frequency energy and has not been
tested for compliance with the limits of computing devices pursuant to subpart
J of part 15 of FCC rules, which are designed to provide reasonable protection
against radio frequency interference. Operation of this equipment in other
environments may cause interference with radio communications, in which
case the user at his own expense will be required to take whatever measures
may be required to correct this interference.
Notational Conventions
Program examples, are shown in a special typeface .
iii
Glossary
Glossary
ACLK Auxiliary Clock See Basic Clock Module
ADC Analog-to-Digital Converter
BOR Brown-Out Reset See System Resets, Interrupts, and Operating Modes
BSL Bootstrap Loader See www.ti.com/msp430 for application reports
CPU Central Processing Unit See RISC 16-Bit CPU
DAC Digital-to-Analog Converter
DCO Digitally Controlled Oscillator See FLL+ Module
dst Destination See RISC 16-Bit CPU
FLL Frequency Locked Loop See FLL+ Module
GIE General Interrupt Enable See System Resets Interrupts and Operating Modes
INT(N/2) Integer portion of N/2
I/O Input/Output See Digital I/O
ISR Interrupt Service Routine
LSB Least-Significant Bit
LSD Least-Significant Digit
LPM Low-Power Mode See System Resets Interrupts and Operating Modes
MAB Memory Address Bus
MCLK Master Clock See FLL+ Module
MDB Memory Data Bus
MSB Most-Significant Bit
MSD Most-Significant Digit
NMI (Non)-Maskable Interrupt See System Resets Interrupts and Operating Modes
PC Program Counter See RISC 16-Bit CPU
POR Power-On Reset See System Resets Interrupts and Operating Modes
PUC Power-Up Clear See System Resets Interrupts and Operating Modes
RAM Random Access Memory
SCG System Clock Generator See System Resets Interrupts and Operating Modes
SFR Special Function Register
SMCLK Sub-System Master Clock See FLL+ Module
SP Stack Pointer See RISC 16-Bit CPU
SR Status Register See RISC 16-Bit CPU
src Source See RISC 16-Bit CPU
TOS Top-of-Stack See RISC 16-Bit CPU
WDT Watchdog Timer See Watchdog Timer
iv
Register Bit Conventions
Each register is shown with a key indicating the accessibility of the each
individual bit, and the initial condition:
Register Bit Accessibility and Initial Condition
Key Bit Accessibility
rw Read/write
r Read only
r0 Read as 0
r1 Read as 1
w Write only
w0 Write as 0
w1 Write as 1
(w) No register bit implemented; writing a 1 results in a pulse.
The register bit is always read as 0.
h0 Cleared by hardware
Register Bit Conventions
h1 Set by hardware
−0,−1 Condition after PUC
−(0),−(1)
Condition after POR
v
vi
Contents
Contents
1 Introduction 1-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.1 Architecture 1-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Flexible Clock System 1-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Embedded Emulation 1-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4 Address Space 1-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4.1 Flash/ROM 1-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4.2 RAM 1-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4.3 Peripheral Modules 1-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4.4 Special Function Registers (SFRs) 1-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4.5 Memory Organization 1-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 System Resets, Interrupts, and Operating Modes 2-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1 System Reset and Initialization 2-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1.1 Brownout Reset (BOR) 2-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1.2 Device Initial Conditions After System Reset 2-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Interrupts 2-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.1 (Non)-Maskable Interrupts (NMI) 2-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.2 Maskable Interrupts 2-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.3 Interrupt Processing 2-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.4 Interrupt Vectors 2-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.5 Special Function Registers (SFRs) 2-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Operating Modes 2-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3.1 Entering and Exiting Low-Power Modes 2-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4 Principles for Low-Power Applications 2-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.5 Connection of Unused Pins 2-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vii
Contents
3 RISC 16-Bit CPU 3-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1 CPU Introduction 3-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 CPU Registers 3-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.1 Program Counter (PC) 3-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.2 Stack Pointer (SP) 3-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.3 Status Register (SR) 3-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.4 Constant Generator Registers CG1 and CG2 3-7 . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.5 General-Purpose Registers R4 to R15 3-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3 Addressing Modes 3-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.1 Register Mode 3-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.2 Indexed Mode 3-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.3 Symbolic Mode 3-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.4 Absolute Mode 3-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.5 Indirect Register Mode 3-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.6 Indirect Autoincrement Mode 3-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.7 Immediate Mode 3-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4 Instruction Set 3-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.1 Double-Operand (Format I) Instructions 3-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.2 Single-Operand (Format II) Instructions 3-19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.3 Jumps 3-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.4 Instruction Cycles and Lengths 3-72 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.5 Instruction Set Description 3-74 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4 16-Bit MSP430X CPU 4-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1 CPU Introduction 4-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Interrupts 4-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 CPU Registers 4-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.1 The Program Counter PC 4-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.2 Stack Pointer (SP) 4-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.3 Status Register (SR) 4-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.4 The Constant Generator Registers CG1 and CG2 4-11 . . . . . . . . . . . . . . . . . . . . . .
4.3.5 The General Purpose Registers R4 to R15 4-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 Addressing Modes 4-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.1 Register Mode 4-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.2 Indexed Mode 4-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.3 Symbolic Mode 4-24 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.4 Absolute Mode 4-29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.5 Indirect Register Mode 4-32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.6 Indirect, Autoincrement Mode 4-33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.7 Immediate Mode 4-34 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5 MSP430 and MSP430X Instructions 4-36 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5.1 MSP430 Instructions 4-37 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5.2 MSP430X Extended Instructions 4-44 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6 Instruction Set Description 4-58 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6.1 Extended Instruction Binary Descriptions 4-59 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6.2 MPS430 Instructions 4-61 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6.3 Extended Instructions 4-113 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6.4 Address Instructions 4-156 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
viii
Contents
5 FLL+ Clock Module 5-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1 FLL+ Clock Module Introduction 5-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 FLL+ Clock Module Operation 5-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.1 FLL+ Clock features for Low-Power Applications 5-6 . . . . . . . . . . . . . . . . . . . . . . . .
5.2.2 LFXT1 Oscillator 5-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.3 XT2 Oscillator 5-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.4 Digitally-Controlled Oscillator (DCO) 5-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.5 Frequency Locked Loop (FLL) 5-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.6 DCO Modulator 5-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.7 Disabling the FLL Hardware and Modulator 5-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.8 FLL Operation from Low-Power Modes 5-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.9 Buffered Clock Output 5-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.10 FLL+ Fail-Safe Operation 5-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 FLL+ Clock Module Registers 5-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6 Flash Memory Controller 6-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.1 Flash Memory Introduction 6-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2 Flash Memory Segmentation 6-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2.1 SegmentA on F47x Devices 6-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3 Flash Memory Operation 6-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.1 Flash Memory Timing Generator 6-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.2 Erasing Flash Memory 6-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.3 Writing Flash Memory 6-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.4 Flash Memory Access During Write or Erase 6-17 . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.5 Stopping a Write or Erase Cycle 6-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.6 Marginal Read Mode 6-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.7 Configuring and Accessing the Flash Memory Controller 6-18 . . . . . . . . . . . . . . . . .
6.3.8 Flash Memory Controller Interrupts 6-19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.9 Programming Flash Memory Devices 6-19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4 Flash Memory Registers 6-21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7 Supply Voltage Supervisor 7-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1 SVS Introduction 7-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2 SVS Operation 7-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.1 Configuring the SVS 7-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.2 SVS Comparator Operation 7-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.3 Changing the VLDx Bits 7-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.4 SVS Operating Range 7-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3 SVS Registers 7-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8 16-Bit Hardware Multiplier 8-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.1 Hardware MultiplierIntroduction 8-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 Hardware Multiplier Operation 8-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2.1 Operand Registers 8-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2.2 Result Registers 8-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2.3 Software Examples 8-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2.4 Indirect Addressing of RESLO 8-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2.5 Using Interrupts 8-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.3 Hardware Multiplier Registers 8-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ix
Contents
9 32-Bit Hardware Multiplier 9-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1 32-Bit Hardware Multiplier Introduction 9-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2 32-Bit Hardware Multiplier Operation 9-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.1 Operand Registers 9-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.2 Result Registers 9-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.3 Software Examples 9-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.4 Fractional Numbers 9-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.5 Putting it all together 9-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.6 Indirect Addressing of Result Registers 9-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.7 Using Interrupts 9-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.8 Using DMA 9-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3 32-Bit Hardware Multiplier Registers 9-21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10 DMA Controller 10-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1 DMA Introduction 10-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2 DMA Operation 10-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.1 DMA Addressing Modes 10-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.2 DMA Transfer Modes 10-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.3 Initiating DMA Transfers 10-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.4 Stopping DMA Transfers 10-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.5 DMA Channel Priorities 10-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.6 DMA Transfer Cycle Time 10-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.7 Using DMA with System Interrupts 10-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.8 DMA Controller Interrupts 10-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.9 Using the USCI_B I2C Module with the DMA Controller 10-18 . . . . . . . . . . . . . . .
10.2.10 Using ADC12 with the DMA Controller 10-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.11 Using DAC12 With the DMA Controller 10-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.12 Writing to Flash With the DMA Controller 10-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.3 DMA Registers 10-19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 Digital I/O 11-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1 Digital I/O Introduction 11-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2 Digital I/O Operation 11-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.1 Input Register PxIN 11-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.2 Output Registers PxOUT 11-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.3 Direction Registers PxDIR 11-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.4 Pullup/Pulldown Resistor Enable Registers PxREN (MSP430x47x only) 11-4 . . .
11.2.5 Function Select Registers PxSEL 11-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.6 P1 and P2 Interrupts 11-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.7 Configuring Unused Port Pins 11-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3 Digital I/O Registers 11-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
x
Contents
12 Watchdog Timer, Watchdog Timer+ 12-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.1 Watchdog Timer Introduction 12-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2 Watchdog Timer Operation 12-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2.1 Watchdog Timer Counter 12-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2.2 Watchdog Mode 12-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2.3 Interval Timer Mode 12-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2.4 Watchdog Timer Interrupts 12-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2.5 WDT+ Enhancements 12-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2.6 Operation in Low-Power Modes 12-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2.7 Software Examples 12-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.3 Watchdog Timer Registers 12-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13 Basic Timer1 13-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.1 Basic Timer1 Introduction 13-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2 Basic Timer1 Operation 13-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2.1 Basic Timer1 Counter One 13-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2.2 Basic Timer1 Counter Two 13-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2.3 16-Bit Counter Mode 13-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2.4 Basic Timer1 Operation: Signal fLCD 13-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2.5 Basic Timer1 Interrupts 13-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.3 Basic Timer1 Registers 13-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 Real Time Clock 14-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.1 RTC Introduction 14-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.2 Real-Time Clock Operation 14-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.2.1 Counter Mode 14-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.2.2 Calendar Mode 14-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.2.3 RTC and Basic Timer1 Interaction 14-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.2.4 Real-Time Clock Interrupts 14-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.3 Real-Time Clock Registers 14-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15 Timer_A 15-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.1 Timer_A Introduction 15-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2 Timer_A Operation 15-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2.1 16-Bit Timer Counter 15-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2.2 Starting the Timer 15-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2.3 Timer Mode Control 15-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2.4 Capture/Compare Blocks 15-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2.5 Output Unit 15-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2.6 Timer_A Interrupts 15-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3 Timer_A Registers 15-19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xi
Contents
16 Timer_B 16-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.1 Timer_B Introduction 16-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.1.1 Similarities and Differences From Timer_A 16-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.2 Timer_B Operation 16-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.2.1 16-Bit Timer Counter 16-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.2.2 Starting the Timer 16-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.2.3 Timer Mode Control 16-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.2.4 Capture/Compare Blocks 16-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.2.5 Output Unit 16-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.2.6 Timer_B Interrupts 16-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.3 Timer_B Registers 16-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17 USART Peripheral Interface, UART Mode 17-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.1 USART Introduction: UART Mode 17-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2 USART Operation: UART Mode 17-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2.1 USART Initialization and Reset 17-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2.2 Character Format 17-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2.3 Asynchronous Communication Formats 17-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2.4 USART Receive Enable 17-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2.5 USART Transmit Enable 17-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2.6 USART Baud Rate Generation 17-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2.7 USART Interrupts 17-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.3 USART Registers: UART Mode 17-21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18 USART Peripheral Interface, SPI Mode 18-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.1 USART Introduction: SPI Mode 18-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2 USART Operation: SPI Mode 18-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.1 USART Initialization and Reset 18-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.2 Master Mode 18-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.3 Slave Mode 18-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.4 SPI Enable 18-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.5 Serial Clock Control 18-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.6 SPI Interrupts 18-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3 USART Registers: SPI Mode 18-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xii
Contents
19 Universal Serial Communication Interface, UART Mode 19-1 . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.1 USCI Overview 19-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.2 USCI Introduction: UART Mode 19-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3 USCI Operation: UART Mode 19-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.1 USCI Initialization and Reset 19-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.2 Character Format 19-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.3 Asynchronous Communication Formats 19-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.4 Automatic Baud Rate Detection 19-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.5 IrDA Encoding and Decoding 19-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.6 Automatic Error Detection 19-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.7 USCI Receive Enable 19-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.8 USCI Transmit Enable 19-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.9 UART Baud Rate Generation 19-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.10 Setting a Baud Rate 19-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.11 Transmit Bit Timing 19-19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.12 Receive Bit Timing 19-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.13 Typical Baud Rates and Errors 19-21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3.14 Using the USCI Module in UART Mode with Low-Power Modes 19-25 . . . . . . . .
19.3.15 USCI Interrupts 19-25 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.4 USCI Registers: UART Mode 19-27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20 Universal Serial Communication Interface, SPI Mode 20-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.1 USCI Overview 20-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.2 USCI Introduction: SPI Mode 20-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3 USCI Operation: SPI Mode 20-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.1 USCI Initialization and Reset 20-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.2 Character Format 20-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.3 Master Mode 20-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.4 Slave Mode 20-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.5 SPI Enable 20-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.6 Serial Clock Control 20-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.7 Using the SPI Mode with Low Power Modes 20-12 . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.8 SPI Interrupts 20-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.4 USCI Registers: SPI Mode 20-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21 Universal Serial Communication Interface, I2C Mode 21-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21.1 USCI Overview 21-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21.2 USCI Introduction: I2C Mode 21-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21.3 USCI Operation: I2C Mode 21-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21.3.1 USCI Initialization and Reset 21-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21.3.2 I2C Serial Data 21-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21.3.3 I2C Addressing Modes 21-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21.3.4 I2C Module Operating Modes 21-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21.3.5 I2C Clock Generation and Synchronization 21-21 . . . . . . . . . . . . . . . . . . . . . . . . . .
21.3.6 Using the USCI Module in I2C Mode With Low-Power Modes 21-22 . . . . . . . . . .
21.3.7 USCI Interrupts in I2C Mode 21-23 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21.4 USCI Registers: I2C Mode 21-25 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xiii
Contents
22 OA 22-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.1 OA Introduction 22-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.2 OA Operation 22-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.2.1 OA Amplifier 22-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.2.2 OA Input 22-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.2.3 OA Output 22-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.2.4 OA Configurations 22-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.3 OA Modules in FG42x0 Devices 22-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.3.1 OA Amplifier 22-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.3.2 OA Inputs 22-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.3.3 OA Outputs 22-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.3.4 OA Configurations 22-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.3.5 Switch Control 22-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.3.6 Offset Calibration 22-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.4 OA Registers 22-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5 OA Registers in FG42x0 Devices 22-19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23 Comparator_A 23-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.1 Comparator_A Introduction 23-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2 Comparator_A Operation 23-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.1 Comparator 23-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.2 Input Analog Switches 23-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.3 Output Filter 23-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.4 Voltage Reference Generator 23-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.5 Comparator_A, Port Disable Register CAPD 23-6 . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.6 Comparator_A Interrupts 23-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.7 Comparator_A Used to Measure Resistive Elements 23-7 . . . . . . . . . . . . . . . . . . . .
23.3 Comparator_A Registers 23-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24 LCD Controller 24-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.1 LCD Controller Introduction 24-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2 LCD Controller Operation 24-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2.1 LCD Memory 24-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2.2 Blinking the LCD 24-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2.3 LCD Timing Generation 24-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2.4 LCD Voltage Generation 24-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2.5 LCD Outputs 24-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2.6 Static Mode 24-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2.7 2-Mux Mode 24-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2.8 3-Mux Mode 24-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.2.9 4-Mux Mode 24-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.3 LCD Controller Registers 24-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xiv
Contents
25 LCD_A Controller 25-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.1 LCD_A Controller Introduction 25-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2 LCD_A Controller Operation 25-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.1 LCD Memory 25-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.2 Blinking the LCD 25-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.3 LCD_A Voltage And Bias Generation 25-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.4 LCD Timing Generation 25-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.5 LCD Outputs 25-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.6 Static Mode 25-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.7 2-Mux Mode 25-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.8 3-Mux Mode 25-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.9 4-Mux Mode 25-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.3 LCD Controller Registers 25-21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26 ADC12 26-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.1 ADC12 Introduction 26-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2 ADC12 Operation 26-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2.1 12-Bit ADC Core 26-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2.2 ADC12 Inputs and Multiplexer 26-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2.3 Voltage Reference Generator 26-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2.4 Auto Power-Down 26-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2.5 Sample and Conversion Timing 26-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2.6 Conversion Memory 26-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2.7 ADC12 Conversion Modes 26-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2.8 Using the Integrated Temperature Sensor 26-16 . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.2.9 ADC12 Grounding and Noise Considerations 26-17 . . . . . . . . . . . . . . . . . . . . . . . .
26.2.10 ADC12 Interrupts 26-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26.3 ADC12 Registers 26-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27 SD16 27-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.1 SD16 Introduction 27-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2 SD16 Operation 27-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.1 ADC Core 27-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.2 Analog Input Range and PGA 27-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.3 Voltage Reference Generator 27-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.4 Auto Power-Down 27-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.5 Analog Input Pair Selection 27-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.6 Analog Input Characteristics 27-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.7 Digital Filter 27-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.8 Conversion Memory Registers: SD16MEMx 27-10 . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.9 Conversion Modes 27-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.10 Conversion Operation Using Preload 27-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.11 Using the Integrated Temperature Sensor 27-16 . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.12 Interrupt Handling 27-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.3 SD16 Registers 27-19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xv
Contents
28 SD16_A 28-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.1 SD16_A Introduction 28-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2 SD16_A Operation 28-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.1 ADC Core 28-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.2 Analog Input Range and PGA 28-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.3 Voltage Reference Generator 28-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.4 Auto Power-Down 28-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.5 Analog Input Pair Selection 28-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.6 Analog Input Characteristics 28-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.7 Digital Filter 28-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.8 Conversion Memory Register: SD16MEMx 28-12 . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.9 Conversion Modes 28-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.10 Conversion Operation Using Preload 28-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.11 Using the Integrated Temperature Sensor 28-19 . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2.12 Interrupt Handling 28-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.3 SD16_A Registers 28-22 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29 DAC12 29-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.1 DAC12 Introduction 29-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2 DAC12 Operation 29-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2.1 DAC12 Core 29-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2.2 DAC12 Reference 29-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2.3 Updating the DAC12 Voltage Output 29-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2.4 DAC12_xDAT Data Format 29-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2.5 DAC12 Output Amplifier Offset Calibration 29-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2.6 Grouping Multiple DAC12 Modules 29-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2.7 DAC12 Interrupts 29-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.3 DAC12 Registers 29-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30 Scan IF 30-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.1 Scan IF Introduction 30-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2 Scan IF Operation 30-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2.1 Scan IF Analog Front End 30-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2.2 Scan IF Timing State Machine 30-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2.3 Scan IF Processing State Machine 30-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2.4 Scan IF Debug Register 30-26 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2.5 Scan IF Interrupts 30-27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2.6 Using the Scan IF with LC Sensors 30-28 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2.7 Using the Scan IF With Resistive Sensors 30-32 . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2.8 Quadrature Decoding 30-33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.3 Scan IF Registers 30-35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31 Embedded Emulation Module (EEM) 31-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.1 EEM Introduction 31-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2 EEM Building Blocks 31-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2.1 Triggers 31-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2.2 Trigger Sequencer 31-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2.3 State Storage (Internal Trace Buffer) 31-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2.4 Clock Control 31-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.3 EEM Configurations 31-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xvi
Chapter 1
Introduction
This chapter describes the architecture of the MSP430.
Topic Page
1.1 Architecture 1-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Flexible Clock System 1-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Embedded Emulation 1-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4 Address Space 1-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction
1-1
Architecture
1.1 Architecture
The MSP430 incorporates a 16-bit RISC CPU, peripherals, and a flexible clock
system that interconnect using a von-Neumann common memory address
bus (MAB) and memory data bus (MDB). Partnering a modern CPU with
modular memory-mapped analog and digital peripherals, the MSP430 offers
solutions for demanding mixed-signal applications.
Key features of the MSP430x4xx family include:
- Ultralow-power architecture extends battery life
J 0.1-μ A RAM retention
J 0.8-μ A real-time clock mode
J 250-μ A / MIPS active
- High-performance analog ideal for precision measurement
J 12-bit or 10-bit ADC — 200 ksps, temperature sensor, V
J 12-bit dual-DAC
J Comparator-gated timers for measuring resistive elements
J Supply voltage supervisor
- 16-bit RISC CPU enables new applications at a fraction of the code size.
J Large register file eliminates working file bottleneck
J Compact core design reduces power consumption and cost
J Optimized for modern high-level programming
J Only 27 core instructions and seven addressing modes
J Extensive vectored-interrupt capability
- In-system programmable Flash permits flexible code changes, field
upgrades and data logging
1.2 Flexible Clock System
The clock system is designed specifically for battery-powered applications. A
low-frequency auxiliary clock (ACLK) is driven directly from a common 32-kHz
watch crystal. The ACLK can be used for a background real-time clock self
wake-up function. An integrated high-speed digitally controlled oscillator
(DCO) can source the master clock (MCLK) used by the CPU and high-speed
peripherals. By design, the DCO is active and stable in less than 6 μs.
MSP430-based solutions effectively use the high-performance 16-bit RISC
CPU in very short bursts.
Ref
1-2 Introduction
- Low-frequency auxiliary clock = Ultralow-power stand-by mode
- High-speed master clock = High performance signal processing
Figure 1−1. MSP430 Architecture
Embedded Emulation
MCLK
ACLK
SMCLK
ACLK
SMCLK
Flash/
ROM
MAB 16-Bit
JTAG/Debug
MDB 16-Bit
Watchdog
Clock
System
RISC CPU
16-Bit
JTAG
1.3 Embedded Emulation
Dedicated embedded emulation logic resides on the device itself and is
accessed via JTAG using no additional system resources.
RAM
Peripheral
Peripheral Peripheral Peripheral
Bus
Conv.
Peripheral
MDB 8-Bit
Peripheral Peripheral
The benefits of embedded emulation include:
- Unobtrusive development and debug with full-speed execution,
breakpoints, and single-steps in an application are supported.
- Development is in-system subject to the same characteristics as the final
application.
- Mixed-signal integrity is preserved and not subject to cabling interference.
Introduction
1-3
Address Space
1.4 Address Space
The MSP430 von-Neumann architecture has one address space shared with
special function registers (SFRs), peripherals, RAM, and Flash/ROM memory
as shown in Figure 1−2. See the device-specific data sheets for specific
memory maps. Code access are always performed on even addresses. Data
can be accessed as bytes or words.
The addressable memory space is 128 KB with future expansion planned.
Figure 1−2. Memory Map
Access
1.4.1 Flash/ROM
10000h
0FFFFh
0FFE0h
0FFDFh
0200h
01FFh
0100h
0FFh
010h
0Fh
0h
Flash/ROM
Interrupt Vector Table
Flash/ROM
RAM
16-Bit Peripheral Modules
8-Bit Peripheral Modules
Special Function Registers
Word/Byte
Word/Byte
Word/Byte
Word/Byte
Word
Byte
Byte
1-4 Introduction
The start address of Flash/ROM depends on the amount of Flash/ROM
present and varies by device. The end address for Flash/ROM is 0FFFFh for
devices with less than 60kB of Flash/ROM; otherwise, it is device dependent.
Flash can be used for both code and data. Word or byte tables can be stored
and used in Flash/ROM without the need to copy the tables to RAM before
using them.
The interrupt vector table is mapped into the upper 16 words of Flash/ROM
address space, with the highest priority interrupt vector at the highest
Flash/ROM word address (0FFFEh).
1.4.2 RAM
RAM starts at 0200h. The end address of RAM depends on the amount of RAM
present and varies by device. RAM can be used for both code and data.
1.4.3 Peripheral Modules
Peripheral modules are mapped into the address space. The address space
from 0100 to 01FFh is reserved for 16-bit peripheral modules. These modules
should be accessed with word instructions. If byte instructions are used, only
even addresses are permissible, and the high byte of the result is always 0.
The address space from 010h to 0FFh is reserved for 8-bit peripheral modules.
These modules should be accessed with byte instructions. Read access of
byte modules using word instructions results in unpredictable data in the high
byte. If word data is written to a byte module only the low byte is written into
the peripheral register, ignoring the high byte.
1.4.4 Special Function Registers (SFRs)
Some peripheral functions are configured in the SFRs. The SFRs are located
in the lower 16 bytes of the address space, and are organized by byte. SFRs
must be accessed using byte instructions only. See the device-specific data
sheets for applicable SFR bits.
Address Space
1.4.5 Memory Organization
Bytes are located at even or odd addresses. Words are only located at even
addresses as shown in Figure 1−3. When using word instructions, only even
addresses may be used. The low byte of a word is always an even address.
The high byte is at the next odd address. For example, if a data word is located
at address xxx4h, then the low byte of that data word is located at address
xxx4h, and the high byte of that word is located at address xxx5h.
Introduction
1-5
Address Space
Figure 1−3. Bits, Bytes, and Words in a Byte-Organized Memory
xxxAh
157146. . Bits . .
. . Bits . .9180
Byte
Byte
Word (High Byte)
Word (Low Byte)
xxx9h
xxx8h
xxx7h
xxx6h
xxx5h
xxx4h
xxx3h
1-6 Introduction
Chapter 2
System Resets, Interrupts,
and Operating Modes
This chapter describes the MSP430x4xx system resets, interrupts, and
operating modes.
Topic Page
2.1 System Reset and Initialization 2-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Interrupts 2-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Operating Modes 2-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4 Principles for Low-Power Applications 2-16 . . . . . . . . . . . . . . . . . . . . . . . .
2.5 Connection of Unused Pins 2-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
System Resets, Interrupts, and Operating Modes
2-1
System Reset and Initialization
2.1 System Reset and Initialization
The system reset circuitry shown in Figure 2−1 sources both a power-on reset
(POR) and a power-up clear (PUC) signal. Different events trigger these reset
signals and different initial conditions exist depending on which signal was
generated.
Figure 2−1. Power-On Reset and Power-Up Clear Schematic
V
CC
Brownout
Reset
0 V
0 V
SVS_POR
RST/NMI
WDTNMI
WDTTMSEL
WDTIFG
† From watchdog timer peripheral module
†
†
†
WDTQn
†
†
EQU
KEYV
(from flash module)
~ 50us
Resetwd1
Resetwd2
S
R
S
S
S
S
R
POR
Latch
Delay
PUC
Latch
MCLK
POR
PUC
A POR is a device reset. A POR is only generated by the following three
events:
- Powering up the device
- A low signal on the RST/NMI pin when configured in the reset mode
- An SVS low condition when PORON = 1.
A PUC is always generated when a POR is generated, but a POR is not
generated by a PUC. The following events trigger a PUC:
- A POR signal
- Watchdog timer expiration when in watchdog mode only
- Watchdog timer security key violation
- A Flash memory security key violation
2-2 System Resets, Interrupts, and Operating Modes
2.1.1 Brownout Reset (BOR)
All MSP430x4xx devices have a brownout reset circuit. The brownout reset
circuit detects low supply voltages such as when a supply voltage is applied
to or removed from the V
device by triggering a POR signal when power is applied or removed. The
operating levels are shown in Figure 2−2.
System Reset and Initialization
terminal. The brownout reset circuit resets the
CC
The POR signal becomes active when V
remains active until V
elapses. The delay t
hysteresis V
V
(B_IT−)
Figure 2−2. Brownout Timing
V
V
(B_IT+)
V
(B_IT−)
V
CC(start)
Set Signal for
POR circuitry
hys(B_IT−)
(BOR)
hys(B_ IT−)
crosses the V
crosses the V
CC
CC
threshold and the delay t
(B_IT+)
CC(start)
is adaptive being longer for a slow ramping V
ensures that the supply voltage must drop below
level. It
(BOR)
CC.
to generate another POR signal from the brownout reset circuitry.
V
CC
The
t
(BOR)
As the V
level is significantly above the V
(B_IT−)
(MIN)
the BOR provides a reset for power failures where V
V
See the device-specific data sheet for parameters.
(MIN).
System Resets, Interrupts, and Operating Modes
level of the POR circuit,
does not fall below
CC
2-3
System Reset and Initialization
2.1.2 Device Initial Conditions After System Reset
After a POR, the initial MSP430 conditions are:
- The RST/NMI pin is configured in the reset mode.
- I/O pins are switched to input mode as described in the Digital I/O chapter.
- Other peripheral modules and registers are initialized as described in their
respective chapters in this manual.
- Status register (SR) is reset.
- The watchdog timer powers up active in watchdog mode.
- Program counter (PC) is loaded with address contained at reset vector
location (0FFFEh). CPU execution begins at that address.
Software Initialization
After a system reset, user software must initialize the MSP430 for the
application requirements. The following must occur:
- Initialize the SP, typically to the top of RAM.
- Initialize the watchdog to the requirements of the application.
- Configure peripheral modules to the requirements of the application.
Additionally, the watchdog timer, oscillator fault, and flash memory flags can
be evaluated to determine the source of the reset.
2-4 System Resets, Interrupts, and Operating Modes
2.2 Interrupts
The interrupt priorities are fixed and defined by the arrangement of the
modules in the connection chain as shown in Figure 2−3. The nearer a module
is to the CPU/NMIRS, the higher the priority. Interrupt priorities determine what
interrupt is taken when more than one interrupt is pending simultaneously.
There are three types of interrupts:
- System reset
- (Non)-maskable NMI
- Maskable
Figure 2−3. Interrupt Priority
System Reset and Initialization
CPU
PUC
PUC
Circuit
WDT Security Key
Flash Security Key
Priority
GMIRS
GIE
NMIRS
OSCfault
Flash ACCV
Reset/NMI
MAB − 5LSBs
High
Module
1
Low
Module
2
12 12 12 12 1
Bus
Grant
WDT
Timer
Module
m
Module
n
System Resets, Interrupts, and Operating Modes
2-5
System Reset and Initialization
2.2.1 (Non)-Maskable Interrupts (NMI)
(Non)-maskable NMI interrupts are not masked by the general interrupt enable
bit (GIE), but are enabled by individual interrupt enable bits (ACCVIE, NMIIE,
OFIE). When a NMI interrupt is accepted, all NMI interrupt enable bits are
automatically reset. Program execution begins at the address stored in the
(non)-maskable interrupt vector, 0FFFCh. User software must set the required
NMI interrupt enable bits for the interrupt to be re-enabled. The block diagram
for NMI sources is shown in Figure 2−4.
A (non)-maskable NMI interrupt can be generated by three sources:
- An edge on the RST/NMI pin when configured in NMI mode
- An oscillator fault occurs
- An access violation to the flash memory
Reset/NMI Pin
At power-up, the RST/NMI pin is configured in the reset mode. The function
of the RST
the RST
as long as the RST
the CPU starts program execution at the word address stored in the reset
vector, 0FFFEh.
/NMI pins is selected in the watchdog control register WDTCTL. If
/NMI pin is set to the reset function, the CPU is held in the reset state
/NMI pin is held low. After the input changes to a high state,
If the RST
/NMI pin is configured by user software to the NMI function, a signal
edge selected by the WDTNMIES bit generates an NMI interrupt if the NMIIE
bit is set. The RST
/NMI flag NMIIFG is also set.
Note: Holding RST/NMI Low
When configured in the NMI mode, a signal generating an NMI event should
not hold the RST
/NMI pin low. If a PUC occurs from a different source while
the NMI signal is low, the device will be held in the reset state because a PUC
changes the RST
/NMI pin to the reset function.
Note: Modifying WDTNMIES
When NMI mode is selected and the WDTNMIES bit is changed, an NMI can
be generated, depending on the actual level at the RST
/NMI pin. When the
NMI edge select bit is changed before selecting the NMI mode, no NMI is
generated.
2-6 System Resets, Interrupts, and Operating Modes
Figure 2−4. Block Diagram of (Non)-Maskable Interrupt Sources
ACCV
ACCVIFG
S
FCTL3.2
ACCVIE
IE1.5
Clear
System Reset and Initialization
PUC
RST/NMI
IFG1.4
PUC
IE1.4
PUC
OSCFault
IFG1.1
IE1.1
PUC
S
Clear
Clear
S
Clear
NMIIFG
NMIIE
OFIFG
OFIE
NMI_IRQA
WDTTMSEL
WDTNMIES
Counter
WDTNMI
WDT
WDTTMSEL
KEYV
WDTQn EQU
S
IFG1.0
Clear
POR
IRQA
IE1.0
Clear
Flash Module
POR PUC
SVS_POR
System Reset
Generator
WDTIE
BOR
PUC
POR
NMIRS
PUC POR
WDTIFG
IRQ
IRQA: Interrupt Request Accepted
Watchdog Timer Module
PUC
System Resets, Interrupts, and Operating Modes
2-7
System Reset and Initialization
Oscillator Fault
The oscillator fault signal warns of a possible error condition with the crystal
oscillator. The oscillator fault can be enabled to generate an NMI interrupt by
setting the OFIE bit. The OFIFG flag can then be tested by NMI the interrupt
service routine to determine if the NMI was caused by an oscillator fault.
A PUC signal can trigger an oscillator fault, because the PUC switches the
LFXT1 to LF mode, therefore switching off the HF mode. The PUC signal also
switches off the XT2 oscillator.
Flash Access Violation
The flash ACCVIFG flag is set when a flash access violation occurs. The flash
access violation can be enabled to generate an NMI interrupt by setting the
ACCVIE bit. The ACCVIFG flag can then be tested by NMI the interrupt service
routine to determine if the NMI was caused by a flash access violation.
2-8 System Resets, Interrupts, and Operating Modes