0 ratings0% found this document useful (0 votes) 27 views10 pagesModule 5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
MODULE-5S
Microprocessor and Microcontrollers: Overview of generic microprocessor,
architecture and functional block diagram, Comparison of microprocessor and
microcontroller MSP430 architecture, assembly language programming, C
compiler programming, basics of interfacing with external input / output
devices (like reading external analog voltages, digital input output)
Applications of microcontroller: Temperature measurement, Speed
Measurement using Proximity Sensor, Piezoelectric Actuator Drive
Microprocessor Is a controling unit of » mleo-computer, fab
rs ‘cated on a small chis
itoring: ALL (Arlcuretic Logical Ute operons See
beroming ns and communicating with the other denica,
Microprocessor consists of an ALU, register array, and a control unit.
( ALU
logical operations on the data received from the memory or an input hee ee arithmetical and
of registers identified by letters ke B,C, O,€,H, Land accumulator. The conroh ene tay consists
‘of data and instructions within the computer. unit controls the flow
‘ALU: This is the area of the microprocessor where various com,
pati
such as arithmetic operations as addition, and subtraction, and such ae are performed on data
POR, ‘Operations as AND, OR and
Register Array: These register array are primarily used to store data
ofa program and are accessible tothe user through Instructions, POY during the executiontions
gnals to all the opera
Control Unit: The control unit provides the necessary timing and control signal
in the microprocessor.
he
ite programs, ti
Memory: Memory stores binary information as instructions and data. To oe ears
Fane aceisor readeirstructions end date from memory andl parformaa the Con)
itaLu,
of devices: Input
0 (input-output): it communicates with the outside world. 1/0 includes two types
and Output; these 1/0 devices are also known as Peripherals.
: eripherals.
System Bus: The system bus is a communicate Path between the microprocessor and perip!
architecture and functional block diagram
Pane
Vor | Van Pixasrac xN/xOUT
Block DiagramArchitecture of MSP 430
* _ MSP430 family microcontrollers from Texas Instruments (T), are designed for low cost
low power and portable embedded applications
MSP430 has 16-bit RISC based processor architecture
RISC (reduced instruction set computer) is a microprocessor that is designed to perform a smalie
‘number of computer instruction types, a it can operate at a higher speed, performing ee i
of instructions per second, or MIPS. millions
It supports different Low power modes
Ithhas 16 registers (RO-R15)
All registers are 16-bit wide
Ithas 16-bit Address bus and 16-bit data bus
Supports 27 core Instructions, 4 emulated instructions and 7 addressing m"t's capable of wake-up time below 1 microsecond
Extensive vectored: interrupt capability
‘Awide range of on-chip peripherals are available
16-bit CPU ;
"consists of 16-bit ALU, set of 16-registers (RO R1S) and Logic needed to decode and
execute the instructions
The CPU has RISC architecture
* Instructions processing on either bits, bytes or words
* Supports 27 instructions and 7 addressing modes,
"CPU clock : 16 MHz
Operating voltage : 1.8-3.6
* Fast wake-up from standby mode in less than 1 ps
Basic Clock system :
‘The clock module provides the CLK for CPU and peripherals. Three clock signals are available
from the basic clock module:
+ 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
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).
16-bit Sigma Delta ADC: SD16_A
+ The SD16_Ais ahigh performance 16-bit analog to digital converter
+ used to interface analog signals with 200 KSPS
MO ports: P1 & P2
* The MSP430 has Two I/O ports: Port-P1 and Port-P2
+ The Port-P1 has 8-1/0 pins and P2 has 2-1/0 pins
*+ Each /0 pin is individually configurable for input (or) output.Each pin can be configurable for pull-up / pull-down resistors
Ports Pa and P2 have interrupt capability
Watch Dog Timer
.d system restart
is generated. If
san interval
The primary function of the watchdog timer (WDT_A) module is to perform a controle
after a software problem occurs. If the selected time interval expires, a system reset
the watchdog function is not needed in an application, the module can be configured a
timer and can generate interrupts at selected time intervals.
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,
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.
MSP430 CPU registers
¥ The CPU incorporates sixteen 16-bit registers:
= 4 registers have dedicated functions: RO, RI, R2 and R3
+ 12 working registers for general use; R4 to RIS
Y The dedicated registers are
= RO: Program Counter [PC]
* Ri: Stack Pointer [SP]
= RQ: Status Register [SR]
+ RRS: Constant Generator Registers (CG1/CG2]
Y The General-Purpose Registers (R4 to RIS):
* These are used to store data values, address pointers,
‘can bp accessed with byte or word instructions, or index values andRe Program Counter (PO) -
= The O6dir Pommcem Commer (POR paints to the set
gexeraction to be fetched Som
memes and csscred bs fe CPU
Ri: Stack Poimter (SP) =
© Whe stack mecmery 5s 2 emma Block where the dam is sored m LIFO manner
+ The Stack Pomme (SPI) holds the adidkess of the stack-op.
© ie he MSP S30, Ge stack & allocated & ie wp of the RAM and grows down
Sowands low addresses,
The purpose of the stack =
Bh wed by sctroetine calls - to store the Retorn address (PC value)
It is used by imscrmupt — to store the Retum address (PC value) and Status
information (SR)
It cam be used by compiler for subroutine parameters
It cam be used by user to store data for later use by using PUSH and POP
SeR2: Status Register (SR)
The Status Register (SR/R2) stores the status bits and control bits.
Bere
15 “ ee a ees eee
OSC[CPUT Ge | N | Z lee. |
reserved | v [sca1]scco oF | OFF.
Status Flags: Indicate some condition produced by an instruction execution.
‘These are changed automatically by the CPU depending on the result of an operation.
(C+ Carry Flag : Itis set to 1, ifa carry is generated in an Addition (or) borrow in Subtraction.
Z: Zero Flag « Wis set to 1, if the result of an operation is ZERO.
A common application of Zero flag is to check whether two values are equal or not
: Negative Flag : It is used with signed numbers only.
N=1 for negative results and N =0 for positive results.
V: Signed overflow flag: It is used with signed numbers only
It is set to 1, when the result of a signed operation has overflowed.
Addressing modes of MSP430
1. Register mode :
* In this addressing mode, the data is available in any one of the registers of CPU.
‘+ This is available for both source and destination
Ex: mov.w RS,R6 _; copies word from RS to R6
2. Register Indirect mode :
‘= In this mode, the address of the data is available in the repister.
* Indirect register aressing is shown by the symbol @ infront of a register such as @R.
In other words, Rais used asa pointer. This mode is available for only source operangRegister Indirect with Auto-increment mode :
* In this addressing mode, the address of the data is available in the register and it 1s
‘automatically incremented by 1 for BYTE operation and by 2 for WORD operation.
* This mode is available for only source operand.
EX: mov.w @RS+, R6_; load word from address (RS) into R6 and increment RS by 2
IFRS = 0004 then, the content of memory address 0004 is moved to RO and
the pointer RS is incremented by 2.
4. Indexed mode :
+ Inttis addressing mode, the address of data is the sum of Register and Displacement
‘This mode is available for both source and destination
Ex mov.b 3(RS),R6 —_; load byte from address (3+R5) into R6
AFRS = 0004 then, the content of memory address 0007 is moved to RO
5. Absolute mode :
* In this addressing mode, the absolute address of the data is available in the instruction.
* Absolute addressing is shown by the prefix “ &
* This mode is similar to indexed mode, in which Status Register is used as Index register
Ex mov.b &0245H, R6 ; copy data from memory address 0245 H into RO
Immediate mode :
* In this addressing mode, the data is available immediately after the instruction.
. The PC is automatically incremented after the instruction is fetched and therefore points to
the following word. Hence it is a special case of Indirect auto-increment mode.
Ex mov.w #1234,R6 —_; move the immediate constant #1234 into R6,ALU [Registers
them.
1 _ Timers/ OP
1/0 Ports}
Timing & Control coumes] [oPen
aE interrupt] | Serial
Control roe
Microprocessor is the heart of the is f the embedded
i is the heart of the
computer system, which fetches the eT nao pation & apes ic task by
2 | instructions from memory and executes | °¥S¢™ desig! red in ROM
executing a fixed program sto!
Lp is a central processing unit (CPU) on
3 | single chip. which consists of ALU,
Registers, and Timing and control unit
Hic has a CPU, in addition with RAM, ROM
and other peripherals like /O ports, Serial port,
Timers/Counters, Interrupt controller, etc all
‘embedded on a single chip
—}
4 | Less no. of on-chip registers
More no, of on-chip registers
5__| Less no. of Bit manipulation instructions
Size, power and cost of the system
More no. of Bit manipulation instructions
Low size, Low power and Low cost, due to less
ete
© | increases due to external components. | no. of external components.
7 | Microprocessors are used for executing | Microcontrollers are used for executing specific
general purpose applications applications.
g_ | Used in desktop PC's, Laptops, Notepads | Used in embedded applications like Washing
machine, DVD player, AC, ete
The MiSP430 Sensing and Measurement MCUs support a supply voltage range of 1.8 V to 3.6 V. This i
due to the manufacturing process used and has the advantage of drawing even less current than with
a 5-V supply. If an interface to a 5-V system or to a system with an even higher voltage is necessary,
it can result in difficulties. This application report explains 5-V interfaces for the inputs, outputs, and
1/0s of an MSP430 MCU. Figure 1 shows examples of input, output, and I/O interfaces, The shaded
boxes in the figure ai
the topic of this application report,Intertaces Between the 3-V MSP430 and 5-V Systems
Input Interfaces: The input interfaces are primarily intended for an interface between 5-V and 3-V
systems. However, they also can be used for external voltages higher than 5 V (for example, the
interface of a 12-V signal to the input of the MSP430 MCU).
+ Resistor-Divider input interfaces.
+ Transistor input interface.
+ Op-Amp input interface.
+ TPL74071A Input interface
+ Integrated-Circuit input interface
‘+ Analog input interface
Output interfaces- No interface is needed for LCDs and for passive sensors,
connected to the MSP430 MCU in the usual wa
They are directly
* Transistor output interface
* Interface to CMOS-TTL Inputs.
* Interface to ULN2003 Inputs
* Op-Amp Output Interface
* Integrated-Circuit Output interface