MSP430 Functional Module Detailed Explanation Series - ADC12

Publisher:幸福时光Latest update time:2017-01-03 Source: eefocusKeywords:MSP430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. ADC12 conversion mode

ADC12 provides 4 conversion modes:

Single channel single conversion

To perform a single conversion on the selected channel, the following settings are required:
x = CSStartAdd, pointing to the conversion start address
ADC12MEMx stores the conversion result
ADC12IFG.x is the corresponding interrupt flag
ADC12MCTLx register defines the channel and reference voltage
When the conversion is completed, ENC must be reset and set again (rising edge) to prepare for the next conversion. The input signal before ENC is reset and set again will be ignored.

Sequential channel single conversion

To perform a single conversion on a sequence channel, the following settings are required:
x = CSStartAdd, indicating the conversion start address
EOS (ADC12MCTLx.7) = 1 marks the last channel y in the sequence, and the EOS bit of non-last channels is 0, indicating that the sequence has not ended.
ADC12MEMx, ... ADC12MEM.y store the conversion results
ADC12IFG.x, ... ADC12IFG.y are the corresponding interrupt flags .
The channel and reference voltage are defined in the ADC12MCTLx register.
When the conversion is completed, ENC must be reset and set again (rising edge) to prepare for the next conversion. The input signal before ENC is reset and set again will be ignored.

Single channel multiple conversions

Perform multiple conversions on the selected channel until the function is turned off or ENC=0. Set as follows:
x=CSStartAdd, pointing to the conversion start address
ADC12MEMx to store the conversion results. 
The channel and reference voltage are defined in the ADC12MCTLx register.
In this mode, you can change the conversion mode without stopping the conversion first. You can change the conversion mode after the current conversion is completed. There are several ways to stop this mode:
Use CONSEQ=0 to change to single-channel single-shot mode.
Use ENC=0 to stop the current conversion directly after completion.
Replace the current mode with single-channel single-shot mode and set ENC=0 at the same time

Multiple conversion of sequence channels

Convert the sequence channels multiple times until the function is turned off or ENC = 0. Set as follows:
x = CSStartAdd, indicating the conversion start address
EOS (ADC12MCTLx.7) = 1 marks the last channel y in the sequence. 
The ADC12MCTLx register defines the channel and reference voltage
change conversion mode, without having to stop the conversion first. Once the mode is changed (except single-channel single-shot mode), it will take effect immediately after the current sequence is completed.

Regardless of which conversion mode you use, you must deal with the following issues:

Set the specific mode
, input the analog signal,
pay attention to the conversion end signal,
store the conversion data, and read the data by query or interruption.

2. ADC12 Register Description

Register Type

Register Abbreviation

Register meaning

Conversion Control RegisterADC12CTL0Conversion Control Register 0
ADC12CTL1Conversion Control Register 1
Interrupt Control RegisterADC12IFGInterrupt Flag Register
ADC12IEInterrupt Enable Register
ADC12IVInterrupt Vector Register
Storage and control registersADC12MCTL0~ADC12MCTL15Storage control registers 0 to 15
ADC12MEM0~ADC12MEM15Storage registers 0 to 15

1. ADC12CTL0 control register 0, each bit definition:

15~1211~87

6

5

4

3

2

1

0

SHT1SHT0MSC2.5VREF
ON
ADC12
ON
ADC12
TOVIE
ADC12
TVIE
ENCADC12
SC

ADC12SC - sampling/conversion control bit. Under different conditions, the meaning of ADC12SC is as follows:

ENC=1
ISSH=0

SHP=1ADC12SC changes from 0 to 1 to start A/D conversion
ADC12SC automatically resets after A/D conversion is completed

SHP=0ADC12SC keeps high level sampling
A conversion is started when ADC12SC is reset

ENC - conversion enable bit.

0: ADC12 is in the initial state and A/D conversion cannot be started;
1: The first conversion is started by the rising edge of SAMPCON

ADC12TVIE——Conversion time overflow interrupt enable bit (if another sampling request occurs before the current conversion is completed, a conversion time overflow will occur)

0: No conversion time overflow occurred
1: Conversion time overflow occurred

ADC12OVIE - Overflow interrupt enable bit (when the original data in ADC12MEMx has not been read out, and there is new conversion result data to be written, an overflow occurs)

0: No overflow occurred
1: Overflow occurred

ADC12ON——ADC12 core control bit

0: Disable ADC12 core
1: Enable ADC12 core

REFON——reference voltage control bit

0: Internal reference voltage generator is off
1: Internal reference voltage generator is on

