You are on page 1of 25

___________________________________________________________________________________

15EC62T- Embedded Systems April/ May 20-21 1


___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 2
VI Semester Diploma Examination, April/May-2021
EMBEDDED SYSTEMS
------------------------------------------------------------------------------
Scheme Of Valuation
Part A
1. List some applications of Embedded Systems.
5x1=5 marks
2. List different on-board communication interfaces.
5x1=5marks
3. Comparison between Microprocessor and Microcontroller.
5x1=5marks
4. List the addressing modes of MSP430 Microcontroller
any 5 modes -5 marks
5. List the features of MSP430 Microcontroller.
5x1=5marks
6. Explain coding guidelines for C.
Any five points 5x1= 5marks
7. Write MSP430 assembly program to light LEDs
declaration-1mark, logic-3 marks,end- 1mark
8. Explain Non-Interruptible I/O with pin logic diagram.
2+3=5marks (Fig + Explanation)
9. Describe how we can use ADC10 in temperature sensor
5 marks

Part B
10. Explain operational Quality Attributes of an Embedded System.
Any 5x2 = 10marks
11. Explain the role of the following circuit in Embedded system:
(a) Real-Time Clock (b) Watch-Dog Timer
a) 5marks b) 5marks
___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 3
12. Explain the components of a typical embedded system.
Block diagram -2marks, Explanation -8 marks
13. Explain Memory Mapping of MSP430 Microcontroller.
Figure-4 marks, Explanation-6 marks
14. Explain Status Register and Constant Generator Registers in MSP430 Microcontroller
Explanation--Status register- 5marks, Constant generator-5marks
15. (a) Explain layout of Assembly Language.
Explanation 4 marks, Example- 1mark
(b) Explain MSP430 Shift and Rotate Instructions
Explanation – 3marks, Example- 2marks
16. Explain Editor, Assembler/Compiler, Linker, Stand-alone Simulator, Flash Programmer.
2x5 =10marks
17. Explain Hardware Multiplier with Hardware Multiplier Registers.
Block diagram- 4 marks, Explanation-6marks
18. Explain MSP430 Timer-A with block diagram
Block diagram- 4 marks, Explanation-6marks
19. Explain Architecture and Operation of MSP430 Comparator-A with block diagram
Block diagram-2 marks, Explanation- architecture-4 marks, operation- marks

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 4
VI Semester Diploma Examination, April/May-2021
EMBEDDED SYSTEMS
------------------------------------------------------------------------------
Time:3 Hours Max. Marks: 100
Instructions: i) Answer any six questions from Part – A.
ii) Answer any seven full questions from Part – B.

Model Answers
PART-A
1. List some applications of Embedded Systems.
 Embedded Systems in Automobiles
 Motor Control System
 Cruise Control System
 Engine or Body Safety
 Robotics in Assembly Line
 Car Entertainment
 Car multimedia
 Mobile and E-Com Access
 Embedded systems in Telecommunications
 Mobile computing
 Networking
 Wireless Communication
 Embedded Systems in Smart Cards
 Banking
 Telephone
 Security Systems
 Embedded Systems in Missiles and Satellites
 Defense
 Aerospace
 Communication
 Embedded Systems in Computer Networking & Peripherals
 Networking Systems
 Image Processing
 Printers
 Networks Cards
 Monitors and Displays

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 5
 Embedded Systems in Digital Consumer Electronics
 DVDs
 Set top Boxes
 High Definition TVs
 Digital Cameras

2. List different on-board communication interfaces.


 Inter Integrated Circuit (I2C)
 1-wire Interface
 Serial Peripheral Interface bus (SPI)
 Universal Asynchronous Receiver Transmitter
 Parallel Interface
3. Comparison between Microprocessor and Microcontroller.

