program code for ADS1232 in arduino mega2560

I'm having trouble interfacing this chip with my Arduino mega2560

I have this so far:

int PDWN = 6;
int SCLK = 5;
int DATA = 4;
void setup() {  
  pinMode(DATA, INPUT);
  pinMode(SCLK, OUTPUT);
  pinMode(PDWN, OUTPUT);
  Serial.begin(115200);    
  digitalWrite(SCLK, LOW);
  digitalWrite(PDWN, HIGH);
  Serial.print("ADS1232\n");                 
}
void loop() {
  digitalWrite(SCLK, HIGH); 
  delay (100);                        
  int32_t value = 0;                         // Code for reading the data:
  digitalWrite(SCLK, LOW);                   // wake up ADC     
  while (digitalRead(DATA) == LOW);         // wait for data ready, stay in while-loop until LOW
  value = shiftIn(DATA, SCLK, MSBFIRST);
  value <<= 8;
  value |= shiftIn(DATA, SCLK, MSBFIRST);
  value <<= 8;
  value |= shiftIn(DATA, SCLK, MSBFIRST);
  digitalWrite(SCLK, HIGH);                   // enter sleep mode                                      
  value = ((signed long) (value << 8)) >> 8; // process as int24_t (two's compliment 24bit)
  Serial.println(value, DEC);
  Serial.flush();
}

serial monitoring results:
-1
-1
-1
....

any one help me?
thanks

That picture is useless. One can't see where that mess of wires is going. Draw a schematic.

If you are going to post pictures of actual hardware, including only one end of some wires in the picture renders the picture useless.

Post a link to the device.

Describe what is connected to the device, and what it is supposed to do.

Why are you bit-banging I2C?

PaulS:
That picture is useless. One can't see where that mess of wires is going. Draw a schematic.

If you are going to post pictures of actual hardware, including only one end of some wires in the picture renders the picture useless.

Post a link to the device.

Describe what is connected to the device, and what it is supposed to do.

Why are you bit-banging I2C?

Thanks for advice me.
my problem was solved.

Can I ask how you solve this problem?

Hi, how did you solve the problem?

Thank!

Hi, how do you solve it?

Thank you

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.