This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

dac-opamp-adc

Other Parts Discussed in Thread: MSP430FG4618


i'm using the msp430fg4618 experimenters board....i gave 00 to my DAC_DAT0 register....connected it to the internal opamp which acts as a voltage follower circuit....n the output of the opamp is given to the internal ADC12...

however the reading in the ADCMEM register is not zero....heres my prog:

 

#include "msp430fg4618.h"

void DAC12Init(void)
{

  DAC12_0DAT= 0x00;
  ADC12CTL0 = REF2_5V + REFON;                
 
  DAC12_0CTL = DAC12IR | DAC12AMP_5 | DAC12ENC;
 
}

void ADC12Init(void)
{
  ADC12CTL0 &= ~ENC;
  ADC12CTL0 |= SHT0_4 | ADC12ON;
  ADC12CTL1 = CSTARTADD_0 ;
  ADC12MCTL0 = INCH_1 | SREF_1;
  ADC12CTL0 |= ENC;                         
  ADC12CTL0 |= ADC12SC;                     
  ADC12IE |= BIT1;                         
}  

void OPInit()
{
  OA0CTL1 |= OAFC_4 | OAFBR_0;
  OA0CTL0 |= OAP_2 | OAPM_3 | OAADC1;
      
}


void main (void)
{
  WDTCTL = WDTPW | WDTHOLD;
 
 
  DAC12Init();

 
  ADC12Init();
 
  OPInit(); 

  TACTL = TASSEL_1 + MC_2 + TACLR + TAIE;

  _BIS_SR(GIE);
}

#pragma vector=ADC12_VECTOR
__interrupt void ADC_ISR(void)
{
   int x;
    x = ADC12MEM1;       
    ADC12CTL0 |= ADC12SC;
}

#pragma vector=TIMERA1_VECTOR
__interrupt void TimerA_ISR (void)
{
    ADC12CTL0 &=  ~ADC12SC;
    TACTL &= ~TAIFG;
}

  • Please check voltages in your circuit at the input and output of your amplifier.
    You should also refer to the amplifier data sheet and check what are minimum swing voltages of the output.
    Is the chip rail-to-rail output?

    What value do you read from ADC register?

    Regards
    Piotr Romaniuk, Ph.D.
    ELESOFTROM

  • As Piotr already suggested: check the voltages. What are you applying to the OpAmp, what are you reading on the ADC.

    Small non-zero values are to be expected, as the OpAmp does run with a single supply and the outputs usually cannot reach 0V (the negative rail) if the load is too light and cannot reach VCC if the load is too heavy. The ADC input, however, is an extremely light load.

    Unless the input impedance of the ADC is too low or the inrush current too high (some pF over 1kOhm series resistor), you shouldn't use an OpAmp. You're just introducing nonlinearity and offset errors. Only do it if yo need to amplify. And for something near 0V, don't use an OpAmp with single supply at all.

**Attention** This is a public forum