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.

ADS1220: Data reading issue

Part Number: ADS1220


Dear all,

I am using ATMEGA16A to get the data from ADS1220. I am using SPI protocol of the controller and same is connected to the SPI interface of the ADS1220. I can modify/read the content of config register of the ADS1220 but it is not sending anything if i am sending one time conversion command. My IC is not damaged bcz i can access and change the content of config register.

Please let me know were i am doing wrong. 

My code:

SPDR=0x08;// start conversion
while(!(0x80&SPSR));
while((0x01&PINA)==0x01);//wait for DDRY to become low
SPDR=0xFF;
while(!(0x80&SPSR));
a=SPDR;// read first char
SPDR=0xFF;
while(!(0x80&SPSR));
b=SPDR;// read first char
while(!(UCSRA&(1<<UDRE)));
UDR=a;
while(!(UCSRA&(1<<UDRE)));
UDR=b;

  • Hi Shrihari,

    This is the second time you have asked basically the same question with the only change a slightly different code section used.  I will suggest the same as my previous answer.  Usually the best way to discover what might be happening (or not happening) is to monitor your SPI communication and DRDY with an oscilloscope or logic analyzer.  Make sure your SPI is mode 1, and CS stays low throughout the entire communications transaction.  If possible, send me some screen shots of the communication and I can help verify for you.

    I have no idea the state of CS.  CS must be low the entire time you attempt to read the data.  The code appears that you are initiating the START command properly, but are you sure the DRDY polling is working correctly?  The code also appears to initiate communications for the first two bytes of the data, but not the third.  What is your input voltage and what do you expect as a value to be returned.  Your data may appear as zero if you have a zero or floating input and you are only reading the first two bytes of the data.

    Best regards,

    Bob B 

  • Hi Bob Benjamin,

    sorry for second time posting the same query. I was not able to see my first post that is the reason i have placed second one. Now i can see both

    Thank you for the suggestion. I was using SPI in mode 0 thats why i was not getting any reading. Now i configured it to mode 1. After this i can read all the three bytes from the ADS1220 but the problem is i am not getting the same reading as i expected for the known input.

    I am using internal reference 2.048 volt and my Avdd=5 v, Avss=GND and i am applying 0.01 volt to the channel zero of ADS1220 and i can able to read only 3rd byte(LSB) out of three byte, other two bytes are always zero. Simultaneously i am trying to vary the input but only change in the LSB byte and that too varying too much. I have permanently tied CS to ground.

    Please give your suggestions.
  • Hi Shrihari,

    Glad to hear you are making progress.  Can you give me the exact configuration settings you are using?  Also, can you send me the output code you see for the input voltage for several different input voltages?

    Thanks,

    Bob B