ADC10 Tutorial for MSP430 Launchpad

by xanthium-enterprises in Circuits > Microcontrollers

17542 Views, 9 Favorites, 0 Comments

ADC10 Tutorial for MSP430 Launchpad

twitter-aebook.jpg

In this Instructable we will learn how to configure and use the ADC10 of MSP430G2553 microcontroller that comes with the TI Launchpad development board.

We will then display the ADC value on a Bar graph type display made of LED's.

Original Tutorial can be found online here

Source Codes of the Tutorial can be downloaded from here

The Microcontroller used here is the 20 pin MSP430G2553 which comes with Launchpad Board.

The code is written in embedded C and compiled using Code Composer Studio and IAR Embedded Workbench for MSP430

ADC10 Introduction

msp430-adc10-block-diagram-tutorial.png

MSP430G2xxxx series (for eg MSP430G2553) comes with a 10 bit Successive Approximation ADC that can operate at 200Ksps.

The ADC10 of MSP430G2xxx3 comes with 8 analog channels which can be used for interfacing external sensors and two internal one (one for Internal temperature sensor and the other for measuring Vcc-Vss/2 )

The ADC 10 also has a built in software selectable voltage reference source (1.5V or 2.5V) along with provision for providing external references.

Even though ADC10 can operate in 4 modes,here we are only going to discuss the Single Channel,Single Conversion Mode.

You can find explanations about important registers and Interrupts of ADC10 here

Materials Required

Things-Required.jpg

All the materials needed for this project can be easily found in your electronic collection.You will require the Following

1) MSP430 Launchpad Board containing MSP430G2553 chip

2) A Potentiometer (either 4.7 K or 10K ohm)

3) LED's (8 to be exact)

4) Resistors 1K ,8 numbers

5) ProtoBoard or Bread Board

6) Extra wires

7) Soldering Iron

Wiring Up the Potentiometer

Pot.jpg

To test the ADC10 on MSP430G2553 microcontroller we are going to Connect a 10K Potentiometer to the ADC Channel A0 .

The Potentiometer (POT) has three terminals as shown in the above image.The Middle terminal is called the wiper which moves as we rotates the shaft and changes the resistance value of the Pot.

We are going to connect the middle terminal to A0 terminal of MSP430G2553.A0 is Pin No 2 of MSP430G2553 (20 Pin DIP ) or P1.0.

The other two terminals of the POT can be connected to VCC (3.3V) and Ground of the MSP430 Launchpad Board .

Building Up the Bar Graph Type Display

LED_8bit_Data_Port_300_px.jpg

To display the voltage variation at A0 pin of MSP430 we are going to use a Bar graph type display using LED's .In case you have a Bar graph module available you can use that instead of building the one shown here.

The module we are going to build uses 8 LED's arranged linearly as shown above.

When the Voltage value at A0 pin increases ,Number of LED's lighting up also increases

and when the voltage value at A0 Decreases,the LED's starts to switch off .

You can see the effect on this youtube video here

Circuit Diagram of the Bar Graph Display

led-8-bit-data-port-circuit.jpg

Here the Ground's of 8 LED's are connected together and the Positive terminals are taken out through 1K resistors .In the Software for Displaying Data,Port 2 of MSP430 is used for controlling the LEDs,So connect

P2.0 to D0 or the first LED

P2.0 to D1 or the 2nd LED

...

..

and

P2.7 to D7 or the 8th LED .

Connect the Common Ground of LED to MSP430 Ground.

Connecting the POT to MSP430 Launchpad

adc-interfacing.jpg

Now Connect the Pot to the MSP430 Launchpad as shown in the above figure.Circuit Diagram is available here.

Now I have written a small program that would display the ADC value on the Emulator.The C file (called adc10-configuration.c) is available in the Code Download section of the above Link.

You can compile and download "adc10-configuration.c" to your Launchpad and then vary the potentiometer to check whether ADC is configured properly or not .

In case you are new to IAR IDE there is a short tutorial available online here.

When you turn the shaft of the POT ,the ADC value of ADC10MEM register will change in the emulator.

Downloading "adc10-configuration.c" to your Launchpad is not exactly required ,but it will ensure that ADC10 is configured properly and Potentiometer is connected correctly.

Connect the Display to Launchpad

twitter-aebook.jpg

1) Connect the LED's to Port 2 of the MSP430 Launchpad and POT to P1.0 of MSP430.

2) Compile and Download "adc10-bar-graph.c" to MSP430 .

3) Now Run the Code by Resetting MSP430 or by pressing RUN from CCS or IAR IDE .

4) Vary the Potentiometer to See the LED's changing.

For More info,Circuit Diagram and Source code you can check the original article here.