2.5V - internal reference voltage voltage selection bit

0: Select 1.5V internal reference voltage
1: Select 2.5V internal reference voltage

MSC - Multiple sampling conversion bit (CONSEQ<>0 means the current conversion mode is not single channel single conversion)

Valid conditions

MSC Value

meaning

SHP=1
CONSEQ<>0
0Each conversion requires the rising edge of the SHI signal to trigger the sampling timer
1Only the first conversion is triggered by the rising edge of the SHI signal. The subsequent conversions will be performed immediately after the previous conversion is completed.

SHT1, SHT0——Sample and hold timer 1, sample and hold timer 0

The relationship between the conversion sampling timing and the sampling clock ADC12CLK stored in the conversion result registers ADC12MEM8~ADC12MEM15 and ADC12MEM0~ADC12MEM7 is defined respectively. The sampling period is an integer multiple of the ADC12CLK period multiplied by 4, that is:

SHITx

0

1

23456789101112~15
n124816twenty four32486496128192256

2. ADC12CTL1 conversion control register 1 (mostly 3 to 15 bits, can only be modified when ENC=0), each bit definition:

15~1211~10

9

8

7~5

4.3

2.1

0

CSSTARTADDSHSSHPISSHADC12
DIV
ADC12
SSEL
CONSEQ

ADC12
BUSY

CSSTARTADD——Conversion memory address bit. The binary numbers 0 to 15 represented by these 4 bits correspond to ADC12MEM0 to 15 respectively. It can define a single conversion address or the first address of a sequence conversion.

SHS——Sampling trigger input source selection bit.

0: ADC12SC
1: Timer_A.OUT1
2: Timer_B.OUT0
3: Timer_B.OUT1

SHP - sampling signal (SAMPCON) selection control bit.

0: SAMPCON is derived from the sampling trigger input signal
1: SAMPCON is derived from the sampling timer, and the sampling timer is triggered by the rising edge of the sampling input signal

ISSH——Sampling input signal direction control bit

0: The sampling input signal is the same direction input
1: The sampling input signal is the reverse direction input

ADC12DIV——ADC12 clock source frequency division factor selection bit. The frequency division factor is the 3-bit binary number plus 1

ADC12SSEL——ADC12 core clock source selection

0: ADC12 internal clock source - ADC12OSC
1: ACLK
2: MCLK
3: SMCLK

CONSEQ - Conversion mode selection bits

0: Single channel single conversion mode
1: Sequential channel single conversion mode
2: Single channel multiple conversion mode
3: Sequential channel multiple conversion mode

ADC12BUSY——ADC12 busy flag (only used in single-channel single conversion mode, in other conversion modes, this bit is invalid)

0: Indicates no active operation
1: Indicates that ADC12 is in the sampling period, conversion period or sequence conversion period

3. ADC12MEM0~ADC12MEM15 conversion storage register

This group of registers are all 16-bit registers, used to store A/D conversion results. The lower 12 bits are used, and the upper 4 bits are 0 when read out.

4. ADC12MCTLx conversion storage control register (all bits can be modified only when ENC is low, and all bits are reset at POR)

There is a corresponding conversion memory control register for each conversion memory, so when the CSSTARTADD conversion memory address bit is set, ADC12MCTLx is also determined. The meaning of each bit of this register is as follows:

76, 5, 4

3, 2, 1, 0

EOSSREFINCH

EOS——Sequence end control bit

0: sequence has not ended
1: last conversion in the sequence

SREF——Reference voltage source selection bit

0: Vr+=AVcc, Vr-=AVss
1: Vr+=VREF+, Vr-=AVss 2,
3: Vr+=VEREF+, Vr-=AVss
4: Vr+=AVcc, Vr-=VREF-/VEREF-
5: Vr+= VREF+, Vr-= VREF-/VEREF-
6, 7: Vr+= VEREF+, Vr-= VREF-/VEREF-

INCH——Select analog input channel

0~7: A0~A7
8: VeREF+
9: VREF-/VeREF-
10: Output of on-chip temperature sensor
11~15: (AVCC-AVSS)/2

5. ADC12IFG interrupt flag register is 16 bits, where the interrupt flag bit ADC12IFG.x corresponds to the conversion storage register ADC12MEMx. The meaning of each bit is as follows:

1514

......

10
ADC12
IFG15
ADC12
IFG14
......ADC12
IFG1
ADC12
IFG0

ADC12IFG.x is set: the conversion is completed and the conversion result has been loaded into the conversion storage register.
ADC12IFG.x is reset: ADC12MEMx is accessed.

