Skip to content Skip to navigation

Connexions

You are here: Home » Content » Laboratory Signal Acquisition: Lab2 - SAR ADC12 conversion

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • TI MSP430 display tagshide tags

    This module is included inLens: Texas Instruments MSP430
    By: Texas InstrumentsAs a part of collection: "Teaching and classroom laboratories based on the “eZ430” and "Experimenter's board" MSP430 microcontroller platforms and Code Composer Essentials"

    Comments:

    "This is an excerpt from the MSP430 Teaching CD produced under TI sponsorship and review at the University Beira Interior in Portugal. The material covers everything from "hello world" on an eZ430 […]"

    Click the "TI MSP430" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Laboratory Signal Acquisition: Lab2 - SAR ADC12 conversion

Module by: Pedro Dinis, António Espírito Santo, Bruno Ribeiro. E-mail the authors

Summary: Using the MSP-EXP430FG4618 Development Tool and the MSP430FG4618 device explore the ADC12 and OA modules. The test voltage is generated in the DAC12 module (channel 0) modifying the DAC12_ODAT register's value. The analogue voltage is amplified by the OA module. Afterwards this signal is applied to ADC12 input to be converted. Compare the DAC12_ODAT and the ADC12MEM0 values.

Laboratory Signal Acquisition: Lab2 - SAR ADC12 conversion

Introduction

This laboratory gives examples of the uses of the ADC types available in the hardware development kits. A different laboratory is developed for each kit, taking into account that both the ADC10 and the SD16_A laboratories implement a temperature data logger. The ADC12 laboratory also uses operational amplifiers to perform the analogue signal conditioning.

Overview

This laboratory (Lab2_ADC.c) examines the ADC12 and OA modules using the MSP-EXP430FG4618 Development Tool (MSP430FG4618 device). The test voltage is generated by the DAC12 channel 0, available in DAC12_ODAT register. The analogue signal is conditioned by the OA module (amplitude change), configured as non-inverting operational amplifier. Afterwards, this signal is applied to the ADC12 input to be converted. Compare the DAC12_ODAT and the ADC12MEM0 values.

Resources

The DAC12 module uses the same internal reference voltage as the ADC12 module (VREF+ = 2.5 V).

The OA module is configured as Non-inverting PGA with unity gain. The Non-inverting input is the DAC0 internal while the output is connected to internal/external A1 of the ADC12. The ADC12 sample-and-hold time is configured to be 64 ADC12CLK cycles. It performs a single-channel, single-conversion using ADC12OSC/1 as the clock source.

The resources used by the application (following the signal modification steps) are:

- DAC12;

- OA;

- ADC12;

- Timer_A;

- Interrupts.

Software application organization

The laboratory is organized following its working flow chart:

- Peripheral initialization phase, finishing with the MSP430 in LPM3;

- ISR phase, consisting of a Timer_A overflow service routine that triggers a new ADC12 conversion and it is responsible by the end of conversion.

The application starts by stopping the Watchdog Timer.

The system clock is configured by the FLL+ at 4.199304 MHz (128 x 32768Hz).

The DAC12 module is configured to present a null voltage (0 V) at the output. It uses the ADC12 internal 2.5 V reference voltage. The DAC12’s output is configured with 12-bit resolution, in straight binary. DAC12 uses the full-scale output with a Medium speed/current.

The OA module is configured as non-inverting PGA, the input signal (DAC0 internal) being in the rail-to-rail range. The output of the OA is connected to internal/external A1.

The ADC12 is configured to perform a single-channel (channel A1), single-conversion. The configuration includes the activation of the same internal reference voltage as the DAC12. The ADC12 clock source is ADC12OSC, with the sample-and-hold time selected as 64 ADC12CLK cycles.

The Timer_A is configured to use the ACLK as the clock source. It will count in continuous mode (TACCR0 counts up to 0FFFFh) and generate an interrupt to update the ADC12MEM. When the interrupt is serviced, the MSP430 enters into LPM3.

System configuration

ADC12 configuration:

The ADC12 module is configured in order to have the following characteristics:

- Single-channel, single-conversion operation;

- Uses the internal signal VREF+ (2.5 V) as reference voltage;

- The sample-and-hold time must be 64 ADC12CLK cycles;

- The conversion result must be available on ADC12MEM0;

- The sample-and-hold clock source is defined by software.

ADC12CTL0 |= SHT02|REF2_5V|REFON|ADC12ON|ENC|ADC12SC;
    //SHT1x (Sample-and-hold time) = 0000b -> N/A
    //SHT0x (Sample-and-hold time) = 0010b -> 64 ADC12CLK
    //MSC (Multiple sample and conversion) = 0b -> N/A
    //REF2_5V (Reference generator voltage) = 1b -> 2.5 V
    //REFON (Reference generator on) = 1b -> Reference on
    //ADC12ON (ADC12 on) = 1b -> ADC12 on
    //ADC12OVIE (overflow-int. enable) = 0b -> disabled
    //ADC12TOVIE (conversion-time-overflow int enable) = 0b
    // -> disabled
    //ENC (Enable conversion) = 0b -> enable configuration
    //ADC12SC (Start conversion) = 1b -> Start conversion

