Professional Documents
Culture Documents
CHAPTER- 3
INTRODUCTION TO
MSP430 ARCHITECTURE
.
Contents:
3.1: Introduction to MSP430 Architecture
3.2: Features of MSP430
3.3: Different families and naming of MSP430
3.4: Data sheet reading of MSP430
3.5: Central Processing Unit (CPU)
3.6: Registers in the CPU of MSP430
3.7: Memory mapping of MSP430
3.8: Addressing modes
3.9: Constant Generators and Emulated Instructions
3.10: Low Power Modes of MSP430
3.11: Comparison of MSP430 with 8051 Architecture
3.12: Exceptions: interrupts and resets
3.13: Interrupt Processing
1 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 2.
3.1: Introduction to MSP430 Architecture:
MSP430 is the simplest microcontroller from Texas Instruments which
was introduced in the late 1990’s. It is a 16 bit data processor with RISC
architecture. It has 16 bit address and hence it can address up to 2 16=64-KB
of memory. The MSP430 has 16 registers in its CPU which can be utilized for
storing of address or data.
2 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 3.
1. MSP430x1xx: Provides wide range of general purpose devices from simple
versions to complete systems for processing signals. The peripheral units
include hardware multiplier, which can be used as Digital Signal Processor.
The packages have 20-64 pins.
2. MSP430F2xx: This can run at 16-MHz and consumes very less current.
Packages have 14 pin in Plastic Dual-in-line Package (PDIP).
The pull-up and pull-down resistors are provided. It offers sigma-delta type
of A-D conversion.
3. MSP430x3xx: This includes drivers for LCD. But now, it is no longer
available.
4. MSP430x4xx: This can drive LCD up to 160 segments. Many of them are
ASSPs but general purpose devices as well. The packages have 48 to 113
pins. Among them, most pins are for driving the LCDs.
5. MSP430: This is the original architecture extended to MSP430X in 2006.
Vcc and Vss: These pins are Supply voltage and Ground respectively.
P1.0 – P1.7, P2.6 and P2.7: Grouped into ports P1 and P2.
TACLK, TA0 and TA1: TACLK can be used as the clock input to the timer.
TA0 and TA1 can be used as either input or output.
+A0 to +A4 are used as input to the analog to digital convertor. Vref is
the reference voltage to the convertor.
ACLK and SMCLK are the outputs for the microcontroller’s clock signal.
SCLK, SDO and SCL are the Serial Interface for the Serial Peripheral
Interface (SPI) or Inter-Integrated Circuit (I2C).
Xin and Xout are connected to a crystal oscillator.
3 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 4.
RST: Reset active low signal.
NMI: Non Maskable Interrupt.
TCK, TMS, TCLK, TDI, TDO and test signal are used for JTAG interface.
SBWTDIO and SBWTCK provide the Spy-bi- wire Interface used as an
alternate to JTAG to save pins.
vcc 1 14 Vss
P1.0/TACLK/ACLJK/A0+ 2 13 XIN/P2.6/TA1
P1.1/TA0/AO-/A4+ 3 12 XOUT/P2.7
OUTSIDE
P1.2/TA1/A1+/A4- 4 VIEW 11 TEST/SBWTCK
P1.3/Vref/A1- 5 10 XRST/NMI/SBWTDF0
P1.4/SMCLK/A2+/TCK 6 9 P1.7/A3-/SDI/SDA/TD0/TDI
P1.5/TA0/A2- 7 8 P1.6/TA1/A3+/SD0/TDI/TCL
The diagram below shows the inside view of F2013 (2-KB) and
F2003 (1-KB) version of MSP430.
The block diagram consists of clock generation, emulation, JTAG and
Spy-bi-wire which are used to communicate with a desktop computer
when downloading a program for debugging.
There are Memory Address Bus (MAB) and Memory Data Bus (MDB).
There is 1KB of flash memory in MSPF2003 and 2KB of flash
memory in MSPF2013. The RAM is of 128 bytes.
There are 6 peripheral functional blocks. i.e., ports timer-A Watch
Dog Timer, Universal Serial Interface (USI) SD16-A (Sigma Delta
Analog Digital converter).
There is only one pair of Address and Data buses as per the
Von-Neumann architecture.
4 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 5.
Vcc Vss
5 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 6.
- A set of 16 registers is the characteristic of RISC (Reduced Instruction
Computer).
6 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 7.
3.6: Registers in the CPU of MSP430: There are 4 Special purpose
registers and 12 General purpose registers in MSP430. Those are:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
7 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 8.
a. Initialization: when reset, the stack pointer points to one location ahead,
to stack beginning.
b. After PUSH.W#0x1234 the stack pointer increments by 2 locations to
store a word.
c. Further PUSH.B #0x56
. PUSH.W #0x789A
Here, the Stack Pointer increments twice to store a byte and word.
d. After POP.W R5 the stack pointer decrements by 2 to retrieve a word
from stack to register R5.
15 …... 9 8 7 6 5 4 3 2 1 0
This is a 16-bit register which contains a set of flags which are categorized
into 3 sections. The diagram shows the Status register. N, Z, C & V are
affected by the operation perfumed by ALU.
Z (Zero bit): This indicates the all zero condition in the result after
computational operation. The Z-bit is to check whether two values are
equal.
N (Negative flag): This is made equal to the MSB of the result which
indicates whether they have negative or positive sign of the value.
V (Overflow flag): The V-bit would be set in the case to show that an
overflow occurs in a signed operation.
8 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 9.
Enable Interrupts/ General Interrupt Enable (GIE): This bit is cleared to
disable the maskable interrupts and set to enable the interrupts.
Control low power modes: CPUOFF, OSCOFF SCG0 and SCG1 bits control
the modes of operation of the MCU. The system is fully operational when
all bits are cleared. Setting combinations of these bits choose different low
power modes.
9 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 10.
Memory mapped Input and Output:
In MSP430, memory mapped input and output method is used. This
means that the ports are treated like memory registers called peripheral
register.
Each port is a byte access. These registers can be read, written and
modified just like a ram location. Even arithmetic operations are possible on
them.
Clock generator:
All microcontrollers use a clock circuit to drive CPU and Peripherals. The
MSP430 provides a clock system for different clock sources. Different clock
signals are Master Clock (MCLK), Sub-system Main Clock (SMCLK) and
Auxilary Clock (ACLK).
10 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 11.
Internal low frequency oscillator (Very Low frequency Oscillator-VLO):
It provides alternative to LFXT1 if the crystal oscillator accuracy
is not required.
VLO
Divide by
MUX 1/2/4/8 ACLK (slower peripherals)
IFxT1
11 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 12.
Ex: ADD.W SRC,DST
1. Register mode: This addressing mode involves registers for both source
and destination.
Ex: MOV.W R5,R6
This copies a word from r5 to r6.
- The PC increments by 2 while this instruction is fetched.
- The constant generator CG2 reads a ‘0’ as a source.
- For the byte operations, the lower byte of the register takes the byte
and the higher byte is cleared.
Before: After:
R5=0x0210 R5=0x0210
R6=0x1111 R6=0x5555
LOC: 0x0213 0x5555 LOC: 0x0213 0x5555
0X0214 0x0214
12 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 13.
Here, a word is loaded from a location called loopctr to the register R6.
The above instruction is replaced by the assembler as: MOV.W X(PC),R6
4. Absolute mode:
In this instruction, Loads a byte from P1In into R6. The assembler treats this
like MOV.B P1In(SR),R6 Where SR=0, acts as a ‘0’ constant provider to serve
as constant generator CG1.
Before: After:
13 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 14.
SP= 0x0262 SP= 0x0262
R6=0x1111 R6=0x4444
Here, the register R5 holds the address and not the data. Therefore, R5
acts as a pointer. The above instruction loads the word from the location
pointed by R5 to the register R6.
Before: After:
R6=0x1111 R6=0x4444
Before: After:
R6=0x1111 R6=0x444
14 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 15.
8. Immediate mode:
15 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 16.
i. In Register addressing mode, a constant ‘0’ is provided.
Ex: MOV.W R3,R6
ii. In Indexed addressing mode, a constant ‘+1’ is provided.
Ex: MOV.W Cntr(R3),R6
iii. In Register indirect addressing mode, a constant ‘+2’ is
generated.
Ex: MOV.W@(R3),R6
iv. In Register auto increment mode, a constant ‘-1’ or ‘FFFF’ is
generated. Ex: MOV.W @(R3)+,R6
- Low Power Mode-0: Here, CPU and MCLK are disabled. ACLK and
SMCLK are active, with I~~85uA. This mode is used when the
CPU is not required but some modules require a fast clock from
16 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 17.
SMCLK and the DCO.
Here, CPUOFF=1, OSCOFF=0, SCG0=1, SCG1=0.
- LPM-3: CPU, MCLK, SMCLK, and DCO are disabled. Only ACLK is
active with I~~1uA. This is standard low power mode when the
device must wakeup itself at regular intervals and hence, it needs
a slower clock. This is also required to maintain the Real Time
Clock (RTC). The current can be reduced to about 0.5uA by using
VLO instead of an external crystal.
Here, CPUOFF=1, OSCOFF=0, SCG0=1,SCG1=1
- LPM-4: CPU and all the clocks are disabled. I~~0.1uA. This device
can be wakened only by an external signal. This is also called
RAM retention mode.
Here, CPUOFF=1, OSCOFF=1, SCG0=1, SCG1=1.
3.11: Comparison of MSP430 with 8051 Architecture:
Oscillator faults: This warns an error condition with the crystal oscillator.
The oscillator fault can be enabled to generate the NMI interrupt. A PUC
(Power up Clear) signal can trigger an oscillator fault. The PUC also
switches off the XT2 oscillator.
18 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 19.
2. Maskable Interrupts:
Maskable interrupts are caused by the peripherals with interrupt
capability including the watch dog timer overflow in interval timer mode. Each
Maskable interrupt source can be individually disabled by an Interrupt Enable
bit or all Maskable Interrupts can be disabled by the General Interrupt Enable
bit (GIE) present in the status register.
Interrupt Acceptance:
1. The current instruction is executed.
2. The Program Counter content is saved.
3. The SR is pushed to stack.
4. Higher priority interrupt is selected and other lower priority
interrupts are kept pending.
5. The interrupt request flag resets while serving an interrupt source.
6. The SR is cleared to avoid low-power mode and GIE=0 to avoid
further interrupts.
7. The vector is loaded to the PC to drive the Program execution to
Interrupt Service Routine.
19 PVP POLYTECHNIC,
Mallathalli Bangaluru-56
Embedded Systems by PS CHANDRASHEKAR.
Chpt-3: Introduction to MSP430 Architecture 20.
20 PVP POLYTECHNIC,
Mallathalli Bangaluru-56