ADC With MSP430
Hi, in this instructable, we'll see the ADC (Analog to Digital Conversion) module in the MSP430 and by the circuit that we'll build, we're going to measure the analog voltage output from a potentiometer with the help of a multimeter. And by writing C code in CCS, we'll read the same values of the potentiometer and display them by the help of a serial monitor. In addition to this, with the help of a shift register and LED array we'll make a voltage level monitor which gradually turns on/off the LEDs according to the output of the potentiometer (This part is optional, the code will work with or without this part).
Supplies
MSP430 Launchpad, Potentiometer (10K used here), jumper cables, 74HC595 shift register (optional), LED array (optional), current limiting resistors(optional), Code Composer Studio.
Circuit Setup
In the pictures, you can see the connections between the potentiometer, shift register and the launchpad.
To summarize:
Potentiometer Vcc --> 3.3 Volts on Launchpad
Potentiometer GND --> GND on Launchpad
Potentiometer Output (middle pin) --> P1.3 on Launchpad
(Optional) Shift Register Vcc & GND --> 5V and GND on Launchpad respectively
(Optional) Shift Register QA to QH Outputs --> LEDs over current limiting resistors
(Optional) Shift Register SER pin --> P1.0 on Launchpad
(Optional) Shift Register OE pin --> GND on Launchpad
(Optional) Shift Register RCLK pin --> P1.5 on Launchpad
(Optional) Shift Register SRCLK pin --> P1.4 on Launchpad
(Optional) Shift Register SRCLR pin --> 5V on Launchpad
CCS Code & Experiment
After building the circuit setup, you can use the following code for the experiment:
https://github.com/selimg76/microcontroller/blob/m...
After running the code in CCS, to create the terminal connection (Putty or the CCS built in terminal) you should use the COM port indicated in the device manager (for Windows) and you should set the baudrate to 19200 (this is set in the C code)
In the terminal window, you'll see the ADCMEM register value (between 0 and 1023) and the corresponding Voltage level in the second line. You can compare these values if you use a multimeter for the Potentiometer Output.
I hope this instructable has been useful for understanding the basics of ADC in MSP430.
If you like the content please subscribe to my YouTube channel for similar tutorials and projects.
https://www.youtube.com/c/drselim
See you in another one!