Unit 5 6 Embdsystem
Unit 5 6 Embdsystem
The MSP 430 I/O ports are 8 bit wide and controlled with memory mapped
registers. Along with the basic I/O functions, each port pin can be individually
configured as special function I/Os, such as USART, Comparator and ADC.
1. Non-interruptible I/O
2. Interruptible I/O
2) Interruptible I/O
Interruptible means the ports can be used to generate interrupts. I/O ports 1
and 2 (P1, P2) are interruptible ports. Interrupts on the each pin can be
provided on a rising edge or falling edge of an input signal. Interruptible ports
use all the control registers of non-interruptible ports along with three other
byte addressable registers. They are: interrupt enable register, interrupt edge
select register and interrupt flag register.
CLASSIFICATION OF TIMERS
WATCHDOG TIMER
BASIC TIMER 1
TIMER – B
The following table shows the hardware multiplier registers with its addresses:
Applications:
Floating point multiplication, FFT operations, DSP systems, FIR filters and
portable battery powered devices.
The main function of the watchdog timer is to protect the system against
failure of the software, such as program being trapped in an unintended,
infinite loop. If this protection is not needed, it can be made to function as an
interval timer, in which it counts up and resets MSP 430 when it reaches its
maximum limit.
The lower byte of the watchdog timer control register is shown below:
WDTNMIES =>selects the triggering edge for the non maskable interrupt on
RST/NMI pin. 0 indicates a rising edge and a 1 represents a falling edge.
WDTNMI =>Watchdog timer NMI select. This bit selects the function for the
RST/NMI pin. 0 : Reset function and 1 : NMI function.
WDTCNTCL => watchdog timer counter clear.When the bit is set the counter is
cleared to the value 0x0000.
WDTSSEL =>watchdog timer clock source select. 0 selects the SMCLK and 1
selects the ACLK.
WDTISx =>watchdog timer interval select. This bit is used to select the
watchdog timer period to generate WDT interrupt or WDT reset. When
WDTIS=00, it selects longest period of 1s at 32KHz ACLK.
• The 3XX And 4XX family includes built in LCD driver to directly control
LCD displays.
• Supports blinking
Timer-A is the most versatile and general purpose timer in the MSP 430 and is
included in all devices. There are two main parts in the hardware: timer block
and capture/compare channels.
Timer block:
It is the core of timer-A whose operation depends on the 16 bit register TAR.
There is a choice of sources for the clock, whose frequency can be divided
down. The timer block has no output but a flag TAIFG is raised when the
counter returns to zero.
Capture/compare channels:
Most of the events occur in this, each of which is based on a register TACCRn.
They all work in the same way except TACCR0. Each channel can:
TIMER A APPLICATIONS
● Measurement of time
● Measurement of frequency
● Generation of output in continuous mode: generates independent
periodic signals, single pulse, PWM output.
Capture mode: The capture mode is selected when CAP=1. Capture mode is
used to record time events, for speed computations and time measurements.
The capture inputs CCIxA and CCIxB are connected to external pins or internal
signals and are selected with the CCISx bits. The CMx bits select the capture
edge (event) of the input signal which can be rising edge, falling edge or both
the edges. A capture occurs on the selected edge of the input signal.
If a capture occurs:
● The timer value (the value in TAR) is copied into the TACCRn register.
● The interrupt flag CCIFG is set.
Compare mode:Compare mode is selected when CAP=0. This mode is used to
generate PWM output signals and produce an interrupt at the time stored in
TACCRn. Several actions are triggered when TAR counts to the value in
TACCRn:
Any mixture of capture and compare channels can be used and the mode can
be switched freely from one to another.
The bit fields indicated in the timer-A capture/compare control register are
described as below:
0: interrupt pending
1: No interrupt pending
COV bit is set if another capture occurs before TACCRn is read following the
previous event.
OUT: Output
1: High output
0: interrupt pending
1: no interrupt pending
0:Asynchronous capture
1: Synchronous capture
00: CCIxA
01:CCIxB
10:GND
11:VCC
00: no capture
TIMER-A INTERRUPTS
Interrupts can be generated by the timer block itself (flag TAIFG) and each
capture/compare channel (flag TACCRn CCIFG or CCIFGn for short). TACCR0 is
privileged and has its own interrupt vector, TIMERA0_VECTOR. Its priority is
higher than the other vector, TIMERA1_VECTOR, which is shared by the
remaining capture/compare channels and the timer block. The CCIFG0 flag is
cleared automatically when its interrupt is serviced but this does not happen
for the other interrupts because the interrupt service routine (ISR) must first
determine the source of the interrupt.
UNIT – 6
The entire module is switched on and offwith the CAON bit. It is off by default
to save current.The non-inverting input V+ can be connected to external
signals CA0–CA2 or left without an external connection. This is selected using
bits P2CA4 and P2CA0.Similarly, the inverting input V− can be connected to
external signals CA1–CA7 or left unconnected, according to bits P2CA[3:1].The
internal reference voltage VCAREF can be chosen from ¼ VCC, ½ VCC or a
nominally fixed voltage from a transistor, Vdiode. This is selected with the
CAREFx bits. It can be applied to either input of the comparator according to
the CARSEL bit.
OPERATION OF COMPARATOR- A
It can be useful to connect a noisy input signal to the comparator so that the
MSP430 detects when the input goes through a well-defined level, such as
0.5VCC.
Anelectric field is created when a voltage is applied between the plates and the
field lines gofrom one plate to the other. Some of the lines remain in the
insulator but others emerge intothe air. When a finger is brought close to the
gap between the pads as in Figure (b), it distorts theelectric field and therefore
changes the capacitance. Any change in capacitance of the sensor corresponds
to a change in frequency which can be measured using the internal Timer_A
hardware of the MSP430.
APPLICATIONS OF COMPARATOR-A
FEATURES OF ADC 10
ARCHITECTURE OF ADC 10
Figure shows a simplified block diagram of the ADC10 in the F20x2; there are
more inputs in larger devices.The module looks more complicated because of
the wide range of options which are controlled by the registers ADC10CTL0 and
ADC10CTL1. The module is inactive when the ENC bit is clear.
Clock:This can be taken from MCLK, SMCLK, ACLK, or the module’s internal
oscillatorADC10OSC, selected with the ADC10SSELx bits. It must lie within the
range0.45–6.3MHz for the F20x2.The frequency of the clock can be divided by
2, 3, . . . , 7, 8 by configuring the ADC10DIVx bits. The output of the divider is
labeled ADC10CLK and feeds both theSAR core and sample-and-hold blocks.
Sample and Hold circuit: This is shown separately in the block diagram but is
presumably integrated into the SAR network. The time is chosen with the
ADC10SHTx bits, which allow 4, 8, 16, or 64 cycles of ADC10CLK.
Input selection: A multiplexer selects the input from eight external pins A0–A7
and four internal connections. Two of the internal connections are for optional
and the other two internal connections are A10 to a temperaturesensor and
A11 to Vmid = ½ (VCC+VSS).
Voltage references and buffer: ADC 10 uses VR+ and VR- as the upper and
lower references.
The lower reference is selected with SREF2 bit. It can be ground VSS or an
external reference signal VeREF-. The upper reference is selected with SREF0
and SREF1 bits. It can be analog supply voltage AVCC, internal reference VREF+
or an external reference VeREF+.
A buffer is needed between the internal reference and the core of the ADC10.
This isenabled only when needed because it draws more current than any
other part of themodule.
Interrupts: The interrupt flag ADC10IFG is raised when the result is written to
ADC10MEM, except when the DTC (Data Transfer Control) is used.
Three steps are required to make a single conversion with the ADC10. They
are:
1. Configure the ADC10, including the ADC10ON bit to enable the module.
TheENC bit must be clear during this operation because most bits in
ADC10CTL0 andADC10CTL1 can be changed only when ENC = 0.
2. Set the ENC bit to enable a conversion. This cannot be done while the
module isbeing configured in the previous step.
3. Trigger the conversion, either by setting the ADC10SC bit or by an edge from
Timer_A.
The last two steps must be repeated for each conversion, which requires
clearing andsetting the ENC bit again.
● In terms of Θ we have,
FEATURES OF ADC 12
The main features of ADC12 are as follows: