Summary: We will learn what is involved in Analog to Digital Conversion and conversely, Digital to Analog Conversion.
#include <msp430x16x.h>
#define yellow 0x80
#define set_led(led, state) {
if (state)
P1OUT &= ~(led);
else P1OUT |= (led);
}
void main(void){
P1DIR |= 0x80;
set_led(yellow,0);
WDTCTL = WDTPW+WDTHOLD;
P6SEL |= 0x04;
ADC12CTL0 = ADC12ON+SHT0_2;
ADC12MCTL0 = SREF_0 + INCH_2 + EOS;
ADC12CTL1 = SHP;
ADC12CTL0 |= ENC;
while (1) {
ADC12CTL0 |= ADC12SC;
while ((ADC12IFG & BIT0)==0);
if (ADC12MEM0 >= 1620)
set_led(yellow,1)
else set_led(yellow,0)
_NOP();
}
}
NOP() after a sample is taken from the ADC, the user may check the ADC12MEMx register to see the new value that has been stored. If a value has changed since the last time the processor was halted, it will turn red.
DAC12_1CTL register so that DAC0 outputs a triangle wave. This program should be interrupt driven, and any computation of the triangle wave should be in the ISR. View the output on the oscilloscope and take a screenshot.
ADC12MEMx directly to DAC12_xDAT. You should also scale down each of the input signals so that you don't saturate the output. Only use a single interrupt. Take a screenshot with a) your stereo input signals (make sure that they are different) and b) your mono result. Could you process an audio CD like the one described in Problem 1.4? Explain.
"A basic tutorial of using the Data converter peripherals on the MSP430. Contains code for setting up the F16X Development board."