Professional Documents
Culture Documents
MPMC Unit-3
MPMC Unit-3
PART-A
1. RISC Vs. CISC
2. Von-Neumann & Harvard Architecture
3. Memory mapped I/O and Isolated I/O
4. Little-Endian and Big-Endian
PART-B
5. Low Power RISC- MSP 430 : Introduction & Variants of MSP 430 family
6. MSP430F2013 - Block diagram & features
7. Memory map of MSP430
8. MSP430 –CPU architecture & registers
9. Addressing modes of MSP430
10. Instruction formats & Instruction Timings of MSP430
11. Instruction set of MSP430
12. Sample Embedded system on MSP430
www.maheshelectronics.wordpress.com
Features and architecture considerations
• RISC Vs CISC :
RISC (Reduced Instruction Set Computer)) CISC (Complex Instruction Set Computer)
Supports few addressing modes for memory access and data transfer Supports many addressing modes for memory access and data transfer
instructions. instructions.
Instructions take fixed amounts of time for execution Instructions take varying amounts of time for execution
Instruction pipelining works effectively and increases the execution Instruction pipelining concept is not effectively works as different sizes and
speed. different execution times of instructions.
Orthogonal instruction set (allows each instruction to operate on any Non-orthogonal set (all instructions are not allowed to operate on any
register and use any addressing mode.) register and use any addressing mode.
A larger number of registers are available. Limited no. of general purpose registers
www.maheshelectronics.wordpress.com
Features and architecture considerations
• HARVARD ARCHITECTURE Vs VON-NEUMANN ARCHITECTURE :
It has separate buses for instruction as It shares single common bus for instruction
well as data fetching. This means that, and data fetching. This means that only one
the data memory and program memory set of addresses covers both data memory
are separated. and program memory. The memory map
shows the addresses at which each type of
memory is located.
www.maheshelectronics.wordpress.com
Low performance as compared to Harvard
Easier to pipeline, so high performance can be achieve. architecture
First fetches the instruction and then fetches the data. The two separate fetches
It allows simultaneous access to the program and data memories. For instance, the CPU slows down the controller’s operation.
can read an operand from the data memory at the same time as it reads the next
instruction from the program memory. Because several memory cycles are needed to extract a full instruction from
memory, this architecture is intrinsically less efficient.
Since data memory and program memory are stored physically in different locations, no Accidental corruption of program memory may occur if data memory and
chances exist for accidental corruption of program memory program memory are stored physically in the same chip.
A problem with the Harvard architecture is that constant data (often lookup tables) must
be stored in the program memory because it is nonvolatile. This means that constants
The system is simpler and there is no difference between access to constant and
cannot be read in the same way as volatile values from the data memory. Special “table
variable data.
read” instructions must therefore be provided or part of the program memory is mapped
into data memory
Separate decoding logic is required, because separate buses and control signals are used No additional logic is required because, Same bus and control signals are used for
for accessing data memory and program memory accessing for both data memory and program memory.
www.maheshelectronics.wordpress.com
Features and architecture considerations
MEMORY MAPPED I/O & I/O MAPPED I/O :
Less no. of instructions are for I/O access. ( only IN and OUT
All instruction which can access memory can be used to access I/O instructions)
ports.
The data transfer takes place between Accumulator and I/O port
The data can be moved from any register to I/O port and vice-versa. only
The arithmetic, logic and bit manipulation instructions which are No instructions are available for direct manipulation of I/O data.
available for data in memory can also be used for I/O operations. First the processor reads data from I/O port and then
Hence the processor can directly manipulate data from I/O port. manipulates.
Large number of I/O devices can be interfaced Less no. of I/O devices can be interfaced
Full address space can’t be used for addressing Memory, because some Full address space can be used for addressing Memory, because
locations are allotted for I/O ports. I/O locations are separated from memory.
The entire address bus must be fully decoded for every device, which Less logic is needed to decode a discrete address and therefore
increases the cost less cost
www.maheshelectronics.wordpress.com
Features and architecture considerations
LITTLE-ENDIAN & BIG-ENDIAN PROCESSORS
Endianness specifies the order which the data is stored in the memory
by processor operations in a multi byte system.
Little-endian means lower order data byte is Big-endian means the higher order data
stored in memory at the lowest address and byte is stored in memory at the lowest and
the higher order data byte at the highest the lower order data byte at the highest
address. address.
2000H 2000H
2001H 2001H
2002H 2002H
2003H 2003H
www.maheshelectronics.wordpress.com
.
INTRODUCTION TO MSP430 MICROCONTROLLERS:
www.maheshelectronics.wordpress.com
MSP430 part numbering:
www.maheshelectronics.wordpress.com
VARIANTS OF MSP 430 FAMILY – 1XX, 2XX, 3XX, 4XX, 5XX:
MSP430x1xx 0.1 μA RAM retention Flash/ROM options: 1–60 KB 12-bit DAC, up to 2 16-bit timers, WDT, brown-out reset, SVS,
0.7 μA real-time clock mode RAM options: 128 B– 2 KB USART module (UART, SPI), DMA, 16×16 multiplier, Comparator_A,
200 μA / MIPS active GPIO options: 14/22/48 pins Temp. sensor
Features fast wake-up from standby mode in less than 6 µs. ADC options: Slope, 10 & 12-bit SAR
MSP430F2xx 0.1 μA RAM retention Flash/ROM options: 1 KB–60 KB operational amplifiers, 12-bit DAC, up to 2 16-bit timers, watchdog
0.3 μA standby mode (VLO) RAM options: 128 B – 8 KB timer, brown-out reset, SVS, USI module (I²C, SPI), USCI module,
0.7 μA real-time clock mode GPIO options: 10/16/24/32/48 pins DMA, 16×16 multiplier, Comparator_A+, Temperature sensor
220 μA / MIPS active ADC options: Slope, 10 & 12-bit SAR, 16 & 24-bit Sigma Delta
Feature ultra-fast wake-up from standby mode in less than 1 μs
MSP430x3xx 0.1 μA RAM retention ROM options: 2–32 KB LCD controller, multiplier
0.9 μA real-time clock mode RAM options: 512 B–1 KB
160 μA / MIPS active GPIO options: 14/40 pins
Features fast wake-up from standby mode in less than 6 µs. ADC options: Slope, 14-bit SAR
MSP430x4xx 0.1 μA RAM retention Flash/ROM options: 4 KB– 60 KB 12-bit DAC, Op Amps, RTC, up to two 16-bit timers, watchdog
0.7 μA real-time clock mode RAM options: 256 B – 8 KB timer, basic timer, brown-out reset, SVS, USART module (UART,
200 μA / MIPS active GPIO options: 14/32/48/56/68/72/80 pins SPI), USCI module, LCD Controller, DMA, 16×16 & 32x32 multiplier,
Features fast wake-up from standby mode in less than 6 µs. ADC options: Slope, 10 & 12-bit SAR, 16-bit Sigma Delta Comparator_A, Temp. sensor
MSP430x5xx 0.1 μA RAM retention Flash options: up to 512 KB High resolution PWM, 5 V I/O's, USB, backup battery switch, up to
2.5 μA real-time clock mode RAM options: up to 66 KB 4 16-bit timers, watchdog timer, Real-Time Clock, brown-out reset,
165 μA / MIPS active ADC options: 10 & 12-bit SAR SVS, USCI module, DMA, 32x32 multiplier, Comp B, temperature
Features fast wake-up from standby mode in less than 5 µs. GPIO options: 29/31/47/48/63/67/74/87 pins sensor
MSP430x6xx 0.1 μA RAM retention Flash options: up to 512 KB USB, LCD, DAC, Comparator_B, DMA, 32x32 multiplier, power
2.5 μA real-time clock mode RAM options: up to 66 KB management module (BOR, SVS, SVM, LDO), watchdog timer, RTC,
165 μA / MIPS active ADC options: 10 & 12-bit SAR Temp sensor
Features fast wake-up from standby mode in less than 5 µs. GPIO options: 74/90 pins
www.maheshelectronics.wordpress.com
Memory map of MSP430
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
• The cpu features
– Calculated branching
– Table processing
– 27 RISC instructions
– 7 addressing modes
– All instructions use all the addressing modes
– Full register access
– Single cycle register operations (RISC)
– Direct memory-to-memory transfers
– Constant generator provides most used values
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
• R4 thru R15
– Registers are indistinguishable
– Can be used as
• Data Registers
• Address Registers
• Index values
– Can be accessed with byte or word instructions
– There is Register-Byte operation and Byte-Register
operation – covered later
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
• R0: Program Counter (PC) :
• The 16-bit Program Counter (PC/R0) points to the
next instruction to be fetched from memory and
executed by the CPU.
• The Program counter is incremented by the number
of bytes used by the instruction (2, 4, or 6 bytes,
always even).
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
• R1: Stack Pointer (SP)
• The stack memory is a memory block where the
data is stored in LIFO manner.
• The Stack Pointer (SP/R1) holds the address of the
stack-top.
• In the MSP430, as in many other processors, the
stack is allocated at the top of the RAM and grows
down towards low addresses.
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
• Operation of the Stack :
The operation of the stack is illustrated in the
following figure. The specific addresses are for
MSO430F2013 with 128 Bytes of RAM are from
0x0200 to 0x027F. Hence, Before the execution, the
initially the value of SP = 0x0280
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
• R2: Status Register (SR)
• The Status Register (SR/R2) stores the status bits
and control bits.
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
• Enable Interrupts :: Setting the general interrupt
enable (GIE) bit enables maskable interrupts.
• Clearing the bit disables all maskable interrupts.
• There are also nonmaskable interrupts, which
cannot be disabled with GIE.
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
• Control of Low-Power Modes :
• SCG1 (System clock generator 1) : When set, turns
off the SMCLK.
• SCG0 (System clock generator 0) : When set, turns
off the DCO dc generator, if DCO-CLK is not used for
MCLK or SMCLK.
• OSCOFF (Oscillator OFF ) : When set, turns off the
LF XT1 crystal oscillator,
• if LFXT1-CLK is not used for MCLK or SMCLK.
• CPUOFF : When set, turns off the CPU.
www.maheshelectronics.wordpress.com
MSP430 –CPU architecture & registers
• R2/R3: Constant Generator Registers (CG1/CG2)
• Depending of the source-register addressing modes (As) value, six commonly used constants
can be generated without a code word or code memory access to retrieve them.
• The constants below are chosen based on the bit (As) of the instruction that selects the
addressing mode.
•
R2 10 +4
R2
11 +8
R3
00 0
R3
01 +1
R3
10 +2
R3
11 -1 (FFFF)
www.maheshelectronics.wordpress.com
MSP430 –Addressing modes
• MSP430 addressing modes
– Addressing mode – the way in which the operand(s) of
an instruction are accessed, i.e., the effective addresses
are calculated.
– 7 modes supported
• Register Mode – (Rn) – operands are in registers
• Immediate Mode – #N – The operand is part of the
instruction
– Instructions have format OPCODE #OPERAND
• Absolute Mode – &ADDR – The address of the
operand is given by the word following the opcode
– Instructions have format OPCODE &ADDRESS
www.maheshelectronics.wordpress.com
MSP430 –Addressing modes
• Remainder of addressing mode
– Indexed Mode – X(Rn) – (Rn+X) points to (is the address
of) the operand. The value X is the next word in the
instruction stream after the OPCODE.
– Symbolic Mode – ADDR – (PC+X) points to the operand.
X is the next word.
– Indirect Register Mode - @Rn – Rn is used as a pointer to
the operand.
– Indirect Autoincrement - @Rn+ - Rn is used as a pointer
to the operand. After access Rn is incremented by 1
for .B instructions and by 2 for .W instructions
www.maheshelectronics.wordpress.com
INSTRUCTION FORMATS OF MSP430 :
www.maheshelectronics.wordpress.com
Movement Instructions (Data Transfer)
Instruction Operation Example
2 push.w src ( first the SP is decremented by 2 and the source content is stored at stacktop) SP SP-2
@ --SP = src @ SP R5
www.maheshelectronics.wordpress.com
Arithmetic and Logic Instructions
Binary Arithmetic Instructions with Two operands
Instruction Operation Example
Double decrement
decd.w R6
3 decd.w dst The content of destination is decremented by 2
R6 R6 – 2
dst dst – 2
Double increment
incd.w R6
5 incd.w dst The content of destination is inccremented by 2
R6 R6 + 2
dst dst + 2
Perfroms the decimal addtion of destination and source with carry dadd.w R5, R6
1 dadd.w src, dst
dst dst + src + C R6 R6 + R5+C
Invert destination
dst ~dst
www.maheshelectronics.wordpress.com
Logic Instructions with Two operands
The source operand and the destination operand are logically ORed. The result is placed
4 bis.w src, dst into the destination. The source operand is not affected. bis.w R5, R6
The inverted source operand and the destination operand are logically ANDed. The result
5 bic.w src, dst is placed into the destination. The source operand is not affected bic.w R5, R6
www.maheshelectronics.wordpress.com
Byte manipulation
www.maheshelectronics.wordpress.com
Operations on Bits in Status Register
These instructions are used to set or clear the flags in Status Register. All these
instructions are emulated instructions.
www.maheshelectronics.wordpress.com
Control Transfer Instructions
Instruction Description Operation
1 br src Branch ( go to) PC src
SP SP-2
2 call src Call Subroutine @ SP PC
PC src
PC @ SP
3 ret Return from Subroutine
SP SP+2
SR @ SP
Return from Interrupt SP SP+2
4 reti
PC @ SP
SP SP+2
No operation
5 nop
( consumes single cycle )
www.maheshelectronics.wordpress.com
JUMP Instructions
1 jmp label Unconditional Jump
2 jc / jlo label Jump if carry / Jump if lower Jump if C =1
3 jnc / jhs label Jump if not carry / Jump higher or same Jump if C =0
4 Jz / jeq label Jump if zero / Jump if equal Jump if Z =1
5 Jnz / jne label Jump if not zero / Jump if not equal Jump if Z =0
6 jn label Jumpif negative Jump if N =1
7 jge label Jump if greater or equal (signed values) Jump if (N xor V) =0
8 jl label Jump if less than (signed values) Jump if (N xor V) =1
www.maheshelectronics.wordpress.com
Sample Embedded system on MSP430
www.maheshelectronics.wordpress.com