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 problem with setting registers

Other Parts Discussed in Thread: ADS1220, ADS1247

Hi,

I'm trying to build circuit with ads1220. I used to use ads1247, but I want to try ads1220 after being advised to use ads1220 in the forum..

Anyway,  I made little changes on my previous codes that I've been using for ads1247 with no problem. But this time I'm having problem with setting and reading registers.

For example, I want to write 0x00, 0x21, 0x43,  0x22 to the registers 00h, 01h, 02h, 03h with following code piece:

    SPI.transfer(0x40); 
    SPI.transfer(0x00);
    SPI.transfer(0x00); 

    SPI.transfer(0x41); 
    SPI.transfer(0x00);
    SPI.transfer(0x21);  

    SPI.transfer(0x42); 
    SPI.transfer(0x00);
    SPI.transfer(0x43); 

    SPI.transfer(0x43); 
    SPI.transfer(0x00); 
    SPI.transfer(0x22);

But when I check the registers  whit following code I get: FF 43 43 FF instead:

   unsigned long kontrol = 0x00;
//00h//
  kontrol = 0x00;
  SPI.transfer(0x20);
  SPI.transfer(0x00);
  kontrol = SPI.transfer(0xFF);
  Serial.print(kontrol, HEX);
  Serial.print("\t");

//01h//
  kontrol = 0x00;
  SPI.transfer(0x21);
  SPI.transfer(0x00);
  kontrol = SPI.transfer(0xFF);
  Serial.print(kontrol, HEX);
  Serial.print("\t");


//02h//
  kontrol = 0x00;
  SPI.transfer(0x22);
  SPI.transfer(0x00);
  kontrol = SPI.transfer(0xFF);
  Serial.print(kontrol, HEX);
  Serial.print("\t");
//03h// kontrol = 0x00; SPI.transfer(0x23); SPI.transfer(0x00); kontrol = SPI.transfer(0xFF); Serial.print(kontrol, HEX); Serial.print("\t");



When I change the value that I want to write into 03h, it's written also into 02h. 00h and 03h are still FF.  So that adc doesn't work.

As I said, the code works for ads124. But I feel I'm missing something for ads1220. Am I?

  • Hi Furkan,

    You are not communicating the proper sequence.  The ADS1220 has fewer registers, so within the command byte is also the number of registers and the number of bytes to be written.  This is a 1 byte command. This differs from the ADS1247 device which has a 2 bytes for the command for read and write.  See the command descriptions on page 33 of the ADS1220 datasheet.  The write sequence should be:

    0x40,0x00

    0x44,0x21

    0x48,0x43

    0x4C,0x22

    Or you could write all 4 bytes at once:

    0x43,0x00,0x21,0x43,0x22

    Read would be similar except instead of 0x4x it becomes 0x2x.  So what was included as a 2 byte command plus data for the ADS1247 is now a 1 byte command plus data.  Your current code will show both a read and write error.

    Best regards,

    Bob B

  • Hi Bob,

    Thanks for the answer. I got it worked.