AnsweredAssumed Answered

Problem with AD7856 SPI in Arduino... Help!!

Question asked by psicko275 on Jan 18, 2013
Latest reply on May 7, 2013 by KarenNE

Hi, I try using the AD7856 in Arduino Mega ADK board, I read the datasheet and I have programing under Mode 2, but the AD7856 don't answer me, I connect a oscilloscope to MOSI and MISO lines and Arduino board send correctly the 16bits in MOSI line but in MISO only LOW! so this is my code in Arduino IDE, I hope you can help me!

#include <SPI.h>
uint8_t adcMSB = 0, adcLSB = 0;
unsigned int read_adc;
void setup()
{
  SPI.begin();
  SPI.setClockDivider(SPI_CLOCK_DIV4); //master clock 4MHZ
  SPI.setDataMode(SPI_MODE3);               //mode SPI 3
  SPI.setBitOrder(MSBFIRST);
  pinMode(53,OUTPUT);     
  digitalWrite(53,HIGH);
  pinMode(46,OUTPUT);
  digitalWrite(46,HIGH);
  Serial.begin(9600);
}


void loop()
{
  digitalWrite(46,LOW);     //this start the conversion in specific pin CONVST
  delay(1);                              //wait the device busy pin
  digitalWrite(46,HIGH);     //and start the trans.
  digitalWrite(53,LOW);     //enable device
  adcMSB=SPI.transfer(0b11100001); //here I configure the bits in Control Register, read channel 1, power mode normal
  adcLSB=SPI.transfer(0b00010001); //this read from ADC OUTPUT DATA REGISTER, start the Conversion, select mode 2
  digitalWrite(53,HIGH); //disable device
  delay(300);
  
//read for results
  read_adc= word(adcMSB, adcLSB);
  Serial.print(read_adc,HEX);
  Serial.print(" ");
  Serial.println(read_adc,DEC);
  
}

 

and this is my schematic:

Outcomes