AnsweredAssumed Answered

AD7606 interfacing with Arduino Mega 2560 issue.

Question asked by abdulmoeez8 on Apr 14, 2018
Latest reply on Apr 16, 2018 by jcolao

Greetings everyone,

I'm having an unusual problem working on AD7606 interfacing with Arduino Mega 2560 without the evaluation board. The code that I've written is as follows.

 


#define _RD 2
#define _CS 3
#define BUSY 7
#define RST 5
#define CONVST_A 6
#define CONVST_B 6
#define OS2 10
#define OS1 9
#define OS0 8

// INPUTS
int value = 0;

int DB[16] = {14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29};

 

void setup(){
Serial.begin(9600);
// Resetting before proper use.
digitalWrite(RST,LOW);
digitalWrite(RST, HIGH);

//Setting Oversampling Pins to Zero.
digitalWrite(OS2,LOW);
digitalWrite(OS1,LOW);
digitalWrite(OS0,LOW);

digitalWrite(_CS,HIGH);
digitalWrite(_RD,HIGH);


}

 

void loop() {

// CONV START PINS must be set for Proper Use
digitalWrite(CONVST_A,LOW);
digitalWrite(CONVST_B,HIGH);


// The conversion has begun But the BUSY PIN has yet to turn to ONE


//while(digitalRead(BUSY)==0);

//This counts for when the BUSY PIN is ONE


while(digitalRead(BUSY) > 0);

// Reading must be done. Setting up to Read Output.


digitalWrite(_CS,LOW);
Serial.println("AA");
delayMicroseconds(10);
digitalWrite(_RD,LOW);
Serial.println("BB");

 

// Output must now be on the Data Bus.
value=0;

for (int i = 1 ; i < 17 ; i++){
value += (int) digitalRead(DB[i-1]);
if(i==16) break;
value = value << 1;
}

digitalWrite(_RD,HIGH);
Serial.println(value);
delay(5000);

}

 

The result printed out on the Serial Monitor is 0 for the variable 'value'.  ADC should have printed the values on the Serial monitor but no result is being displayed except 0. Please help me understand the

Outcomes