SLAA475A October 2010 – March 2019 MSP430L092
Within the MSP430x09x, an 8-bit DAC is implemented to generate voltages between 0 and 256 mV. The reference voltage for the DAC is the 256 mV generated internally from the reference module. The DAC voltage either can be used internally as an input for the comparator selected with the multiplexers or can be switched out on the AOUT pin. To set a voltage, the APINT register must be filled with the correct value, and the output buffer select (OSEL) and DAC buffer enable signal (DBON) bits must be set. To output the analog voltage on the port pin, it is necessary also to set the output driver (ODEN) bit. Any change of the APINT value is directly visible on the generated analog voltage.
A simple DAC code example follows. On the AOUT pin, a rising wave can be observed. Figure 4 shows the used paths through the A-Pool.
#include "msp430l092.h"
void main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
APCNF = DBON+CONVON+APREFON; // Enable DAC buffer +
// Enable conversion +
// Enable reference
APCTL = ODEN+OSEL; // Set DAC output to pin +
// Select output buffer
while (1)
{
APINT = APINT + 1; // Increment APINT value
}
}