Hi everyone.
I am trying to communicate with ADS1220 in standard mode but without DOUT/DRDY pin. I set registers and read their values, receiving valid result.
Now I am trying to read temperature and voltages. Registers looks like:
#define DEFAULT_CONFIG_REG0 0b00000000 // AINP=AIN0, AINN=AIN1, Gain 1, PGA enabled
#define DEFAULT_CONFIG_REG1 0b00000100 // Data rate: 20 SPS, Normal Operating mode, Continuous conversion mode, Temperature sensor disabled, Burn-out disabled
#define DEFAULT_CONFIG_REG2 0b00010000 // Internal 2.048-V reference, Simultaneous 50-Hz and 60-Hz rejection, Switch always open, IDAC Off
#define DEFAULT_CONFIG_REG3 0b00000000 // IDAC1 disabled, IDAC2 disabled, Only DRDY
General code looks like:
writeSingleRegister( 1, DEFAULT_CONFIG_REG1 & (1 << 1) );
int temp = readData();
writeSingleRegister( 1, DEFAULT_CONFIG_REG1 );
int voltage = readData();
void writeSingleRegister(uint8_t address, const uint8_t value) {
// set CS and other variables ...
SPI.transfer(WREG | (address<<2));
SPI.transfer(value);
}
int32_t readData() {
// set CS and other variables ...
SPI.transfer(RDATA);
// read 3 bytes
}
Unfortunately my code receive nothing. Variables temp and voltage are all bits high.
I have no possibility to test data lines with oscilloscope or LA now, but everything seems that there is some problem with such data reading.