How to read ADC LTC2440 at 880HZ output rate??

Hello all,
I’m a newbie and can not handle with this project.
I want to read the result from LTC2440 ADC with connected load cell to it. I found some information but for 7hz output rate which is too slow for me. To get 880Hz output rate the F0 pin of ltc2440 must be grounded and the internal clock is 9Mhz by the datasheet. I read the data from adc but it is not correct. The output data length is 32bit so read 8 bytes, but I am not sure about in which order to place them.

//   I want to use LTC2440 in internal serial clock, Single cycle operation
//   The data is send when CS goes LOW and its lenght is 32bit
//  What oscillator to use ??? interal or external ???
//  I will try with internal oscillator - F0 grounded?
//  when F0 is grounded the internal oscillator is 9Mh = 880Hz output rate
//  so will set SCK ( serial clock ) to div16 = 1Mhz

// for UNO - MOSI - SDI PIN11
//            MISO - SDO PIN12
//            SCK - PIN13
//            SS - CS - PIN10
#include <SPI.h> // include spi library
byte byte1;  // declare 4 bytes because we have to read 32bit data so we have to 
byte byte2;  // read 4 bytes
byte byte3;  //
byte byte4;  //
double volts; 
byte csPIN = 10;    // declare select pin and miso pin
byte misoPIN = 12; //
  void setup()
  Serial.begin(115200); //set serial rate to 115200
  pinMode (csPIN, OUTPUT); //declare csPIN as an OUTPUT
  digitalWrite( csPIN, HIGH); // set cs pin to high to unsellect the adc - sleep mode
                                // adc set data when cs goes low

void loop() 
  delay(500); //delay for easy monitor the serial printed data
  uint32_t startTime = millis();    // declare mins and seconds for time information
  long secs;
  float mins;
  long result = 0;
    SPI.begin(); //   initialize SPI           
   SPI.setBitOrder(MSBFIRST);  //LTC2440 data is clocked in MSB first
   SPI.setDataMode(SPI_MODE0); // is that correct ??? clock polarity 0, clock phase 0
   SPI.setClockDivider(SPI_CLOCK_DIV2); // set clock sync to 8MHZ div = 2, because the internal clock of LTC2440 is 9.24MHZ
  digitalWrite(csPIN, LOW);  // raise the adc
  byte1 =0;
  byte2 =0;
  byte3 =0;
  byte4 =0;
  byte1 = SPI.transfer(0);
  result = byte1;  
  result = result <<8;
  byte2 = SPI.transfer(0);
  result |= byte2;
  result = result <<8;
  byte3 = SPI.transfer(0);
  result |= byte3;
  result = result <<8;
  byte4 = SPI.transfer(0);
  result |= byte4;
  SPI.end()  ;
  volts = result*0.1490116119384765625; //my refV = 5V (4.96V), at the bridge output I have 2.48V and the resolution is 2^24 = 16777216
  // 2.48 / 2^24 = 0.0000001490116119384765625V = 0.1490116119384765625 for microvolts
  digitalWrite(csPIN, HIGH); // set ADC to sleep mode
  SPI.end()  ;
  mins = (float) millis() / 60000;   // elapsed time in minutes
 Serial.print(result, BIN);
 Serial.print(byte1, BIN);
 Serial.print(byte2, BIN);
 Serial.print(byte3, BIN);
 Serial.print(byte4, BIN);


I have a few comments:

  1. Setting byte1 thru byte4 to zero before starting the SPI transfer is redundant, because you assign the results of reading the SPI data to these variables. Also, there is no need for these to be global variables, you can declare them inside loop() at the point at which you first use them.

  2. Pin numbers such as csPin and misoPin should be declared "const int".

  3. 'result' would be better declared as "unsigned long".

  4. Although the device produces a 24-bit result, that result is left-shifted by 4 bits. See page 11 of the datasheet. So to get the input voltage, you need to multiply 'result' by 2.48 / 2^28, not 2.48 / 2^24.

Thank you. I will put bytes in loop and declare cs and miso as a const int and will declare result as an unsigned long.

"Bits ranging from 28 to 5 are the 24-bit conversion result MSB ? rst. Bit 5 is the Least Signi? cant Bit (LSB)." When SPI starts reading ? From MSB or from bit 31 EOC. If it starts from MSB ok, but if starts read from EOC I guess I have to put away the first 4 bits and I don't know how to do that.

From the datasheet:

The LTC2440 serial output data stream is 32-bits long. The ?rst 3-bits represent status information indicating the sign and conversion state. The next 24-bits are the conversion result, MSB ? rst. The remaining 5-bits are sub LSBs beyond the 24-bit level that may be included in averaging or discarded without loss of resolution.

So you can Just treat it like a 29-bit converter.