MSP 430
MSP 430
By
Mrs. Chaitali K Kulkarni
Assistant Professor,
Department of Electronics and Telecommunication Engineering
Syllabus
Module. Details
no
1 Introduction to 16 bit microcontrollers
2 MSP430 GPIO, Timer and On-chip Peripherals
3 Introduction to 32bit microcontrollers
4 ARM LPC2148: Overview and interfacing
5 Mini project on MSP430/LPC 2148
Recommended books
Sr. Name/s of Author/s Title of Book Name of
No. Publisher with
country
1.1
Features and Different families and nomenclature of
MSP430
1.2
Functional block diagram, pin out, memory, memory-
Mapped Input and Output, Clock Generator
Introduction to MSP 430
Introduced in 1990s
Offers a wide variety of 16-bit MCUs with ultra-low-power
Integrated analog and digital peripherals for sensing and
measurement applications
Mixed Signal processing capability
It can be employed in several applications like spirometers, pulse
oximeters, blood pressure monitors and heartbeat monitors
Architecture features
It follows RISC architecture
Von Neumann architecture
MSP430 controller consists of a 16-bit RISC CPU, clocking devices and
some other peripherals
Maximum code efficiency is obtained because of very powerful 16-bit
RISC CPU, 16- bit registers, constant generators etc.
The DCO offers switching between different modes with in 6µs
interval.
CISC and RISC architecture
• Complex Instruction Set Computer
• Reduced Instruction Set Computer
MSP430 generations/families
There are six general generations of MSP430 processors
Such as 3xx generation, 1xx generation, the '4xx generation, the '2xx
generation, the '5xx generation, and the '6xx generation
The 3xx and 1xx generations are limited to a 16-bit address space
In the later generations this was expanded to include '430X'
instructions that allow a 20-bit address space
Continued………..
• MSP430x1xxseries
It is the basic generation without an embedded LCD controller. They are
generally smaller than the '3xx generation. These flash- or ROM-based
ultra-low-power MCUs offer 8 MIPS, 1.8–3.6 V operation, up to 60 KB flash,
and a wide range of analog and digital peripherals.
• MSP430F2xx series
• The are similar to the '1xx generation, but operate at even lower power,
support up to 16 MHz operation, and have a more accurate (±2%) on-chip
clock that makes it easier to operate without an external crystal. These
flash-based ultra-low power devices offer 1.8–3.6 V operation. Includes the
very-low power oscillator (VLO), internal pull-up/pull-down resistors, and
low-pin count options.
Continued………..
MSP430G2xx series
The MSP430G2xx Value Series features flash-based Ultra-Low Power MCUs up to 16
MIPS with 1.8–3.6 V operation. Includes the Very-Low power Oscillator (VLO), internal pull-
up/pull-down resistors, and low-pin count options, at lower prices than the MSP430F2xx
series.
• MSP430x3xx series
• It is the oldest generation, designed for portable instrumentation with an
embedded LCD controller. This also includes a frequency-locked loop oscillator
that can automatically synchronize to a low-speed (32 kHz) crystal. This
generation does not support EEPROM memory, only mask ROM and UV-
eraseable and one-time programmable EPROM Later generations provide only
flash memory and mask ROM options. These devices offer 2.5–5.5 V operation,
up to 32 KB ROM.
Continued………..
.
MSP430x4xx series
These are similar to the '3xx generation, but include an integrated LCD controller,
and are larger and more capable. These flash or ROM based devices offers 8–16
MIPS at 1.8–3.6 V operation, with FLL, and SVS. Ideal for low power metering and
medical applications
MSP430x5xx series
They are able to run up to 25 MHz, have up to 512 KB flash memory and up to 66
KB RAM. This flash-based family features low active power consumption with up to
25 MIPS at 1.8–3.6 V operation (165 uA/MIPS). Includes an innovative power
management module for optimal power consumption and integrated USB.
Source: WWW.TI.COM
Functional block diagram
• memory address bus is 16 bits wide so there are 216 = 65,536 = 64K
• Uses Little endian style
Brief description
• Special function registers: Mostly concerned with enabling functions of
Some modules and enabling and signaling interrupts from peripherals.
• Peripheral registers with byte access and peripheral registers with word
access:
• Provide the main communication between the CPU and peripherals.
Some must be accessed as words and others as bytes. They are grouped
in this way to avoid wasting addresses. If the bytes and words were
mixed, numerous unused bytes would be needed to ensure that the
words were correctly aligned on even addresses.
Continued……………..
• Random access memory: Used for variables. This always starts at
address 0x0200 and the upper limit depends on the size of the RAM
• Bootstrap loader: Contains a program to communicate using a
standard serial protocol, often with the COM port of a PC
• Information memory: A 256B block of flash memory that is intended
for storage of nonvolatile data
• Code memory: Holds the program, including the executable code
itself and any constant data
• Interrupt and reset vectors: Used to handle “exceptions,” when
normal operation of the processor is interrupted or when the device
is reset. This table was smaller and started at 0xFFE0 in earlier devices
Central Processing Unit
It includes the arithmetic logic unit (ALU), which performs computation,
a set of 16 registers designated
R0–R15 and the logic needed to decode the instructions and
implement them.
The CPU can run at a maximum clock frequency fMCLK of 16MHz in the
MSP430F2xx family and some newer MSP430x4xx devices, and 8MHz in
the others.
•F
Fig: Registers in the
CPU of the MSP 430
Continued………………….
• Program counter( PC):
• This contains the address of the next instruction to be executed
LPM0 CPU and MCLK are disabled, SMCLK and ACLK remain active, I ≈ 85A.
This is used when the CPU is not required but some modules require a
fast clock from SMCLK and the DCO.
LPM3 CPU, MCLK, SMCLK, and DCO are disabled; only ACLK remains active; I
≈ 1A. This is the standard low-power mode when the device must
wake itself at regular intervals and therefore needs a (slow) clock.
It is also required if the MSP430 must maintain a real-time clock. The
current can be reduced to about 0.5Aby using the VLO instead of an
external crystal in a MSP430F2xx if fACLK need not be accurate
LPM4 CPU and all clocks are disabled, I ≈ 0.1A. The device can be wakened
only by an external signal. This is also called RAM retention mode
Waking from a Low-Power Mode
• An interrupt is needed to awaken the MSP430. The processor handles
an interrupt from a low-power mode in almost the same way as in
active mode. The only difference is that MCLK must first be started so
that the CPU can handle the interrupt;
• this replaces the first step when the CPU is active, which is to
complete the current instruction. MCLK is started automatically by
the hardware for servicing interrupts and requires no intervention
from the programmer.
•
Continued…………
• Remember that the status register is cleared when an interrupt is
accepted, which puts the processor into active mode. Similarly, MCLK
is automatically turned off at the end of the ISR if the MSP430 returns
to a low-power mode when the status register is restored
• Thus interrupts from low-power modes are written in exactly the
same way as those from active mode. This has the attractive feature
that low-power modes fit naturally into the structure of many
programs
Digitally Controlled Oscillator( DCO)
• One of the aims of the original design of the MSP430 was that it
should be able to start rapidly at full speed from a low-power mode,
without waiting a long time for the clock to settle
• Highly controllable RC circuit
• ACLK-32KHZ
• SMCLK-1MHZ
__enable _interrupt (); // Enable interrupts (intrinsic)
for (;;) { // Loop forever doing nothing
__low_power_mode_0 (); // Enter low power mode LPM0
} // Interrupts do the work
}
// ----------------------------------------------------------------------
// Interrupt service routine for Timer A channel 0
// Processor returns to LPM0 automatically after ISR
// ----------------------------------------------------------------------
#pragma vector = TIMERA0_VECTOR
__interrupt void TA0_ISR (void)
{
P2OUT ˆ= LED1|LED2; // Toggle LEDs
Addressing Modes
• Example:
• Add the contents of R7 to the contents of R8
• ADD R7,R8 ; (R7) + (R8) → (R8)
• Indexed Addressing
• The address of the operand is the sum of the index and the contents
of the register used.
• The index is contained in an additional word located after the
instruction word.
• Example:
• Compare the 2nd byte of a table addressed by R5 with the low Byte
of R15. Result to the Status Register SR
• CMP.B 1(R5),R15 ; (R15) – (1 + (R5)) ;
• If the register in use is the program counter then two additional,
important addressing modes
Symbolic Mode (PC Relative)
• In this case the program counter PC is used as the base address, so
the constant is the offset to the data from the PC
• It is used by writing the symbol for a memory location without any
prefix
• Example
• mov.w LoopCtr ,R6 ; load word LoopCtr into R6 , symbolic mode
• LoopCtr= pc
Absolute Mode
• The constant in this form of indexed addressing is the absolute
address of the data
• This is already the complete address required so it should be added to
a register that contains 0
• Absolute addressing is shown by the prefix & and should be used for
special function and peripheral registers, whose addresses are fixed in
the memory map
• Example:
• Add the byte addressed by R8 to the contents of R9
• ADD.B @R8,R9 ; ((R8)) + (R9) → (R9)
Indirect Autoincrement Register Mode
• Again this is available only for the source and is shown by the symbol
@ in front of a register with a + sign after it
• Autoincrement is usually called post increment addressing because
many processors have a complementary predecrement addressing
mode, equivalent to *--c in C, but the MSP430 does not.
• An important feature of the addressing modes is that all operations
on the first address are fully completed before the second address is
evaluated
Example
• mov.w @R5+,R6
• N:
• The negative flag N is made equal to the msb of the result, which
indicates a negative number if the values are signed
• V:
• The signed overflow flag V is set when the result of a signed operation
has overflowed, even though a carry may not be generated.