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?