Video Lecture: Microprocessors Microcontrollers
Video Lecture: Microprocessors Microcontrollers
Video Lecture: Microprocessors Microcontrollers
on
MICROPROCESSORS
&
MICROCONTROLLERS
By
K.Ravichandra
Asst.Prof/ECE
1. Microprocessors Vs Microcontrollers
2. Introduction to MSP430 microcontrollers
- Features, Variants, Part numbering
3. Block diagram of MSP430
4. Memory organization of MSP430
5. CPU architecture and Registers of MSP430
6. Block diagram of MSP430x5xx
7. Memory organization of MSP430x5xx
8. CPU architecture and Registers of MSP430x5xx
9. Addressing modes of MSP430
10. Instruction formats and Timings of MSP430
11. Instruction set of MSP430
12. Sample Embedded system using MSP430
3
3.1 Microprocessors Vs
Microcontrollers
Microprocessors Microcontrollers
4
Microprocessor is the heart of the computer system, Microcontroller is the heart of the embedded system, designed to
used for general purpose applications. perform a specific task by executing a fixed program.
µp is a central processing unit (CPU) on a single µc has a CPU, in addition with a fixed amount of RAM, ROM and
chip, which consists of ALU, Registers, and Timing other peripherals like I/O ports, Serial port, Timers/Counters,
and control units. Interrupt controller, etc all embedded on a single chip
Due to external components, the size, power and Low size, Low power and Low cost, due to less no. of external
cost of the system increases components.
Used in desktop PC's, Laptops, Notepads, etc Used in embedded applications like Washing machine, DVD
player, AC, etc
INTRODUCTION TO MSP430
5
Features of MSP430 :
MSP430 is Mixed Signal microcontroller family from Texas
Instruments , designed for low cost and low power applications
It has 16-bit RISC based architecture
It supports different Low power modes
It is capable of wake-up times below 1 microsecond, allowing
the microcontroller to stay in sleep mode longer, minimizing its
average current consumption
It has 16-bit Address bus and 16-bit data bus
It consists of 16 registers (R0-R15)
All registers are 16-bit wide
Supports 27 core instructions and 7 addressing modes
Instructions processing on either bits, bytes or words
Extensive vectored-interrupt capability
A wide range of on-chip peripherals are available
3.2. INTRODUCTION TO MSP430
6
Introduction to MSP430 :
MSP430 is Mixed Signal microcontroller family from Texas
(i) MSP430x1xx
(ii) MSP430x2xx
(iii) MSP430x3xx
(iv) MSP430x4xx
MSP430x4xx series can drive LCDs with up to 160 segments.
Variants of
MSP430x1xx MSP430x2xx MSP430x3xx MSP430x4xx MSP430x5xx
MSP430 family
Clock 8 MHz 16 MHz 16 MHz 16 MHz 16 MHz
Iactive /MIPS 200 μA 200 μA 160 μA 200 μA 165 μA
IRTC mode 0.7 μA 0.7 μA 0.9 μA 0.7 μA 2.5 μA
IRAMret 0.1 μA 0.1 μA 0.1 μA 0.1 μA 0.1 μA
Wake-up time < 6 µs < 1 µs < 6 µs < 6 µs < 5 µs
Up to
Flash/ROM 1-60KB 1-60KB 2-32 KB 4-60 KB
512KB
128 B 128 B 512 B 256 B Up to
RAM
-2KB -2KB -2KB -2KB 66KB
GPIO 10-48 10-48 14-40 14-80 32-90
MSP430 PART NUMBERING
14
3.3. BLOCK DIAGRAM OF MSP430
15
The MSP430F2013 has the following features
16
18
Flash memory:
•Flash memory is used to store the programs and constant
variables The size of Flash memory in MSP430F2003 is 1
KB
•The size of Flash memory in MSP430F2003 is 2 KB
RAM
•RAM is used to store the temporary data (Read/Write
memory) The size of RAM in MSP430F2003 and F2013 is
128 Bytes
bit Sigma Delta ADC : SD16_A
•The SD16_A is ahigh performance 16-bit analog to
digital converter used to interface analog signals with 200
19KSPS
I/O ports : P1 & P2
•The MSP430 has Two I/O ports: Port-P1 and Port-
P2 The Port-P1 has 8- I/O pins and P2 has 2- I/O
pins
•Each I/O pin is individually configurable for input
(or) output. Each pin can be configurable for pull-up
/ pull-down resistors Ports P1 and P2 have interrupt
capability.
20
Watch Dog Timer
• A watchdog timer (WDT) is an electronic timer that is used
to detect and recover from computer malfunctions. The
WDT module restarts the system on occurrence of a
software problem (or) if a selected time interval expires.
• During normal operation, the system regularly restarts the
WDT to prevent it from elapsing, or "timing out". If the
system fails to restart the WDT due to a hardware fault (or)
program error, the timer will elapse and generate a timeout
signal.
• The timeout signal is used to initiate corrective actions like
placing the system in a safe state and restoring normal
system operation.
21
Timer_A2
• Timers are essential to almost any embedded application
• Timers are used to
• Generate fixed-period events
• Periodic wakeup
• Count edges
• Generate delays
• Measure time intervals
• Replacing delay loops with timer calls allows CPU to
sleep, consuming less power
• Timers can support multiple capture/compares, PWM
outputs, interval timing and extensive interrupt capabilities
22
Universal Serial Interface (USI) :
•The Universal Serial Interface (USI) module supports
multiple serial communication modes
23
Brown out Reset:
• The brownout protection comes into action if the supply
voltage drops to a dangerous level
• The brownout reset circuit detects low supply voltages such
as when a supply voltage is applied to (or) removed from the
VCC terminal. The brownout reset circuit resets the device
by triggering a POR (Power on Reset) signal when power is
applied (or) removed. The brownout circuit is used to
provide the proper internal reset signal to the device during
power ON and power OFF.
• The Supply Voltage Supervisor (SVS) is used to monitor the
supply voltage or an external voltage. The SVS can be
configured to set a flag or generate a POR reset when the
supply voltage or external voltage drops below a user
selected threshold.
24
3.4. MEMORY MAPPING / ADDRESS SPACE OF MSP430
25
26
3.4. MEMORY MAPPING / ADDRESS SPACE OF MSP430
27
and peripherals.
Some must be accessed as words and others as bytes.
31
3.5. CPU ARCHITECTURE AND
REGISTERS OF MSP430
32
3.5. CPU ARCHITECTURE AND REGISTERS OF
MSP430
33
C : Carry Flag
Z : Zero Flag
N : Negative Flag
V : Signed overflow flag
GIE : General interrupt enable
3.5. CPU ARCHITECTURE AND REGISTERS OF
MSP430
39
CPUOFF : When set, turns off the MCLK, which stops the CPU
OSCOFF (Oscillator OFF ) : When set, turns off the VLO and LFXT1
crystal oscillator, if LFXT1-CLK is not used for MCLK or SMCLK.
SCG0 (System clock generator 0) : When set, turns off the DCO DC
generator for DCO, if DCO-CLK is not used for MCLK or SMCLK.
SCG1 (System clock generator 1) : When set, turns off the SMCLK.
3.5. CPU ARCHITECTURE AND REGISTERS OF
MSP430
40
47
Unified Clock System (UCS) :
• The UCS module provides the various clocks for CPU and Peripherals
• The UCS module supports low system cost and ultra-low power
consumption.
• It provides 3- internal clock signals : MCLK, SMCLK and ACLK.
Using three internal clock signals, the user can select the best balance of
performance and low power consumption.
•MCLK : Master clock is used by CPU and system
•SMCLK : Subsystem Master clock is distributed to high speed
peripherals
•ACLK : Auxiliary clock is also distributed to low speed peripherals
Embedded Emulation Module (EEM) and JTAG interface
• EEM is accessed and controlled through either 4-wire JTAG
mode or Spy-Bi-Wire mode. The emulation, JTAG interface
and Spy-Bi-Wire interface are used to communicate with a
desktop computer when downloading a program and for
debugging.
48
Flash memory : 128 KB
•Flash memory is used to store the programs and
constant variables
•The size of the Flash memory varies from one device to
another device
RAM : 8 KB + 2 KB if USB is disabled
•RAM is used to store the temporary data (Read/Write
memory)
•The size of the Flash memory varies from one device to
another device
49
Power Management Module (PMM):
• The PMM manages all functions related to the power
supply and its supervision for the device.
• The PMM uses an integrated low-drop-out voltage
regulator (LDO)
• The Supply Voltage Supervisor (SVS) is used to monitor
the supply voltage or an external voltage. The SVS can be
configured to set a flag or generate a Power on Reset
(POR) when the supply voltage drops below a user selected
threshold.
• The brownout reset circuit detects low supply voltages
such as when a supply voltage is applied to (or) removed
from the VCC terminal. The brownout reset circuit resets
the device by triggering a POR signal when power is
applied (or) removed.
50
Watch Dog Timer
• A watchdog timer (WDT) is an electronic timer that
is used to detect and recover from computer
malfunctions. The WDT module restarts the system
on occurrence of a software problem (or) if a
selected time interval expires.
• During normal operation, the system regularly
restarts the WDT to prevent it from elapsing, or
"timing out". If the system fails to restart the WDT
due to a hardware fault (or) program error, the timer
will elapse and generate a timeout signal.
• The timeout signal is used to initiate corrective
actions like placing the system in a safe state and
restoring normal system operation.
51
I/O PORTS : P1, P2, P3, P4, P5, P6, P7 & P8
• MSP430F5529 has 8-digital I/O ports : P1 to P8.
• The I/O Ports P1 to P7 have 8- I/O pins and P8
has 3- I/O pins.
• Individual ports can be accessed as byte wide ports
or can be combined into word wide ports as
PA(P1&P2), PB(P3&P4), PC(P5&P6) and
PD(P7&P8)
• Each I/O pin is individually configurable for input
(or) output direction, and each I/O line can be
individually read or written to.
• All ports have individually configurable pull-up
(or) pull-down resistors
Ports P1 and P2 pins have interrupt capability.
52
Full speed USB (Universal Serial Bus)
• Full-speed integrated USB transceiver (PHY)-
Physical layer Interface
• Supports control, interrupt, and bulk transfers
• Integrated 1.8 V and 3.3 V low drop-out (LDO)
linear regulator
• Integrated programmable PLL
• Highly flexible clock frequencies
• 2 KB of dedicated USB buffer.
• If USB is disabled, 2 KB buffer space is mapped
into RAM and USB pins can be used as GPIO pins
53
32-Bit Hardware Multiplier (MPY32)
• The MPY32 is a peripheral and is not part of the CPU. This means its
activities do not interfere with the CPU activities.
• It performs Signed and Unsigned multiplications
• 8-bit/16-bit/24-bit/32-bit operations
Timers
• The timers are used to generate fixed-period events,
periodic wakeup, count edges, generate delays and
measure time intervals. Replacing delay loops with timer
calls allows CPU to sleep, consuming much less power.
• Timers can support multiple capture/compares, PWM
outputs, interval timing and extensive interrupt
capabilities.
• The MSP430F5529 has 4- timer modules
16-bit Timer TA0 : with 5 - CC registers
16-bit Timer TA1 : with 3 - CC registers
16-bit Timer TA2 : with 3 - CC registers
54 16-bit Timer TB0 : with 7 - CC registers
Real Time Clock ( RTC_A )
• Configurable for real-time clock with calendar function or
general-purpose counter.
• RTC module provides seconds, minutes, hours, day of week,
day of month, month, and year in real-time clock with
calendar function.
• Interrupt capability
Cyclic Redundancy Check (CRC) :
• The cyclic redundancy check (CRC) module provides a
signature for a given data sequence.
• The signature is generated through a feedback path from
data bits 0, 4, 11 & 15
55
Universal Serial Communication Interface :
• Two channels : USCI-A & USCI-B
• Each channel consists of Two ports : 0 & 1 USCI-A0 &
USCI-A1 – supports UART, IrDA and SPI USCI-B0 &
USCI-B1 – supports I2C and SPI
ADC12_A
• The ADC12_A is a high-performance 12-bit analog-to-
digital converter (ADC).
• The module implements a 12-bit SAR core, sample select
control and a 16-word conversion-and-control buffer.
• 16-channels : 14- external & 2- internal
• 200 KSPS
• Internal Reference
• S/H and Auto scan feature
56
Reference Module (REF)
• The REF module is a general purpose reference system
that is used to generate voltage references required for
other peripheral modules such as digital-to-analog
converters, analog-to digital ,converters, or comparators.
• It generates reference voltages : 1.5 V, 2.0V, 2.5V …
selectable references
Comparator ( Comp_B )
• Comp_B is an analog voltage comparator.
• Comp_B covers general comparator functionality for up
to 16 channels.
• The Comp_B module supports precision slope analog-to-
digital conversions, supply voltage supervision, and
monitoring of external analog signals.
57
Direct Memory Access (DMA) Controller Module
• The direct memory access (DMA) controller
module transfers data from one address to another
without CPU intervention.
• Devices that contain a DMA controller may have
up to eight DMA channels available. ( The
MSP430F5529 has 3-channels)
• It can also reduce system power consumption by
allowing the CPU to remain in a low- power mode,
without having to awaken to move data to or from
a peripheral.
58
Video Lecture
on
MICROPROCESSORS
&
MICROCONTROLLERS
By
K.Ravichandra
Asst.Prof/ECE
MSP430 supports
7 - addressing modes for the source operand and
4 - addressing modes for the destination operand
ADDRESSING MODES OF MSP430
Addressing
S.No.
64 Syntax Description As / Ad
Mode
1. Register mode :
In this mode, the data is available in any one of the registers in the CPU.
This is available for both source and destination
Ex: mov.w R5, R6 ; copies word from R5 to R6
2. Indexed mode :
In this mode, the address of data is the sum of constant base address
and the contents of a CPU register.
This mode is available for both source and destination
Ex: mov.b 3(R5), R6 ; load byte from address (3+R5) into R6
4. Absolute mode :
In this addressing mode, the absolute address of the data is available in
the instruction.
This is already the complete address required, so that it should be
added to a register that contains ZERO.
Absolute addressing is shown by the prefix “ & ”
Ex: mov.b &P1IN, R6 ; copy data from port address P1IN into R6
The assembler replaces the above instruction by the indexed form where SR=0
Ex: mov.w @R5+, R6 ; load word from address (R5) into R6 and
increment R5 by 2
If R5 = 0004 then, the content of memory address 0004 is moved to R6 and
the pointer R5 is incremented by 2.
ADDRESSING MODES OF MSP430
70
7. Immediate mode :
Jump instructions
INSTRUCTION FORMATS OF MSP430
73
INSTRUCTION FORMATS OF MSP430
74
Thank You