197
Sensing a Sequence of ADC10 Channels with DMA
We have seen in the last segment that how we can compute the average value of an ADC10 channel
without involving the CPU much and using the MSP430’s DMA/DTC controller. The DTC of MSP430s
can be used in many innovative ways. One such way is to sense multiple channels in a row. In this
method, the ADC is basically scanned in an orderly fashion from the coder-specified topmost channel
to the bottommost (channel 0), saving the result of each ADC channel conversion in separate memory
locations. Scanning a sequence of AD channels in this way has many potential applications. Consider
the case of a solar charger controller. With one command you get both the input and output voltages,
and currents quickly from your MSP430 micro. DMA-assisted ADC scanning is perhaps the most
efficient and simple way to sense multiple ADC channels quickly.
Code Example
#include <msp430.h>
#include "delay.h"
#include "SW_I2C.h"
#include "PCF8574.h"
#include "lcd.h"
unsigned int ADC_value[2] = {0, 0};
void GPIO_graceInit(void);
void BCSplus_graceInit(void);
void ADC10_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
void lcd_print(unsigned char x_pos, unsigned char y_pos, unsigned int value);
void main(void)
{
/* Stop watchdog timer from timing out during initial start-up. */
WDTCTL = WDTPW | WDTHOLD;
/* initialize Config for the MSP430 GPIO */
GPIO_graceInit();
/* initialize Config for the MSP430 2xx family clock systems (BCS) */
BCSplus_graceInit();
/* initialize Config for the MSP430 10-bit Analog to Digital Converter (ADC)
*/
ADC10_graceInit();
/* initialize Config for the MSP430 System Registers */
System_graceInit();
/* initialize Config for the MSP430 WDT+ */
WDTplus_graceInit();
LCD_init();