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.

ADS 1230 reference code

Other Parts Discussed in Thread: ADS1230

Hi,

I am  using  ADS1230  ADC for my weighing scale application.almost complete my application .    i got a 5 gram accuracy .but i didn't get one gram accuracy.

  • my reference voltage is 5.107v
  • max load cell capacity is 45kg
  • pan count is 317 to 323
  • 1kg count is 3017 to 3021
  • here i am getting toggle, so i couldn't get a one gram accuracy .

 

please help me for finish my project

can any one send me reference code of ads1230 

 

advance thanks 

 

mani

  • Mani,

    There are a few things that you didn't tell me.  First of all what gain setting are you using , 64 or 128?  Second, what is the data rate you are using?  Also, you told me the total capacity of your load cell, but can you tell me how many mV/Volt output?  Is your excitation 5V?  It would also be good to know what range of weight you want to measure?

    One thing to keep in mind is the common mode input range for the load cell input to the ADC.  For this device it is between AGND+1.5V and AVDD-1.5V.  Another thing to remember is noise.  I think that this may be your problem.  The best you can do is 18 noise free bits at data rate of 10 sps and a gain of 64.  See Table 1 of the datasheet.  Also take a look at the application example on page 20, as well as the calculations for noise-free counts contained in the example.

    Code that we use for the EVM can be found at:

    ftp://ftp.ti.com/pub/data_acquisition/ADS123xREF/ADS123x_CDROM/Firmware/Firmware_Source_Code/

    Keep in mind that this code, written for an MSP430, also uses freeRTOS.  It can be difficult to follow, and it may not be very helpful for your application.

    Best regards,

    Bob B

  • hi Bob Benjamin,

    Thanks lot for value able reply.. i refer your source code its very useful for me .now i almost  got it one gram accuracy 

    every one want to know what i was faced next time what i  faced it will not be happen. i  am writing here what faced in this ads1230 

    i was used my code to read data in polling method.now i changed interrupt method it is working fine.

     


    sorry for the my bad english

    thanks a lot BOB

     

    Regards 

    mani

  • Hi mani,

     

    I am facing same problem like you.

     

    GAIN=128, 10SMPS, 5V ref.

    count for 1kg=3300

    I am getting fluctuation in ADC reading of 0-10 count between two samples.

     So problem in getting resolution in grams.

    Thankful to you for any help.

     

    KD

     

     

     

  • KD,

    10 counts is very close to the level of noise of the converter.  Review the Application Section on page 20.  Make sure you have a quiet supply and reference voltage.

    To verify the best possible level of performance with your system, short the inputs together and bias them to 2.5V.  When you take a series of readings you can identify how much noise you have in your system (Peak-to-Peak noise).  If you have a well designed system (including proper layout) you should see the level of noise shown in Table 1 of the datasheet on page 6.

    Hope that gets you started,

    Bob B

  • hi  here u told To verify the best possible level of performance with your system, short the inputs together and bias them to 2.5V.  When you take a series of readings you can identify how much noise you have in your system (Peak-to-Peak noise).

    but  i don't understand short the inputs together and bias them to 2.5V this line.. that is, Analog pasitive and negative is it correct sir.. if it is correct means where i should give bias 2.5 v...

  • hi mani.... this one week i am using this project... still i can't get any accuraacy ... i am getting counts but fluctuation.. today evening i will send my hard copy .. pls send me what my problem .. very urgent brother... pls.........My code is

     

    void main()
    {
    unsigned long receive_data_2,offset_data_1,offset_data_2,display_value;
    unsigned char dummy_v,dummy_c;

    Port_Config();
    receive_data_2=0;
    DATA=0;
    TRISB=0x00;
    TRISD=0x40;
    DATA_DIR=1;
    SCLK_DIR=0;
    GRD_DIR =0;
    GAIN=0;


    lcdinit();
    __delay_ms(25);
    lcdcmd(0x01);
    __delay_ms(25);
    lcdstr(home);
    __delay_ms(25);
    lcdcmd(0xC0);
    __delay_ms(25);
    lcdstr(home);
    __delay_ms(25);


    ////////////////////// weight scale initialize////////////////

    lcdcmd(0x80);
    lcdstr("dummy start");
    delay(50);

    for(dummy_c=0;dummy_c<=4;dummy_c++)
    {

    dummy_v=get_adc1230();

    }

    lcdcmd(0x80);
    lcdstr("Offset start");
    delay(50);

    offset_data_1=offset_calibation_adc1230();

    offset_data_2=offset_calibation_adc1230();
    display(0xC0,offset_data_2);
    /////////////////////////////////////////////////////////////////////////

    while(1)
    {
    DATA_DIR=1;
    device_c=0;

    receive_data_2=get_adc1230();
    display(0x80,receive_data_2);


    /*   
           
            if(offset_device_c==1)
            {
           
            __delay_ms(10);
            lcdcmd(0xC4);
            __delay_ms(10);
            lcdstr(dect);
           
            }
            else
            {
           
            __delay_ms(10);
            lcdcmd(0xC4);
            __delay_ms(10);
            lcdstr(ndect);
            }

    */

    receive_data_2=0;
    offset_data_2=0;
    display_value=0;
    delay(60);
    }
    }

    void display(unsigned char pos,unsigned long receive_data_dis)
    {
    unsigned long display_value=0;

    __delay_ms(50);
    lcdcmd(pos);
    __delay_ms(50);



        if ( receive_data_dis < 0x80000 )
        {
        display_value = receive_data_dis >> 1;
        }
        else
        {
        display_value = (( ~( receive_data_dis - 1 ) ) & 0x000FFFFF ) >> 1;      // ¸ºÊý ( È¡19λADÖµ, ÆÁ±Î5λ )
        //display_value = -display_value;
        //ES = 1;                                                                //
        }

    lcdchar(((display_value/10000000)+0x30));
    lcdchar((((display_value/1000000)%10)+0x30));
    lcdchar((((display_value/100000)%10)+0x30));
    lcdchar(((display_value/10000)%10)+0x30);
    lcdchar(((display_value/1000)%10)+0x30);
    lcdchar(((display_value/100)%10)+0x30);
    lcdchar(((display_value/10)%10)+0x30);
    lcdchar((display_value % 10)+0x30);
    }


    unsigned long get_adc1230()
    {
    unsigned long receive_data=0;;
    unsigned char clk=0;

    SCLK=0;
    NOP();
    NOP();
    NOP();
    NOP();


    while(DATA);

    device_c=1;

        NOP();
        NOP();
        NOP();
       
        for(clk=0;clk<=19;clk++)
        {
        SCLK=1;
        __delay_ms(2);

        SCLK=0;
        __delay_ms(2);
       

    /*   
        NOP();
        NOP();
        NOP();
        NOP();
    */              
    receive_data=receive_data<<1;

                if ( DATA == 1 )
                  receive_data|= 0x00000001;//0000 0000 0000 0000 0001
                else
                receive_data &= 0x000FFFFE;//1111 1111 1111 1111 1110
                NOP();
                NOP();
        }



    //DATA_DIR=0;
    //DATA=1;


    __delay_ms(25);
    lcdcmd(0x8D);
    __delay_ms(25);
    lcdchar((clk/10)+0x30);
    lcdchar((clk % 10)+0x30);

    return(receive_data);
    }

    ///////////////////////////////////////////////////////////////////
    ////////////offset calibaration

    unsigned long offset_calibation_adc1230()
    {
    unsigned long offset_receive_data=0;;
    unsigned char offset_clk=0;

    SCLK=0;
    NOP();
    NOP();
    NOP();
    NOP();


    while(DATA);
    //offset_device_c=1;
    NOP();
    NOP();
    NOP();
       
       
        for(offset_clk=0;offset_clk<=25;offset_clk++)
        {
        SCLK=1;
        __delay_ms(2);

        SCLK=0;
        __delay_ms(2);
                  
       
            if(offset_clk<=19)
            {
            offset_receive_data=offset_receive_data<<1;

                if ( DATA == 1 )
                  offset_receive_data|= 0x00000001;//0000 0000 0000 0000 0001
                else
                offset_receive_data &= 0x000FFFFE;//1111 1111 1111 1111 1110
                NOP();
                NOP();

                    if(offset_clk==19)
                    {
                    DATA_DIR=0;
                    DATA=1;
                    //__delay_us(50);
                    DATA_DIR=1;
                    delay(32);
                    }
            }
       
        }




       
       


    return(offset_receive_data);
    }



    ///////////////////////////////////////////////////////////////////////////
    // Initialise system
    static void Port_Config(void)
    {
    ADCON1 = 0x0F; // Default all pins to digital see datasheet

    // Configure ports as inputs (1) or outputs(0)
    TRISA = 0b00000000;
    TRISB = 0b00000000;
    TRISC = 0b00000000;
    TRISD = 0b00000000;
    TRISE = 0b00000000;

    // Clear all ports
    PORTA = 0b00000000;
    PORTB = 0b00000000;
    PORTC = 0b00000000;
    PORTD = 0b00000000;
    PORTE = 0b00000000;

    }





    void delay(unsigned int time)
    {
    int i,j;

    for(i=0;i<=time;i++)
    {
    __delay_ms(25);
    }

    }

     

  • hi mani can u send me your source code plz bcoz i am interfacing with ads 1230 first time

    if you don't want to send souce code then give me instruction to write my code

    but if u send source code then it will be good

    thanks in advance....

    Anip.

  •  Suresh Murugesan,

    hello Suresh in your code in that

    in the "display " routine why u right shift the data & then going for display also for negative number u complement the data what is the reason behind this

    so please give me justification about your display routine

    thanks in advance


                                                 Anip.

  • Dear Tom,

    Can I get the sample code in C not embedded asm..

     

    Regards,

     

    Navin Rana

  • Navin,

    The link Tom provided contains the complete zip archive of the software for the project utilizing msp430-gcc.  I will give the link again:

    ftp://ftp.ti.com/pub/data_acquisition/ADS123xREF/ADS123x_CDROM/Firmware/Firmware_Source_Code/Source_for_123XREF_firmware-1.1.0d.zip

    Best regards,

    Bob B