6. ADC12IE interrupt enable register is 16 bits, corresponding to ADC12IFG register. The meaning of each bit is as follows:

1514

......

10
ADC12
IE.15
ADC12
IE.14
......ADC12
IE.1
ADC12
IE.0

ADC12IE.x = 1: Enables the interrupt request service that occurs when the corresponding interrupt flag ADC12IFG.x is set.
ADC12IE.x = 0: Disables the interrupt request service that occurs when the corresponding interrupt flag ADC12IFG.x is set.

7. ADC12IV interrupt vector register

ADC12 is a multi-source interrupt: there are 18 interrupt flags (ADC12IFG.0~ADC12IFG.15 and ADC12TOV, ADC12OV), but only one interrupt vector. Therefore, it is necessary to set the priority order of these 18 flags, and arrange the response of the interrupt flags according to the priority order. A high-priority request can interrupt the low-priority one being served. As shown in the following table:

ADC12 interrupt flag ADC12IFG

ADC12TOVADC12OVADC12IV














1514131211109876543210


0000000000000000000
XXXXXXXXXXXXXXXXX12
XXXXXXXXXXXXXXXX104
XXXXXXXXXXXXXXX1006
XXXXXXXXXXXXXXX0008
~~~~~~~~~~~~~~~~~~~
X1000000000000000034
10000000000000000036

Each interrupt flag will generate an even number from 0 to 36.

ADC12OV and ADC12TOV will automatically reset after accessing ADC12IV. However, after responding to the interrupt service corresponding to the ADC12IFG.x flag, the corresponding flag will not be automatically reset to ensure that overflow can be handled.


Keywords:MSP430 Reference address:MSP430 Functional Module Detailed Explanation Series - ADC12

Previous article:MSP430 MCU controls IO port operation - LED flashes
Next article:PWM Operation of MSP430 MCU

Recommended ReadingLatest update time:2024-11-16 23:34

The core module design of handheld instrument based on MSP430
Introduction Handheld instruments are an important area of ​​embedded system application development. Handheld instruments have the advantages of being easy to carry, easy to operate, and having clear LCD display. This paper combines the development project of a handheld power meter and designs a handheld instrument
[Microcontroller]
The core module design of handheld instrument based on MSP430
Design of Wireless Sensor Network Based on MSP430
introduction Sensor testing technology is developing towards multifunctionality, miniaturization, intelligence, networking and wireless. As an emerging technology, self-organizing wireless sensor networks (Self Organizing Wireless Sensor Networks) are currently a hot topic of foreign research. They have sho
[Microcontroller]
MSP430 Series Ultra-Low Power MCU and Its Application
O Introduction The application of single-chip microcomputers is becoming more and more extensive, and the comprehensive performance requirements of processors are also getting higher and higher. Looking at the development of single-chip microcomputers, the market is becoming more and more refined with applicatio
[Microcontroller]
MSP430 Series Ultra-Low Power MCU and Its Application
Software programming methods and techniques
  This article mainly introduces the practical experience and application skills in software programming design of TIMSP430 microcontroller.   The first part describes the standard program flow mode based on interrupts, which is suitable for most product application programming; the other part describes some key issue
[Microcontroller]
Software programming methods and techniques
Design of low power consumption instrument system based on MSP430
1 Introduction Today, with science and technology and social production highly developed, intelligent test instruments and instrumentation systems are developing rapidly, and the span of the objects to be tested is both wide and diverse. The rapid development of computer technology has brought the developme
[Microcontroller]
MSP430 digital filter design sharing
When designing filters, we often need to use various software for calculation and simulation. MATLAB can well complete the design of traditional digital filters, but as a development engineer, we need a tool that can quickly implement the design. The following calculation tool is very suitable for the design of digital
[Microcontroller]
MSP430 digital filter design sharing
A multi-channel ADC sampling board system circuit design
  The design of ADC board can be divided into single-channel ADC board and multi-channel ADC board from the perspective of channels. In addition to some basic parameters such as effective number of bits, dynamic range, maximum sampling rate and input bandwidth, multi-channel ADC board often needs to measure the amplit
[Power Management]
A multi-channel ADC sampling board system circuit design
What are the main functional components of the MSP430 series microcontrollers?
1 CPU: The CPU of the MSP430 series microcontroller is basically the same as a general-purpose microprocessor, except that it is designed with a control-oriented structure and instruction system. The core CPU structure of the MSP430 is designed in accordance with the purpose of reduced instruction set and high trans
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号