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.

AD16 External reference voltage

Part Number: MSP430F2003
Other Parts Discussed in Thread: LM4140

Tool/software: TI C/C++ Compiler

Hi,

 I have implemented analog to digital voltage conversion using the internal reference voltage of msp430f2003 AD16.However, when I use the external reference voltage, it cannot be used.

Internal reference software configuration: SD16CTL = SD16REFON+SD16SSEL_1;

External reference software configuration: SD16CTL = SD16SSEL_1;

Internal reference hardware: the VREF is grounded by a 104 capacitor.

External reference hardware: VREF with 3.0V LDO (LP2985IM5X) divided by two 100K resistors.

Can you help me identify the problem.

Thanks

best Regard.

  • Hi,

    1. Can you explain the phenomena of using external ref.

    2. You can see the datasheet that the current consumption is about 1.1mA and its resistance is 2000R. If you want to have an accurate external ref, you need to use a voltage reference LDO. If you just want to test the function,I think 100k is too large. You can use a multimeter to test the input voltage on ref+, it may be close to zero.

    Eason

  • Hi,
    1. The read ADC conversion value is 0xFFFF when using an external reference.
    2. Now I test that my reference voltage is about 1.5v.The maximum external reference input current for the user manual AD16 is 50nA.
  • Hi,
    I am sorry that I am confused between AD16 and AD10.
    Just see from guide book(in page 600). You just close the internal ref, but you don't open the external ref.
    You need to set SD16VMIDON = 1 in SD16CTL.
    Eason

  • Hi

     SD16VMIDON = 1 I have configured and the ADC output is also 0xFFFF.

  • Hi,

    I see the user guide again, what you did at the original is right.....

    So, when you test 0V, it is also 0xFFFF? Can you post your code and your hardware design?

    You may try to change the external reference from 1.5V to 1.2V.

    Eason

  • Hi,

    This is my schematic and source code.

    8176.main.c
    
    /**************************************************************************
    �������ƣ�PYM2012011-03IC--42~94-v1.0
    �����������������ʺ�PYM2012011��·�壬�¶ȷ�Χ��40��~85��С����������ͨ�ţ�P2.0��
    PWM�����p1.2��SDA��P1.1��SCL��P1.0���¶ȵ�ַ��ϵ��-42~-35�ȣ�1��4����ַ��
    80~85�ȣ�1��2����ַ��85.25~94.5�ȣ�ÿ��4����ַ������ÿ��һ����ַ  
    ���ߣ��ܰ���
    ���ڣ�2011��11��28��
    ==========================================================================
    ----------------------�޸ļ�¼--------------------------------------------
    �޸��ˣ�                       �޸�ʱ�䣺
    �޸�ԭ��
    --------------------------------------------------------------------------
    ==========================================================================
    ��ע��
    **************************************************************************/
    #include <msp430x20x3.h>                          //��Ʒ��Ҫ�Ļ��ͺ���Ҫ�ı��ͷ�ļ�
    #include <math.h>
    #include <stdlib.h>
    
    #define  TRXD           BIT6                     // TXD/RXD on P2.0
    
    void delay(unsigned int i);
    
    void init(void);
    
    void init_SD16();
    //void init_ADC081C027();
    void readADC_TLA202X();
    //void Read_Tmp116_Temp();
    //**********************************************************************/
    unsigned int  RXTXData=0;
    
    unsigned char RxBuf[8]={0x05,0x02,0x00,0x00,0x00,0xAA,0x00,0x00};//�����ֽ�
    
    static unsigned int ChA4results = 0x00;
    
    
    /**************************************************************************/
    
    /**************************************************************************/
    void delay(unsigned int dtime)
    {
          unsigned int i,j =0;;
          for (i=0;i<dtime;i++)
          {    
              for(j = 15;j>0;j--);        
          }
    }
    
    
    /**********************************************************/ 
    void init(void)
    {              
            WDTCTL = WDTPW + WDTHOLD;    
            //WDTCTL = WDT_MRST_32;
            BCSCTL1= CALBC1_1MHZ;                          //1Mhz
            DCOCTL = CALDCO_1MHZ;                          //�ӳ�50ms���ȴ�ϵͳ�ȶ�            
          
           // P2OUT |= TRXD;
           
             P2SEL &= ~TRXD; 
             P2REN |= TRXD;
             P2DIR |= TRXD;                                //p2.0 input
    
    }
    /*****************************************************************************/
    void init_SD16()
    {
      
      BCSCTL2 |= DIVS_3;       // SMCLK/8
      //SD16CTL =  SD16REFON+SD16VMIDON+SD16SSEL_1;  //�ڲ��ο�
      SD16CTL = SD16SSEL_1;  //�ⲿ�ο�
      //SD16CCTL0 = 0x59C2;
      //SD16CCTL0 = 0x5042;
      SD16CCTL0 = SD16SNGL + SD16UNI ;  
      SD16INCTL0 = SD16INCH_4;
      SD16AE = SD16AE4;
    }
    //-----------------------------------------------------------------------------
    void main(void)
    { 
        char i,j;
        WDTCTL = WDTPW + WDTHOLD;
        __delay_cycles(500000);
        init();
        //init_ADC081C027();
       
        BCSCTL1= CALBC1_8MHZ;                          //8Mhz
        DCOCTL = CALDCO_8MHZ; 
        __delay_cycles(50000);
         init_SD16();
         
         P2REN &=~ TRXD;
    
         P2DIR |= TRXD;
    
        
        while(1)
         { 
           __delay_cycles(50000);
           SD16CCTL0 |= SD16SC;    //��ADCͨ��
           ChA4results =  SD16MEM0;
           
           RxBuf[6]=(ChA4results&0xFF00)>>8;
           RxBuf[7]=(ChA4results&0x00FF);
           
           RxBuf[4]=(RxBuf[0]+RxBuf[1]+RxBuf[2]+RxBuf[3]+RxBuf[5]+RxBuf[6]+RxBuf[7])&0x0F;
         
              for(j = 0;j<8;j++)
              {
                RXTXData = RxBuf[j];    
                RXTXData|=0x100;
                RXTXData=RXTXData<<1; 
                __delay_cycles(825); 
                for( i=0;i<0x0A;i++)
                {  
                  if(RXTXData & 0x01)
                    P2OUT |= TRXD;
                  else
                    P2OUT &=~ TRXD;
                  RXTXData >>=1;
                  __delay_cycles(825);  //825
                }
                _NOP();
              }
           __delay_cycles(20);
         }
    }
    /***************************************************************************/
    
     
     
     

  • Hi,
    I just look into your code and the schematic, there is no obvious error. I have applied this MSP430 sample from TI.com, it will need 1 week until the result come out.
    I have some questions:
    1. When you use internal reference, you remove R4 and change R5 with a capacitor?
    2. Have you test the result when connecting A4 directly to ground?
    3. As you said before, you use internal reference is OK. But when you change the SD16CTL, the result always become 0xFF. Is it right? Can you offer some test result when the input voltage is different?
    Eason
  • Hi,
    Thank you for solving the problem for me. I will answer your three questions below.
    1.Yes,.That's how I changed it.
    2.When I use the external reference voltage, A4 is directly grounded and the output remains 0xFFFF.
    3.Again, input a different voltage result, such as 2V, and the output is still 0xFFFF.
  • Hi,
    My test result is that:
    1. I use a LM4140_1V as the VREF.
    2. A4+ and A4- all connected to the ground.
    3. Because in debug mode the ground voltage is not stable, the result is change from 200 to 6000.
    4. Anyway the result is not be 0xFFFF.

    My advice:
    1. Use a reference voltage chip as the REF, and make a test
    2. Reduce the resistance value

    Eason
  • Hi,
    You mean there is no problem with my software, the main problem is the reference source, right?For your test, I have a little doubt that both the A4+ pin and the a4-pin are grounded, and the output should be 0x0000, while the A4+ pin is suspended and the a4-pin is grounded, the test value will always change.

    jing
  • Hi,

    1. the main problem is the reference source, right?

        I can just guess, because the result I test is not 0xffff.

    2. while the A4+ pin is suspended and the a4-pin is grounded, the test value will always change.

        Is this result tested by you?

    3. Can you show me your test result?

    Eason