Microprocessor Microcontroller
Microprocessors are multitasking in nature. Can Single task oriented. For example, a washing
perform multiple tasks at a time. For example, machine is designed for washing clothes only
on computer we can play music while writing
text in text editor.
RAM, ROM, I/O Ports, and Timers can be RAM, ROM, I/O Ports, and Timers cannot be
a added externally and can vary in numbers added externally. These components are to be
embedded together on a chip and are fixed in
numbers
Designers can decide the number of memory or Fixed number for memory or I/O makes a
I/O ports needed. microcontroller ideal for a limited but specific task
External support of external memory and I/O Microcontrollers are lightweight and cheaper than
ports makes a microprocessor-based system a microprocessor
heavier and costlier
External devices require more space and their A microcontroller-based system consumes less
power consumption is higher power and takes less space.
If any unit is not working, only that particular If any unit is not working then entire IC is to be
unit can be replaced as it is externally connected replaced

4. List the addressing modes of MSP430 Microcontroller

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 6
 Register mode
 Indexed mode
 Symbolic mode (PC relative mode)
 Absolute mode
 Indirect Register mode
 Indirect auto increment register mode
 Immediate mode
 SP- relative mode

5. List the features of MSP430 Microcontroller.


 CPU is small and efficient with a large number of instructions.
 It can be easily used in Low power mode.
 There are several low power modes.
 There is a choice of clocks. The CPU is clocked by and internalDigitally
Controlled Oscillator (DCO).
 A wide range of peripherals are available.
 MSP430 can directly drive some portable devices like LCDs.
 MSP430 is classified as ASSP (Application Specific Standard Product) and
contain Analog hardware for various types of measurement.

6. Explain coding guidelines for C.


 No line should exceed 80 characters
 Use macros provided in the MSP430 header file
 Comments should start in Column 45, first word is Capitalized
 For multi line comments, additional lines are not capitalized
 Use 2 space indentation

7. Write MSP430 assembly program to light LEDs.

#include <msp430x11x1.h> ; header file for this device


ORG 0xF000 ; Start of 4kB memory-mapped
Reset: ; start of execution
mov.w #WDTPW|WDTHOLD ,& WDTCTL ; Stop watchdog timer
mov.b #00011100b,& P2DIR ; Set pins with LEDs as output
mov.b #00001000b,& P2OUT ; LED3 (P2.4) on, LED2 (P2.3) off
; LED1 (P2.2) on
ILOOP: ; Infinite loop
jmp ILOOP
;---------------------------------------
ORG 0xFFFE ; Address of MSP430 RESET vector
DW Reset ; Address to start execution
END

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 7
8. Explain Non-Interruptible I/O with pin logic diagram.

Non-Interruptable I/O
I/O ports P3, P4, P5 and P6 are Non-Interruptable I/O. Use of non-interruptable I/O is simple. Each bit
is individually controllable. Each bit can be configured as input, output or dedicated function I/O.

Fig below shows the Non-interruptable I/O logic

The non-interruptible ports are configured by four byte control registers :

 Direction register
 Input register
 Output register and
 Function select register
Direction Registors (PxDIR)
Direction registers are Read/Write 8-bit registers control the signal direction for port pins.
PxDIR configuration :
Bit =1: The port pin is set up as an output;

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 8
Bit = 0: the port pin is set up as an input.

Input Registers (PxIN)


The input registers are read only registers. Each bit of these registers reflects the input signal at the
corresponding I/O pin.
Output Registers (PxOUT)
The output registers are read-write registers. Each bit of these registers reflects the value written to the
corresponding output pin. When reading these registers, they will reflect the last value written to them.
If the port is configured as an input, the output register will be in an indeterminate state. It will not
necessarily reflect the input value on the associated pin.

Function Select Registers (PxSEL)

Function Select Registers are read-write registers. These determine the use of the individual pins on the
1/O port general-purpose port or peripheral module function.

PxSEL configuration:
Bit = 0: I/O function is selected for the pin;

Bit = 1: Peripheral module function is selected for the pin.

9. Describe how we can use ADC10 in temperature sensor