ADC12CTL1 = CSTARTADD_0; // Start MEM0, TB1, Rpt Sing.
    //CSTARTADDx (Conv. start address.) = 0000b -> ADC12MEM0
    //SHSx (Sample-and-hold source) = 00b -> ADC12SC bit
    //SHP (Sample-and-hold pulse-mode select) = 0b
    // -> SAMPCON is sourced from the sample-input signal
    //ISSH (Invert signal S-H) = 0b -> not inverted
    //ADC12DIVx (ADC12 clock divider) = 000b -> /1
    //ADC12SSELx (ADC12 clock source) = 00b -> ADC12OSC
    //CONSEQx (Conversion sequence mode) = 00b -> Single-
    // channel, single-conversion
    //ADC12BUSY (ADC12 busy) = xb -> read only
    

The ADC12 module operates with reference voltages: VR+ = VREF+ and VR- = AVSS. The channel selected to perform the analogue-to-digital conversion is channel A1. This channel is internally connected the OA0’s output.

ADC12MCTL0 = INCH_1 | SREF_1;
    //EOS (End of sequence) = 0b -> Not Used
    //SREFx (Select ref.) = 001b -> VR+=VREF+/VR-=AVSS
    //INCHx (Input channel select) = 0001b -> A1
    

DAC12 configuration:

DAC12_0DAT = 0x00; // DAC_0 output 0V
    
DAC12_0CTL = DAC12IR | DAC12AMP_5 | DAC12ENC;
    //DAC_0 -> P6.6
    //DAC_1 -> P6.7
    //DAC reference Vref
    //12 bits resolution
    //Immediate load
    //DAC full scale output
    //Medium speed/
    //Straight binary
    //Not grouped
    

OA0 configuration

The OA module of the MSP430FG4168 has three operational amplifiers with wide utilization flexibility. For this laboratory it is set up using the OA0 in non-Inverting PGA mode with the following configuration:

- The inverting input is connected to the DAC12 channel 0;

- The amplifier gain is configured as unity;

- The input is configured in rail-to-rail mode;

- The output is connected to the channel A1.

OA0CTL1 |= OAFC_4 | OAFBR_0;
    //OAFBRx (feedback resistor) = 000b -> Tap 0 (G=1)
    //OAFCx (OAx function) = 100b -> Non-inverting PGA
    //OARRIP = 0b -> OAx input range is rail-to-rail

OA0CTL0 |= OAP_2 | OAPM_3 | OAADC1;
    //OANx (Inverting input) = XXb -> not important
    //OAPx (Non-inverting input) = 10b -> DAC0 internal
    //OAPMx (Slew rate select) = 11b -> Fast
    //OAADC1 (OA output) = 1b -> output connected to A1
    //OAADC0 (OA output) = 0b -> output not connected A12
    

ADC12 ISR

#pragma vector=ADC12_VECTOR
__interrupt void ADC_ISR(void)
{
 int x;
 x = ADC12MEM0; // Reads data 
 ADC12CTL0 |= ADC12SC; // Start new conversion
}
    

Timer_A ISR

#pragma vector=TIMERA1_VECTOR
__interrupt void TimerA_ISR (void)
{
  ADC12CTL0 &= ~ADC12SC; //start new conversion
  TACTL &= ~TAIFG;
}
    

Analysis of operation

This laboratory uses the previous modules to construct an analogue signal chain as shown in Figure 1.

Figure 1
Analogue signal chain structure.
Analogue signal chain structure. (graphics1.png)

The input voltage VIN is in the range 0 V and 2.5 V, with a resolution of:

ΔVIN = ( 2.5 x VREF ) / 212 = 0.6 mV

The VIN value is controlled by the value in the DAC12_0DATA register.

The output voltage Vo has the same characteristics as the input voltage, but scaled by a multiplication factor (gain), attributed by the OA. The OA gain is selectable through the OAFBR field in the OA0CTL1 register.

The Vo conversion result is stored in the ADC12MEM0 register.

Once the signal chain modules are configured in accordance with the previous steps, initiate the experiment by completing the file, compiling it and running it on the Experimenter’s board. For the evaluation of the peripherals discussed during this laboratory, set a breakpoint on the ADC12_ISR and perform the following operations:

- Configure the DAC12_0DATA register with the value 0xFF. With the aid of a voltmeter, measure the analogue input voltage A6 (DAC12 channel 0 output). The value should be in the region of 0.15 V;

- Measure the input voltage A1 (OA0’s output). The voltage value should be the same;

- Execute the code. Verify the ADC12’s conversion result. The value should be similar to the one of the DAC12_0DATA register;

- Double the amplifier gain (2x). Verify the voltage at A0. It should be the double of the input voltage A1 (OA0’s output) given in step 2;

- Execute the code. Verify the ADC12’s conversion result. The value should be two times the value of the DAC12_0DATA register;

- Execute further modifications in order to evaluate the digital-to-analogue and analogue-to-digital conversion. Do not exceed the Vo maximum value (2.5 V).

This example and many others are available on the MSP430 Teaching ROM.

Request this ROM, and our other Teaching Materials here https://www-a.ti.com/apps/dspuniv/teaching_rom_request.asp

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks