SPI read 16 bits from data register w/ AD7705

I am tying to read from the data register of the AD7705 chip via SPI but all I seem to be getting is 0? I am not sure if I am doing this incorrectly or what? I am actually using the TM7705 module but in my understanding operates the same way as the AD7705. The flow charts on both AD7705 and TM7705 data sheets are the exact same for reading and writing to the registers as far as I can tell.

I am powering the module and my load cell with 5v from the arduino and the AIN+ to the S+ of load cell and the AIN- to the S- of load cell.

Can someone tell me where I am going wrong?

#include <SPI.h>

#define CS 10
#define DOUT 11
#define DIN 12
#define SCLK 13
#define DRDY 7

byte result;
byte highByte = 0;
byte lowByte = 0;
int adcValue = 0;

////register selection
//    //RS2 RS1 RS0
//    #define REG_CMM  0x0; //communication register 8 bit
//    #define REG_SETUP  0x1; //setup register 8 bit
//    #define REG_CLOCK  0x2; //clock register 8 bit
//    #define REG_DATA  0x3; //data register 16 bit, contains conversion result
//    #define REG_TEST  0x4; //test register 8 bit, POR 0x0
//    #define REG_NOP  0x5; //no operation
//    #define REG_OFFSET  0x6; //offset register 24 bit
//    #define REG_GAIN  0x7; // gain register 24 bit
//    //channel selection for AD7706 (for AD7705 use the first two channel definitions)
//    //CH1 CH0
//    #define CHN_AIN1  0x0; //AIN1; calibration register pair 0
//    #define CHN_AIN2  0x1; //AIN2; calibration register pair 1
//    #define CHN_COMM  0x2; //common; calibration register pair 0
//    #define CHN_AIN3  0x3; //AIN3; calibration register pair 2
//    //output update rate
//    //CLK FS1 FS0
//    #define UPDATE_RATE_20  0x0; // 20 Hz
//    #define UPDATE_RATE_25  0x1; // 25 Hz
//    #define UPDATE_RATE_100  0x2; // 100 Hz
//    #define UPDATE_RATE_200  0x3; // 200 Hz
//    #define UPDATE_RATE_50  0x4; // 50 Hz
//    #define UPDATE_RATE_60  0x5; // 60 Hz
//    #define UPDATE_RATE_250  0x6; // 250 Hz
//    #define UPDATE_RATE_500  0x7; // 500 Hz
//    //operating mode options
//    //MD1 MD0
//    #define MODE_NORMAL  0x0; //normal mode
//    #define MODE_SELF_CAL  0x1; //self-calibration
//    #define MODE_ZERO_SCALE_CAL  0x2; //zero-scale system calibration, POR 0x1F4000, set FSYNC high before calibration, FSYNC low after calibration
//    #define MODE_FULL_SCALE_CAL  0x3; //full-scale system calibration, POR 0x5761AB, set FSYNC high before calibration, FSYNC low after calibration
//    //gain setting
//    #define GAIN_1  0x0;
//    #define GAIN_2  0x1;
//    #define GAIN_4  0x2;
//    #define GAIN_8  0x3;
//    #define GAIN_16  0x4;
//    #define GAIN_32  0x5;
//    #define GAIN_64  0x6;
//    #define GAIN_128  0x7;
//    #define UNIPOLAR  0x0;
//    #define BIPOLAR  0x1;
//    #define CLK_DIV_1  0x1;
//    #define CLK_DIV_2  0x2;

void setup() {
  // put your setup code here, to run once:

  pinMode(DOUT, OUTPUT);
  pinMode(DIN, INPUT);
  pinMode(SCLK, OUTPUT);
  pinMode(CS, OUTPUT);
  pinMode(DRDY, OUTPUT);
  digitalWrite(CS, HIGH); //disable device

  digitalWrite(CS, LOW); //
  SPI.transfer(0x00); //power on amp
  digitalWrite(CS, HIGH);
  digitalWrite(CS, LOW); //
  SPI.transfer(0x20); // write to comm reg selecting channel and setting up next op to be a write to clock reg
  SPI.transfer(0x0C); // write to clock register setting clock bits in aacordance with master clock signal and select update rate for channel
  SPI.transfer(0x10); // write to comm reg selecting channel and setting up next op to be a write to setup reg
  SPI.transfer(0x40); // write to setup reg clearing fsync, setting gain, op conditions, and inititiating self cal on selected channel
  digitalWrite(CS, HIGH);


void loop() {
// put your main code here, to run repeatedly:
digitalWrite(CS, LOW);
if (digitalRead(DRDY == LOW)) {  
//   digitalWrite(CS, HIGH);
//   digitalWrite(CS, LOW);
  highByte = SPI.transfer(0x30);
  lowByte = SPI.transfer(0x30);

      adcValue = highByte << 8;
      adcValue = adcValue | lowByte;

digitalWrite(CS, HIGH);

AD7705_7706.pdf (389 KB)

tension compression load cell FL25.pdf (73.2 KB)

Please fix your indentation. In the IDE simply press ctrl+T

And with

  digitalWrite(CS, LOW);
  if (digitalRead(DRDY == LOW)) {

I think you mean, make CS low and wait untill the device is ready. But you don’t do that.

First of all what you do is you do a digitalRead(0). Why? DRDY == LOW will return false aka 0 an then you do a read. You meant digitalRead(DRDY) == LOW

Second, it does not wait. If DRDY isn’t low directly after making CS low it will just go on. Try:

  digitalWrite(CS, LOW);
  while(digitalRead(DRDY) != LOW){
  //and go on here

But if the commands are right etc, i have no idea…

I have fixed what you suggested but I am still having no luck. Is there any way to check if the registers are receiving the information I am sending to them via SPI.transfer?