To use the on-chip temperature sensor, the analog input channel INCHx 1010 is selected. Any
other configuration is done as if an external channel was selected, including reference selection,
conversion memory selection, etc. The typical temperature sensor transfer function is shown as in the
above figure. When using the temperature sensor, the sample period must be greater than 30μs. The
temperature sensor offset error is large. Deriving absolute temperature values in the application
requires
calibration.

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 9
Selecting the temperature sensor automatically turns on the on-chip reference generator as a voltage
source for the temperature sensor. However, it does not enable the VREF+ output or affect the
reference selections for the conversion. The reference choices for converting the temperature sensor are
the same as with any other channel.

PART B
10. Explain operational Quality Attributes of an Embedded System.

Operational Quality Attributes: These are the attributes related to operation or functioning of an
embedded system. The way an embedded system operates affects its overall quality.

The Operational Attributes are

 Response: Response is a measure of quickness of the system. It gives you an idea about how
fast your system is tracking the input variables. Most of the embedded system demand fast
response which should be real-time.
 Throughput: Throughput deals with the efficiency of system. It can be defined as rate of
production or process of a defined process over a stated period of time. In case of card reader
like the ones used in buses, throughput means how much transaction the reader can perform in a
minute or hour or day.
 Reliability: Reliability is a measure of how much percentage you rely upon the proper
functioning of the system. Mean Time between failures and Mean Time To Repair are terms
used in defining system reliability. Mean Time between failures can be defined as the average
time the system is functioning before a failure occurs. Mean time to repair can be defined as the
average time the system has spent in repairs.

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 10
 Maintainability: Maintainability deals with support and maintenance to the end user or a client
in case of technical issues and product failures or on the basis of a routine system checkup. It
can be classified into two types:-
o Scheduled or Periodic Maintenance: This is the maintenance that is required regularly
after a periodic time interval. Example: Periodic Cleaning of Air Conditioners, Refilling
of printer cartridges.
o Maintenance to unexpected failure: This involves the maintenance due to a sudden
breakdown in the functioning of the system. Example: Air conditioner not powering on,
Printer not taking paper in spite of a full paper stack
 Security
Confidentiality, Integrity and Availability are three corner stones of information security.
Confidentiality deals with protection data from unauthorized disclosure. Integrity gives
protection from unauthorized modification. Availability gives protection from unauthorized
user. Certain Embedded systems have to make sure they conform to the security measures. Ex.
An Electronic Safety Deposit Locker can be used only with a pin number like a password.
 Safety
Safety deals with the possible damage that can happen to the operating person and environment
due to the breakdown of an embedded system or due to the emission of hazardous materials
from the embedded products. A safety analysis is a must in product engineering to evaluate the
anticipated damage and determine the best course of action to bring down the consequence of
damages to an acceptable level.

11. Explain the role of the following circuit in Embedded system:(a) Real-Time Clock
(b) Watch-Dog Timer
(a) Real-Time Clock
An RTC (Real time clock) is a component of embedded system which keeps track of
time. RTC holds information like current time in hours, minutes and seconds in 12 hour or 24
hour format, date, month, year, day of the week etc. and it supplies the timing reference to the
system.

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 11
 Maintaining timer's mechanisms that are able to notify the user program that a certain interval
of time has elapsed. A timer circuit is configured as system clock, which ticks and generates
interrupts periodically.

 Real-time clock that can also be used as a system timer.

 The clock circuits are used both to keep track of the current time of day and to make precise
time measurements.

 The timer circuits are programmed by the kernel, so that they issue interrupts at a fixed,
predefined frequency; such periodic interrupts are crucial for implementing the software timers
used by the kernel and the user programs.

 In real time programming, system clock is used for scheduling various tasks. Read-time clocks
