Electronic – ADC and DAC code for MSP430

adcdacmsp430

I'm doing a DSP project using the MSP430. I want to take an analog signal and convert it to a digital output using a microcontroller attached to an ADC on a DSP board. How would I program this in C?

  Input  -->  Output
 Analog  --> Digital
Digital  -->  Analog

Best Answer

This is the case where reading the datasheet is truly the best thing for you to do -- they will tell you exactly how to initialize, start [and stop], and use both an ADC and DAC. Since you haven't named a specific MSP430, ADC chip, or analog signal characteristics, I'm guessing that the design is very much in the initial planning stages. I suggest nailing down some requirements for each block in your system diagram, looking for parts that will do those things, then reading their datasheets. Examples of requirements would be sampling rate/frequency (remember Nyquist) and depth (in bits, which can be translated from Volts); you can get an MSP430 with a 12-bit ADC and DAC on the chip. Something else is peripheral support: are you using a user interface? Comparators or trigger interrupt pins, used with hardware timers, are great for interfacing with and debouncing buttons; SPI, UART or I2C/TWI are serial protocols used to drive a screen. Note that there are a variety of ways to generate analog signals -- no need to limit searches to DAC peripherals or ICs: given some parameters, such as ripple and precision, you can determine what frequency and number of bits to use to do PWM with a single (or two) pins. You can also use a traditional R2R DAC, but make the LSB a PWM output to give you both R2R resistor calibration as well as additional precision.