program code for ADS1232 in arduino mega2560


i'm having trouble interfacing chip arduino mega2560

i have far:
code: [select]
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 reading data:
  digitalwrite(sclk, low);                   // wake adc     
  while (digitalread(data) == low);         // wait 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 int24_t (two's compliment 24bit)
  serial.println(value, dec);
  serial.flush();
}


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

any 1 me?
thanks

that picture useless. 1 can't see mess of wires going. draw schematic.

if going post pictures of actual hardware, including 1 end of wires in picture renders picture useless.

post link device.

describe connected device, , supposed do.

why bit-banging i2c?


Arduino Forum > Using Arduino > Programming Questions > program code for ADS1232 in arduino mega2560


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

RFID-RC522 with Arduino Pro Micro project. Error on the code?