are typically composed of a crystal-controlled oscillator, numerous cascaded counters, and a
battery backup. The crystal-controlled oscillator generates a very consistent high-frequency
digital pulse that feed the cascaded counters.
(b) Watch-Dog Timer
A watchdog timer (WDT) is a hardware timer that automatically generates a system reset if the
main program neglects to periodically service it. It is often used to automatically reset an embedded
device that hangs because of a software or hardware fault. The watchdog and CPU may share a
common clock signal, as shown in the block diagram below, or they may have independent clock
signals.
A watchdog timer is a hardware that can be used automatically detect software anomalies and resets
processor if any occur. Watchdog timer is based on a counter that counts down from some initial value
to zero.
A timer unit for monitoring the firmware execution. Depending on the internal implementation,
watchdog timer increments or decrements after running counter with each clock pulse and generates
reset signal to reset the processor if the count reaches zero for a down counting watchdog, or the
highest count value for an up counting watchdog.

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 12
12. Explain the components of a typical embedded system.

An embedded system consists of 3 main components. They are:

 Hardware,
 Software
 Real time operating system.

Hardware consists of power supply, processor, memory, timer andcommunication ports,


application circuits etc.

Software consists of application software, which is required to performtasks,


depending upon the availability of memory, processor speed, limited power supply.

The Real time Operating System supervises the application software and
provides the mechanism to run the processor as per schedule switchingfrom one task
to another.

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 13
A
typical
embedd
ed
system
is as
shown
in the
above
figure.
The elements are as follows:
1. System core: This can be a single chip controller consisting of ALU, controlunit, instruction decoder
etc. The core connects to every other unit of the system.
The system core can be a Microprocessor, a Microcontroller, FieldProgrammable Gate
Array (FPGA), Digital Signal Processor (DSP), Application Specific Integrated Circuit
(ASIC) or Application Specific Standard Product (ASSP).

2. Sensors and Actuators:


 Sensors are connected to the input port to receive the inputs from theuser.
 Actuators are connected to the output port.
 Keyboards, push buttons, switches, scanners are the examples of inputuser interface
devices as sensors.
 LEDs, LCDs, buzzers etc. are the examples for output user interfacedevices like actuators.
3. Memory: Memory is a fixed memory, used to store the program files andtemporary
data.

4. Communication Interface: This can be an address bus, data bus or controlbus to


interconnect the core with other units of the system.
___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 14
5. Other supporting ICs and subsystems: This depends on the application. This could
be ADC, DAC, Watchdog timer, Brownout circuit, reset circuit,RTC etc.

6.Core of the embedded system: Depending on the domain or application,an embedded


system is developed around a central core.

7. Embedded firmware: This refers to the control program dumped intocode/program memory.

13. Explain Memory Mapping of MSP430 Microcontroller.


The MSP430 family's memory space is configured in a "von-Neumann Architecture" and has
code memory (ROM, EPROM, RAM) and data memory (RAM, EEPROM, ROM) in one address
space using a unique address and data bus. The total addressable memory space provided is 64KB in
the small memory model and 1MB in the large memory model.
 Special Functional Registers: These registers do the enabling of modules and signalling for
interrupts from peripherals.
 Peripheral Registers of Byte access and Peripheral Registers of Word access: These registers support
connection between CPU and Peripherals.
 RAM: it is used to store the variables. Its size is 128 bytes.
 Bootstrap loader: It contains programs to communicate using a standard protocol with
communication port of PC.
 Information memory: A 256 bytes of flash memory for the storage of non-volatile data such as
several settings information.
 Code memory: Holds the program which is executable code and only constant data.
 Interrupt and Reset Vectors: This is a table of memory which stores the vectors for the interrupts
and exceptions.
 Memory mapped input and output: Digital input and output takes place through set of pins
called ports. Each port has 8 pins. The MSP430 uses memory mapped input and output. It
means that the ports are treated like memory registers called peripheral register. Each port is
associated with a byte and each bit corresponds to a pin on the package.

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 15
14. Explain Status Register and Constant Generator Registers in MSP430 Microcontroller

STATUS REGISTER (SR): The status register keeps the content of arithmetic flags (C,
V, N, Z), as well as some control bits such as SCG1, SCG0, OSCOFF, CPUOFF, and GIE. The system
flags are changed automatically by the CPU depending on the result of an operation in a register. The
reserved bits of the SR are used to support the constant generator.

BIT 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OSC CPU
OP RESERVED V SCG1 SCG0 GIE N Z C
OFF OFF

V Overflow bit. It is set when arithmetic operation overflows the signed variable
range.
SCG1 System Clock Generator1- Turns off the SMCLK
SCG0 System Clock Generator 0 – Turns off the DCO DC generator
OSCOFF Oscillator off. It turns off the LFXT1 crystal oscillator

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 16
CPUOFF Turns off the CPU
GIE General Interrupt Enable. Enables Maskable Interrupts
N Negative Bit. It sets when the operation result of byte or a word is a negative
number.
Z Zero bit. It sets when the result of operation result of byte or a word is Zero.
C Carry Bit. It is set when the operation result in a byte or a word generates a
carry.

CONSTANT GENERATORS (CG1 and CG2)


R2 and R3 function as constant generators so that register mode may be used instead of immediate
mode for some constant.

Depending on 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. Thus, they need not be fetched
from memory whenever they are needed. This is a very powerful feature, which allows the
implementation of emulated instructions. For example, instead of implementing a core instruction for
an increment, the constant generator is used. It uses both R2 and R3 to provide a range of useful values
by exploiting the CPU's addressing modes. Values of constant generator are as below.
Register As Constant Remarks
R2 00 - Register Mode
R2 01 (0) Absolute Mode
R2 10 00004h +4, bit processing
R2 11 00008h +8, bit processing
R3 00 00000h 0, word processing
R3 01 00001h +1
R3 10 00002h +2, bit processing
R3 11 0FFFFh -1, word processing

15. (a) Explain layout of Assembly Language.


(b) Explain MSP430 Shift and Rotate Instructions

(a) Layout of Assembly Language


The layout of assembly language is divided into four fields: label, operation, operands and
comment.
1.Label: starts in the first column and may be followed by a colon (:) for clarity.
2. Operation : This field consists of either a symbolic operation code, known as op-code or a directive,
___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 17
which controls the assembler. The opcode describes the operation. Symbolic op-codes (mnemonic) are
translated into machine language opcode.
3. Operands: This field specifies data to be acted on. It may have one, two or no operands at all.
4.Comment: A semicolon marks the beginning of a comment. A semicolon in the beginning of a line
makes it all a comment line.
Example:
Repeat: mov.b #5, R5 ; initialize counter

label: operation operands ; comment

SHIFT AND ROTATE INSTRUCTIONS


The shift operations allow bits to be moved to the left or right in a word. There are three types of shift
operations logical, rotate and arithmetic.
A logical shift moves bits to the left or right. The bits which 'fall off the end of the word are discarded
and the word is filled with 0's from the opposite end. A logical right shift of the 8 bit binary number
1000 1011 gives 0100 0101.
RLA dst / RLA.W dst / RLA.B dst (Rotate left arithmetically)
Example: RLA R7
Before Execution: R7= 1234H , C=1 [1 0001 0010 0011 0100]

After Execution : R7=2468H, C=0 [ 0 0010 0100 0110 1000]

RLC dst / RLC.W dst / RLC.B dst (Rotate left through Carry)
Example: RLC R7
Before Execution: R7= 1234H , C=1 [1 0001 0010 0011 0100]

After Execution : R7=2469H, C=0 [ 0 0010 0100 0110 1001]

• A rotate operation is a circular shift in which no bits are discarded. A rotate right of the 8 bit binary
number 1000 1011 gives 1100 0101.
RRA dst / RRA.W dst / RRA.B dst (Rotate Right Arithmatically)
Example: RRA R7
Before Execution: R7= 1234H , C=1 [0001 0010 0011 0100 1]

After Execution : R7=091AH, C=0 [ 0000 1001 0001 1010 0]

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 18
• An arithmetic right shift is similar to a logical right shift, except that the leftmost bits are filled with
the sign bit of the original number instead of 0's. An arithmetic right shift of the 8 bit number 1000
1011 gives 1100 0101.
RRC dst / RRC.W dst / RRC.B dst (Rotate Right through Carry)
Example: RRC R7

 Before Execution: R7= 1234H , C=1 [0001 0010 0011 0100 1]


 After Execution : R7= 891AH, C=0 [ 1000 1001 0001 1010 0]

