Multiple Channel ADC With MSP430

by drselim in Circuits > Microcontrollers

2139 Views, 1 Favorites, 0 Comments

Multiple Channel ADC With MSP430

ADC in MSP430 Microcontroller - Part 2: Multiple Conversion

Hi, in this instructable we'll see how to do analog to digital conversion (ADC) for multiple input channels in the MSP430 Microcontroller. We'll have two setups for the experiment: in the first one we'll have 6 potentiometers and we'll be observing their output values on the terminal window. In the second one we'll replace two potentiometers with an analog joystick and connect its X and Y axis so that we observe their values as we move it.

You can use this code&setup to use the converted values (which will have values between 0-1023) to control components such as servo motors.

Supplies

MSP430G2ET Launchpad, Breadboard, 6 Potentiometers (I used 10K in my example), 1 analog joystick, jumper cables, Code Composer Studio.

1st Setup and Code

msp430_multiple_adc1.png

In this first setup, we'll connect the Vcc of the six potentiometers to the 3.3 V Output pin on the Launchpad (We need to connect it to 3.3V and not 5V, because the internal reference value for the MSP430 is getting 3.3 Volts), and we connect the grounds of the potentiometers to the GND on the launchpad.

The output pins of the Potentiometers:

Output pin of the 1st Potentiometer --> P1.0 pin on the Launchpad

Output pin of the 2nd Potentiometer --> P1.3 pin on the Launchpad

Output pin of the 3rd Potentiometer --> P1.4 pin on the Launchpad

Output pin of the 4th Potentiometer --> P1.5 pin on the Launchpad

Output pin of the 5th Potentiometer --> P1.6 pin on the Launchpad

Output pin of the 6th Potentiometer --> P1.7 pin on the Launchpad

The reason we're leaving P1.1 and P1.2 blank is that we're using those pins for configuring the Digital Communication (UART). If you don't want to observe the output and use all of the 8 analog inputs for other purposes suc has PWM, etc. You can remove the digital communication section in the code and add P1.1 and P1.2 in the conversion as well.

The Code for this setup can be found at:

https://github.com/selimg76/microcontroller/blob/m...

2nd Setup

msp430_multiple_adc2.png

In this setup we replace the last 2 potentiometers with the X and Y axis connections of an analog joystick. We also connect the Vcc and GND pins of the joystick to 3.3V and GND on the launchpad.

You can use the same code in the previous step, since nothing changes if we use a potentiometer or an analog joystick, the only thing that changes is the response of the joystick, the value changes you get in the joystick are much sharper than the potentiometer.

https://github.com/selimg76/microcontroller/blob/m...

If you like the content please subscribe to my YouTube channel for similar tutorials and projects.

https://www.youtube.com/c/drselim

Thank you for your time & see you in another instructable!