16. Explain Editor, Assembler/Compiler, Linker, Stand-alone Simulator, Flash Programmer.

Editor: The very first tool in the development of software for an embedded system is a text editor. You
need to write source code. In Embedded System Development Tools, Editor is used to writing code for
embedded systems applications. It is the editor where you write that code. The code is written in
programming language either C++ or C. After the program is typed it can be saved in .asm format in
assembly programming and .C format in embedded programming in some secondary storage like hard
disk , floppy disk for permanent storage .
Assembler or Compiler: Compiler/Assembler is the second tool in embedded system software
development. Once source code is written , it needs to translate that code into the instructions on the
basis of which, the microcontroller will operate. The set of instructions in the microcontroller is called
as ‘Op Codes’. Most of the times, the Op Codes are not written in bits but in hexadecimal numbers.
And one hexadecimal number means 4 bits. Two hexadecimal number will represent 8 bits that mean 1
byte. Op Codes are actually bits (0 and 1) that are present in a sequence. The compiler is used to for
translating the source code into another code called ‘hex code’. This code now represents the machine’s

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 19
instruction code. The purpose of the compiler is the conversion of a high-level programming language
into a low-level programming language.
Linker: The codes are written into smaller parts for ease. The linker is a program that combines the
number of codes for execution. Linkers are used for linking the codes that are saved in different files
into one single final program. It also takes much care of allocation of memory of chips so that the
different modules saved into a single program do not overlap.
Stand-alone Simulator: It simulates the operation of MCU on a desktop computer without the real
hardware. Many simulator module a target CPU, memory system and I/O devices.
The main advantages of simulator are
- to know the behavior of the system without building actually it.
- Results are accurate in general, compared to analytical world
Main disadvantages are
- Expensive to build a MCU simulation model
- Many times simulation model is designed to simulate only important parts

Flash programmer: Flash programmer is a non-volatile memory type which can be electrically erased
and reprogrammed repeatedly. Flash programmer downloads the program into flash memory of the
MCU. Uses a hardware device and an on-chip debug connector like JTAG on the target system to down
load the program.

17. Explain Hardware Multiplier with Hardware Multiplier Registers.

It is a memory mapped peripheral device which is outside the processor.


The module performs:

 MPY: multiplication of unsigned 8-bit and 16-bit operands.


 MPYS: 8bit and 16bit signed multiplication.
 MAC: Multiply and Accumulate for 8bit and 16bit operands.
 MACS: Multiply and Accumulate signed.

The type of operation is selected by the 1st operand is written to. It has two 16-bit operand registers
OP1, OP2 and three result registers RESLO, RESHI & SUMEXT.
___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 20
OP1 (Operand 1 reg): based on the different register for OP1 differentoperation is chosen.

◦ 130h – MPY

◦ 132h – MPYS

◦ 134h – MAC

◦ 136h – MACS

OP2 (operand 2): only after the 2nd operand is written, the multiplicationprocess starts.
The result is written in 3 registers.

◦ RESLO – Holds the Lower 16 bit of the result.

◦ RESHI -- Holds the Upper 16 bit of the result.

SUMEXTEND – During MPY it carries 0000h always. During MPYS it carriesthe extended
sign of the result.

◦ During MAC it contains carry of the result.

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 21
◦ During MACS it contains the sign of the result extended.

Applications of Hardware Multiplier:

 Used for multiplication exceeding 16-bits.


 To find coefficients of polynomials of sensor characteristics of ADC
 Used in table processing where indirect addressing can be used on both
operands of a multiply instruction.
 It is used in the wave digital filters
 Used in Finite Impulse Response Filter (FIR).
 It is used to find Fast Fourier Transformation (FFT) algorithm.

18. Explain MSP430 Timer-A with block diagram.

Timer Block:

It consists of 16-bit TAR register sources of the clock, clock-divider unitand TAIFG which is raised
when the counter returns to 0.

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 22
Capture/compare channels : Most events occur here are based on a register TACCRn. They all work in
the same way with the important exception of TACCRO. Each channel can be as below:
Capture an input, which means recording the "time" (the value in TAR) at which the input changes in
TACCRn; the input can be either external or internal from another peripheral or software.
Compare the current value of TAR with the value stored in TACCRn and update an output when they
match; the output can again be either external or internal.
Request an interrupt by setting its flag TACCRn CCIFG on either of these events; this can be done
even if no output signal is produced.
Sample an input at a compare event; this special feature is particularly useful if timer_A is used for
serial communication in a device that lacks a dedicated interface.
Timer_A is modular and the number of capture/compare channels varies between devices.
Capture/compare channel is special in two ways. Its register TACCR0is taken over for the modulus
value in Up/Down modes, so that it is no longer available for its usual functions. It also has its own
interrupt vector with a higher priority than the other interrupts from Timer A, which share a common
vector. Therefore channel 0 should be chosen for the most urgent tasks if it is free.

19. Explain Architecture and Operation of MSP430 Comparator-A with block diagram.
The comparator compares the analog voltges on its two input terminals, at the V+ and V- input
terminals. Its output is high if V+ > V- and low if V+<V-. Thus it provides a basic bridge between the
analog and digital domains and acts like a 1-bit ADC. The comparator can be switched ON or OFF using
control bit CAON. The comparator should be switched OFF when not in use to reduce current consumption.
When the comparator is switched OFF, the CAOUT is always low.

As shown in the Figure, the non-inverting input V+ can be connected to external signals CA0-CA2
or left without an external connection. Non-inverting input for comparator is selected using bits P2CA4
and P2CA0.
The inverting input V- can be connected to external signals CA1-CA7 (but not CA0) or left
unconnected, according to bits P2CA[3: 1].
An internal voltage reference can be connected to non-inverting input V+ or inverting input V
It can also be connected to an internal reference. The internal reference voltage VCAREF can be
chosen from 1/4 VCC, 1/2 VCC or a nominally fixed voltage from a transistor, Vdiode. This is selected

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 23
with the CAREFx bits. It can be applied to either input of the comparator according to the CARSEL
bit.
The output of the comparator can optionally be filtered through an RC circuit to reduce oscillations in
the signal, which may arise if the inputs vary slowly. This is selected with the CAF bit.
The filtered output is brought to an external pin CAOUT. It is also connected internally to capture
input CCI1B of Timer_A and to the flag CAIFG. The flag CAIFG is raised on either a rising or falling
edge of the comparator output, selected with the CAIES bit.
This can in turn request an interrupt if CAIE is set. The interrupts are maskable and GIE must
therefore also be set for an interrupt to occur. Comparator_A+ has its own interrupt vector and the flag
is cleared automatically when the interrupt is serviced.

The outputs of the two input multiplexers can be shorted together by setting the CASHORT bit. The
idea is that this can be used to connect a capacitor to the input to form a sample-and-hold circuit.

Operation of Comparator

The comparator can be used directly to compare a variable input voltage with a reference, which may
be either one of the internal references or a second input. For example, the variable input might be from
a temperature sensor and the comparator should detect when the equipment may freeze. It can be useful
to connect a noisy input signal to the comparator so that the MSP430detects when the input goes
through a well-defined level, such as 0.5VCC.

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 24
If an analog-to-digital converter is needed rather than a plain comparator, then this can be achieved by
adding a capacitor to form an RC circuit and using a timer to measure its dynamic behavior.

*********

Certificate:
I certify that the model answer script that are prepared by me for the subject code 15EC62T are
from the prescribed text books and model answer script and scheme of valuation prepared by me are
correct

(Vatsala S V)
SGL/EC
Govt. Polytechnic, Channasandra
Contact No.- 7975275772

___________________________________________________________________________________
15EC62T- Embedded Systems April/ May 20-21 25

You might also like